aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobody <>2003-04-03 16:34:49 +0000
committernobody <>2003-04-03 16:34:49 +0000
commit56119ffba54ea99aed55aed353725346558b2696 (patch)
tree495e36fff104a35666f05eee0b17d6ef091abbe7
parentd355127720dea14eef250e2e2c3db273d97f0c0c (diff)
downloadgdb-56119ffba54ea99aed55aed353725346558b2696.zip
gdb-56119ffba54ea99aed55aed353725346558b2696.tar.gz
gdb-56119ffba54ea99aed55aed353725346558b2696.tar.bz2
This commit was manufactured by cvs2svn to create branchcagney_frameaddr-20030403-branchpoint
'cagney_frameaddr-20030403-branch'. Sprout from cagney_framebase-20030326-branch 2003-03-29 23:29:48 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from cagney_framebase-20030326-branch 2003-03-26 20:19:13 UTC nobody 'This commit was manufactured by cvs2svn to create branch': gdb/symtab.h Cherrypick from master 2003-04-03 16:34:48 UTC Andrew Cagney <cagney@redhat.com> '2003-04-02 Andrew Cagney <cagney@redhat.com>': bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/aoutx.h bfd/archures.c bfd/bfd-in.h bfd/bfd-in2.h bfd/coff-arm.c bfd/coffcode.h bfd/coffgen.c bfd/config.bfd bfd/configure bfd/configure.in bfd/cpu-arm.c bfd/cpu-xtensa.c bfd/dwarf2.c bfd/elf-eh-frame.c bfd/elf.c bfd/elf32-arm.h bfd/elf32-ppc.c bfd/elf32-xtensa.c bfd/elflink.h bfd/elfxx-ia64.c bfd/elfxx-mips.c bfd/format.c bfd/libbfd.h bfd/libpei.h bfd/linker.c bfd/opncls.c bfd/peXXigen.c bfd/peicode.h bfd/reloc.c bfd/simple.c bfd/targets.c bfd/version.h bfd/xtensa-isa.c bfd/xtensa-modules.c gdb/ChangeLog gdb/MAINTAINERS gdb/Makefile.in gdb/NEWS gdb/ada-lang.c gdb/alpha-tdep.c gdb/arm-linux-tdep.c gdb/arm-tdep.c gdb/avr-tdep.c gdb/breakpoint.c gdb/c-lang.c gdb/config/i386/tm-symmetry.h gdb/config/pa/hppabsd.mh gdb/config/pa/hppabsd.mt gdb/config/pa/hppaosf.mh gdb/config/pa/hppaosf.mt gdb/config/pa/hppapro.mt gdb/config/pa/nm-hppab.h gdb/config/pa/nm-hppah.h gdb/config/pa/nm-hppao.h gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa64.h gdb/config/pa/tm-hppab.h gdb/config/pa/tm-hppao.h gdb/config/pa/tm-pro.h gdb/config/pa/xm-hppab.h gdb/config/pa/xm-hppah.h gdb/config/pa/xm-pa.h gdb/config/sparc/tm-sp64.h gdb/config/sparc/tm-sparc.h gdb/configure.host gdb/configure.tgt gdb/cris-tdep.c gdb/d10v-tdep.c gdb/doc/ChangeLog gdb/doc/Makefile.in gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/doc/observer.texi gdb/dummy-frame.c gdb/dummy-frame.h gdb/dwarf2expr.c gdb/dwarf2loc.c gdb/f-lang.c gdb/findvar.c gdb/frame-base.c gdb/frame-base.h gdb/frame.c gdb/frame.h gdb/frv-tdep.c gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/h8300-tdep.c gdb/hppa-hpux-tdep.c gdb/hppa-tdep.c gdb/hppah-nat.c gdb/hpread.c gdb/i386-tdep.c gdb/ia64-tdep.c gdb/infcmd.c gdb/inferior.h gdb/infrun.c gdb/infttrace.c gdb/jv-lang.c gdb/language.c gdb/language.h gdb/lin-lwp.c gdb/linux-proc.c gdb/m2-lang.c gdb/m68hc11-tdep.c gdb/m68k-tdep.c gdb/maint.c gdb/mcore-tdep.c gdb/mi/ChangeLog gdb/mi/mi-cmd-file.c gdb/mi/mi-cmds.c gdb/mi/mi-cmds.h gdb/mi/mi-getopt.c gdb/mi/mi-getopt.h gdb/mips-tdep.c gdb/mn10300-tdep.c gdb/ns32k-tdep.c gdb/objc-exp.y gdb/objc-lang.c gdb/objc-lang.h gdb/p-lang.c gdb/printcmd.c gdb/regcache.c gdb/remote.h gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/scm-lang.c gdb/sh-tdep.c gdb/signals/signals.c gdb/somread.c gdb/somsolib.h gdb/sparc-tdep.c gdb/stack.c gdb/symfile.c gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/call-rt-st.exp gdb/testsuite/gdb.base/callfuncs.exp gdb/testsuite/gdb.base/ending-run.exp gdb/testsuite/gdb.base/list.exp gdb/testsuite/gdb.base/pointers.exp gdb/testsuite/gdb.base/ptype.c gdb/testsuite/gdb.base/ptype.exp gdb/testsuite/gdb.base/sizeof.c gdb/testsuite/gdb.base/sizeof.exp gdb/testsuite/gdb.c++/casts.exp gdb/testsuite/gdb.mi/mi-file.exp gdb/testsuite/lib/gdb.exp gdb/testsuite/lib/mi-support.exp gdb/thread.c gdb/utils.c gdb/v850-tdep.c gdb/valops.c gdb/value.h gdb/vax-tdep.c gdb/version.in gdb/x86-64-tdep.c gdb/xstormy16-tdep.c include/ChangeLog include/dis-asm.h include/elf/ChangeLog include/elf/arm.h include/elf/common.h include/elf/xtensa.h include/gdb/ChangeLog include/gdb/sim-arm.h include/xtensa-config.h include/xtensa-isa-internal.h include/xtensa-isa.h opcodes/ChangeLog opcodes/Makefile.am opcodes/Makefile.in opcodes/arm-dis.c opcodes/arm-opc.h opcodes/configure opcodes/configure.in opcodes/disassemble.c opcodes/xtensa-dis.c sim/arm/ChangeLog sim/arm/Makefile.in sim/arm/armcopro.c sim/arm/armdefs.h sim/arm/armemu.c sim/arm/arminit.c sim/arm/armos.c sim/arm/configure sim/arm/configure.in sim/arm/wrapper.c sim/testsuite/ChangeLog sim/testsuite/sim/arm/adc.cgs sim/testsuite/sim/arm/add.cgs sim/testsuite/sim/arm/allinsn.exp sim/testsuite/sim/arm/and.cgs sim/testsuite/sim/arm/b.cgs sim/testsuite/sim/arm/bic.cgs sim/testsuite/sim/arm/bl.cgs sim/testsuite/sim/arm/bx.cgs sim/testsuite/sim/arm/cmn.cgs sim/testsuite/sim/arm/cmp.cgs sim/testsuite/sim/arm/eor.cgs sim/testsuite/sim/arm/hello.ms sim/testsuite/sim/arm/iwmmxt/iwmmxt.exp sim/testsuite/sim/arm/iwmmxt/tbcst.cgs sim/testsuite/sim/arm/iwmmxt/testutils.inc sim/testsuite/sim/arm/iwmmxt/textrm.cgs sim/testsuite/sim/arm/iwmmxt/tinsr.cgs sim/testsuite/sim/arm/iwmmxt/tmia.cgs sim/testsuite/sim/arm/iwmmxt/tmiaph.cgs sim/testsuite/sim/arm/iwmmxt/tmiaxy.cgs sim/testsuite/sim/arm/iwmmxt/tmovmsk.cgs sim/testsuite/sim/arm/iwmmxt/wacc.cgs sim/testsuite/sim/arm/iwmmxt/wadd.cgs sim/testsuite/sim/arm/iwmmxt/waligni.cgs sim/testsuite/sim/arm/iwmmxt/walignr.cgs sim/testsuite/sim/arm/iwmmxt/wand.cgs sim/testsuite/sim/arm/iwmmxt/wandn.cgs sim/testsuite/sim/arm/iwmmxt/wavg2.cgs sim/testsuite/sim/arm/iwmmxt/wcmpeq.cgs sim/testsuite/sim/arm/iwmmxt/wcmpgt.cgs sim/testsuite/sim/arm/iwmmxt/wmac.cgs sim/testsuite/sim/arm/iwmmxt/wmadd.cgs sim/testsuite/sim/arm/iwmmxt/wmax.cgs sim/testsuite/sim/arm/iwmmxt/wmin.cgs sim/testsuite/sim/arm/iwmmxt/wmov.cgs sim/testsuite/sim/arm/iwmmxt/wmul.cgs sim/testsuite/sim/arm/iwmmxt/wor.cgs sim/testsuite/sim/arm/iwmmxt/wpack.cgs sim/testsuite/sim/arm/iwmmxt/wror.cgs sim/testsuite/sim/arm/iwmmxt/wsad.cgs sim/testsuite/sim/arm/iwmmxt/wshufh.cgs sim/testsuite/sim/arm/iwmmxt/wsll.cgs sim/testsuite/sim/arm/iwmmxt/wsra.cgs sim/testsuite/sim/arm/iwmmxt/wsrl.cgs sim/testsuite/sim/arm/iwmmxt/wsub.cgs sim/testsuite/sim/arm/iwmmxt/wunpckeh.cgs sim/testsuite/sim/arm/iwmmxt/wunpckel.cgs sim/testsuite/sim/arm/iwmmxt/wunpckih.cgs sim/testsuite/sim/arm/iwmmxt/wunpckil.cgs sim/testsuite/sim/arm/iwmmxt/wxor.cgs sim/testsuite/sim/arm/iwmmxt/wzero.cgs sim/testsuite/sim/arm/ldm.cgs sim/testsuite/sim/arm/ldr.cgs sim/testsuite/sim/arm/ldrb.cgs sim/testsuite/sim/arm/ldrh.cgs sim/testsuite/sim/arm/ldrsb.cgs sim/testsuite/sim/arm/ldrsh.cgs sim/testsuite/sim/arm/misaligned1.ms sim/testsuite/sim/arm/misaligned2.ms sim/testsuite/sim/arm/misaligned3.ms sim/testsuite/sim/arm/misc.exp sim/testsuite/sim/arm/mla.cgs sim/testsuite/sim/arm/mov.cgs sim/testsuite/sim/arm/mrs.cgs sim/testsuite/sim/arm/msr.cgs sim/testsuite/sim/arm/mul.cgs sim/testsuite/sim/arm/mvn.cgs sim/testsuite/sim/arm/orr.cgs sim/testsuite/sim/arm/rsb.cgs sim/testsuite/sim/arm/rsc.cgs sim/testsuite/sim/arm/sbc.cgs sim/testsuite/sim/arm/smlal.cgs sim/testsuite/sim/arm/smull.cgs sim/testsuite/sim/arm/stm.cgs sim/testsuite/sim/arm/str.cgs sim/testsuite/sim/arm/strb.cgs sim/testsuite/sim/arm/strh.cgs sim/testsuite/sim/arm/sub.cgs sim/testsuite/sim/arm/swi.cgs sim/testsuite/sim/arm/swp.cgs sim/testsuite/sim/arm/swpb.cgs sim/testsuite/sim/arm/teq.cgs sim/testsuite/sim/arm/testutils.inc sim/testsuite/sim/arm/thumb/adc.cgs sim/testsuite/sim/arm/thumb/add-hd-hs.cgs sim/testsuite/sim/arm/thumb/add-hd-rs.cgs sim/testsuite/sim/arm/thumb/add-rd-hs.cgs sim/testsuite/sim/arm/thumb/add-sp.cgs sim/testsuite/sim/arm/thumb/add.cgs sim/testsuite/sim/arm/thumb/addi.cgs sim/testsuite/sim/arm/thumb/addi8.cgs sim/testsuite/sim/arm/thumb/allthumb.exp sim/testsuite/sim/arm/thumb/and.cgs sim/testsuite/sim/arm/thumb/asr.cgs sim/testsuite/sim/arm/thumb/b.cgs sim/testsuite/sim/arm/thumb/bcc.cgs sim/testsuite/sim/arm/thumb/bcs.cgs sim/testsuite/sim/arm/thumb/beq.cgs sim/testsuite/sim/arm/thumb/bge.cgs sim/testsuite/sim/arm/thumb/bgt.cgs sim/testsuite/sim/arm/thumb/bhi.cgs sim/testsuite/sim/arm/thumb/bic.cgs sim/testsuite/sim/arm/thumb/bl-hi.cgs sim/testsuite/sim/arm/thumb/bl-lo.cgs sim/testsuite/sim/arm/thumb/ble.cgs sim/testsuite/sim/arm/thumb/bls.cgs sim/testsuite/sim/arm/thumb/blt.cgs sim/testsuite/sim/arm/thumb/bmi.cgs sim/testsuite/sim/arm/thumb/bne.cgs sim/testsuite/sim/arm/thumb/bpl.cgs sim/testsuite/sim/arm/thumb/bvc.cgs sim/testsuite/sim/arm/thumb/bvs.cgs sim/testsuite/sim/arm/thumb/bx-hs.cgs sim/testsuite/sim/arm/thumb/bx-rs.cgs sim/testsuite/sim/arm/thumb/cmn.cgs sim/testsuite/sim/arm/thumb/cmp-hd-hs.cgs sim/testsuite/sim/arm/thumb/cmp-hd-rs.cgs sim/testsuite/sim/arm/thumb/cmp-rd-hs.cgs sim/testsuite/sim/arm/thumb/cmp.cgs sim/testsuite/sim/arm/thumb/eor.cgs sim/testsuite/sim/arm/thumb/lda-pc.cgs sim/testsuite/sim/arm/thumb/lda-sp.cgs sim/testsuite/sim/arm/thumb/ldmia.cgs sim/testsuite/sim/arm/thumb/ldr-imm.cgs sim/testsuite/sim/arm/thumb/ldr-pc.cgs sim/testsuite/sim/arm/thumb/ldr-sprel.cgs sim/testsuite/sim/arm/thumb/ldr.cgs sim/testsuite/sim/arm/thumb/ldrb-imm.cgs sim/testsuite/sim/arm/thumb/ldrb.cgs sim/testsuite/sim/arm/thumb/ldrh-imm.cgs sim/testsuite/sim/arm/thumb/ldrh.cgs sim/testsuite/sim/arm/thumb/ldsb.cgs sim/testsuite/sim/arm/thumb/ldsh.cgs sim/testsuite/sim/arm/thumb/lsl.cgs sim/testsuite/sim/arm/thumb/lsr.cgs sim/testsuite/sim/arm/thumb/mov-hd-hs.cgs sim/testsuite/sim/arm/thumb/mov-hd-rs.cgs sim/testsuite/sim/arm/thumb/mov-rd-hs.cgs sim/testsuite/sim/arm/thumb/mov.cgs sim/testsuite/sim/arm/thumb/mul.cgs sim/testsuite/sim/arm/thumb/mvn.cgs sim/testsuite/sim/arm/thumb/neg.cgs sim/testsuite/sim/arm/thumb/orr.cgs sim/testsuite/sim/arm/thumb/pop-pc.cgs sim/testsuite/sim/arm/thumb/pop.cgs sim/testsuite/sim/arm/thumb/push-lr.cgs sim/testsuite/sim/arm/thumb/push.cgs sim/testsuite/sim/arm/thumb/ror.cgs sim/testsuite/sim/arm/thumb/sbc.cgs sim/testsuite/sim/arm/thumb/stmia.cgs sim/testsuite/sim/arm/thumb/str-imm.cgs sim/testsuite/sim/arm/thumb/str-sprel.cgs sim/testsuite/sim/arm/thumb/str.cgs sim/testsuite/sim/arm/thumb/strb-imm.cgs sim/testsuite/sim/arm/thumb/strb.cgs sim/testsuite/sim/arm/thumb/strh-imm.cgs sim/testsuite/sim/arm/thumb/strh.cgs sim/testsuite/sim/arm/thumb/sub-sp.cgs sim/testsuite/sim/arm/thumb/sub.cgs sim/testsuite/sim/arm/thumb/subi.cgs sim/testsuite/sim/arm/thumb/subi8.cgs sim/testsuite/sim/arm/thumb/swi.cgs sim/testsuite/sim/arm/thumb/testutils.inc sim/testsuite/sim/arm/thumb/tst.cgs sim/testsuite/sim/arm/tst.cgs sim/testsuite/sim/arm/umlal.cgs sim/testsuite/sim/arm/umull.cgs sim/testsuite/sim/arm/xscale/blx.cgs sim/testsuite/sim/arm/xscale/mia.cgs sim/testsuite/sim/arm/xscale/miaph.cgs sim/testsuite/sim/arm/xscale/miaxy.cgs sim/testsuite/sim/arm/xscale/mra.cgs sim/testsuite/sim/arm/xscale/testutils.inc sim/testsuite/sim/arm/xscale/xscale.exp Delete: gdb/mi/gdbmi.texinfo
-rw-r--r--bfd/ChangeLog142
-rw-r--r--bfd/Makefile.am20
-rw-r--r--bfd/Makefile.in24
-rw-r--r--bfd/aoutx.h21
-rw-r--r--bfd/archures.c5
-rw-r--r--bfd/bfd-in.h10
-rw-r--r--bfd/bfd-in2.h47
-rw-r--r--bfd/coff-arm.c66
-rw-r--r--bfd/coffcode.h53
-rw-r--r--bfd/coffgen.c3
-rw-r--r--bfd/config.bfd6
-rwxr-xr-xbfd/configure30
-rw-r--r--bfd/configure.in2
-rw-r--r--bfd/cpu-arm.c278
-rw-r--r--bfd/cpu-xtensa.c38
-rw-r--r--bfd/dwarf2.c176
-rw-r--r--bfd/elf-eh-frame.c50
-rw-r--r--bfd/elf.c24
-rw-r--r--bfd/elf32-arm.h102
-rw-r--r--bfd/elf32-ppc.c14
-rw-r--r--bfd/elf32-xtensa.c5846
-rw-r--r--bfd/elflink.h11
-rw-r--r--bfd/elfxx-ia64.c16
-rw-r--r--bfd/elfxx-mips.c87
-rw-r--r--bfd/format.c12
-rw-r--r--bfd/libbfd.h10
-rw-r--r--bfd/libpei.h42
-rw-r--r--bfd/linker.c28
-rw-r--r--bfd/opncls.c7
-rw-r--r--bfd/peXXigen.c20
-rw-r--r--bfd/peicode.h43
-rw-r--r--bfd/reloc.c43
-rw-r--r--bfd/simple.c95
-rw-r--r--bfd/targets.c4
-rw-r--r--bfd/version.h2
-rw-r--r--bfd/xtensa-isa.c593
-rw-r--r--bfd/xtensa-modules.c6088
-rw-r--r--gdb/ChangeLog499
-rw-r--r--gdb/MAINTAINERS1
-rw-r--r--gdb/Makefile.in34
-rw-r--r--gdb/NEWS3
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/alpha-tdep.c10
-rw-r--r--gdb/arm-linux-tdep.c2
-rw-r--r--gdb/arm-tdep.c310
-rw-r--r--gdb/avr-tdep.c12
-rw-r--r--gdb/breakpoint.c3
-rw-r--r--gdb/c-lang.c4
-rw-r--r--gdb/config/i386/tm-symmetry.h2
-rw-r--r--gdb/config/pa/hppabsd.mh8
-rw-r--r--gdb/config/pa/hppabsd.mt6
-rw-r--r--gdb/config/pa/hppaosf.mh10
-rw-r--r--gdb/config/pa/hppaosf.mt6
-rw-r--r--gdb/config/pa/hppapro.mt6
-rw-r--r--gdb/config/pa/nm-hppab.h246
-rw-r--r--gdb/config/pa/nm-hppah.h7
-rw-r--r--gdb/config/pa/nm-hppao.h86
-rw-r--r--gdb/config/pa/tm-hppa.h5
-rw-r--r--gdb/config/pa/tm-hppa64.h9
-rw-r--r--gdb/config/pa/tm-hppab.h94
-rw-r--r--gdb/config/pa/tm-hppao.h196
-rw-r--r--gdb/config/pa/tm-pro.h28
-rw-r--r--gdb/config/pa/xm-hppab.h48
-rw-r--r--gdb/config/pa/xm-hppah.h2
-rw-r--r--gdb/config/pa/xm-pa.h10
-rw-r--r--gdb/config/sparc/tm-sp64.h18
-rw-r--r--gdb/config/sparc/tm-sparc.h2
-rw-r--r--gdb/configure.host4
-rw-r--r--gdb/configure.tgt6
-rw-r--r--gdb/cris-tdep.c24
-rw-r--r--gdb/d10v-tdep.c135
-rw-r--r--gdb/doc/ChangeLog40
-rw-r--r--gdb/doc/Makefile.in2
-rw-r--r--gdb/doc/gdb.texinfo4566
-rw-r--r--gdb/doc/gdbint.texinfo47
-rw-r--r--gdb/doc/observer.texi18
-rw-r--r--gdb/dummy-frame.c13
-rw-r--r--gdb/dummy-frame.h4
-rw-r--r--gdb/f-lang.c1
-rw-r--r--gdb/findvar.c4
-rw-r--r--gdb/frame-base.c154
-rw-r--r--gdb/frame-base.h94
-rw-r--r--gdb/frame.c63
-rw-r--r--gdb/frame.h17
-rw-r--r--gdb/frv-tdep.c14
-rw-r--r--gdb/gdbarch.c346
-rw-r--r--gdb/gdbarch.h201
-rwxr-xr-xgdb/gdbarch.sh28
-rw-r--r--gdb/h8300-tdep.c14
-rw-r--r--gdb/hppa-hpux-tdep.c1
-rw-r--r--gdb/hppa-tdep.c7
-rw-r--r--gdb/hppah-nat.c8
-rw-r--r--gdb/hpread.c19
-rw-r--r--gdb/i386-tdep.c23
-rw-r--r--gdb/ia64-tdep.c16
-rw-r--r--gdb/infcmd.c72
-rw-r--r--gdb/inferior.h31
-rw-r--r--gdb/infrun.c74
-rw-r--r--gdb/infttrace.c10
-rw-r--r--gdb/jv-lang.c8
-rw-r--r--gdb/language.c26
-rw-r--r--gdb/language.h7
-rw-r--r--gdb/lin-lwp.c231
-rw-r--r--gdb/linux-proc.c205
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/m68hc11-tdep.c12
-rw-r--r--gdb/m68k-tdep.c5
-rw-r--r--gdb/maint.c13
-rw-r--r--gdb/mcore-tdep.c14
-rw-r--r--gdb/mi/ChangeLog14
-rw-r--r--gdb/mi/gdbmi.texinfo3902
-rw-r--r--gdb/mi/mi-cmd-file.c67
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
-rw-r--r--gdb/mi/mi-getopt.c16
-rw-r--r--gdb/mi/mi-getopt.h20
-rw-r--r--gdb/mips-tdep.c31
-rw-r--r--gdb/mn10300-tdep.c14
-rw-r--r--gdb/ns32k-tdep.c6
-rw-r--r--gdb/objc-exp.y3
-rw-r--r--gdb/objc-lang.c3
-rw-r--r--gdb/objc-lang.h2
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/printcmd.c15
-rw-r--r--gdb/regcache.c18
-rw-r--r--gdb/remote.h3
-rw-r--r--gdb/rs6000-tdep.c22
-rw-r--r--gdb/s390-tdep.c13
-rw-r--r--gdb/scm-lang.c1
-rw-r--r--gdb/sh-tdep.c15
-rw-r--r--gdb/signals/signals.c21
-rw-r--r--gdb/somread.c4
-rw-r--r--gdb/somsolib.h12
-rw-r--r--gdb/sparc-tdep.c24
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/symtab.h10
-rw-r--r--gdb/testsuite/ChangeLog44
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp18
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp6
-rw-r--r--gdb/testsuite/gdb.base/ending-run.exp4
-rw-r--r--gdb/testsuite/gdb.base/list.exp5
-rw-r--r--gdb/testsuite/gdb.base/pointers.exp39
-rw-r--r--gdb/testsuite/gdb.base/ptype.c3
-rw-r--r--gdb/testsuite/gdb.base/ptype.exp4
-rw-r--r--gdb/testsuite/gdb.base/sizeof.c1
-rw-r--r--gdb/testsuite/gdb.base/sizeof.exp2
-rw-r--r--gdb/testsuite/gdb.c++/casts.exp7
-rw-r--r--gdb/testsuite/gdb.mi/mi-file.exp65
-rw-r--r--gdb/testsuite/lib/gdb.exp12
-rw-r--r--gdb/testsuite/lib/mi-support.exp8
-rw-r--r--gdb/thread.c64
-rw-r--r--gdb/utils.c17
-rw-r--r--gdb/v850-tdep.c13
-rw-r--r--gdb/valops.c89
-rw-r--r--gdb/value.h10
-rw-r--r--gdb/vax-tdep.c6
-rw-r--r--gdb/version.in2
-rw-r--r--gdb/x86-64-tdep.c4
-rw-r--r--gdb/xstormy16-tdep.c14
-rw-r--r--include/ChangeLog12
-rw-r--r--include/dis-asm.h1
-rw-r--r--include/elf/ChangeLog9
-rw-r--r--include/elf/arm.h2
-rw-r--r--include/elf/common.h4
-rw-r--r--include/elf/xtensa.h87
-rw-r--r--include/gdb/ChangeLog4
-rw-r--r--include/gdb/sim-arm.h34
-rw-r--r--include/xtensa-config.h64
-rw-r--r--include/xtensa-isa-internal.h114
-rw-r--r--include/xtensa-isa.h230
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/Makefile.am5
-rw-r--r--opcodes/Makefile.in9
-rw-r--r--opcodes/arm-dis.c4
-rw-r--r--opcodes/arm-opc.h2
-rwxr-xr-xopcodes/configure387
-rw-r--r--opcodes/configure.in1
-rw-r--r--opcodes/disassemble.c6
-rw-r--r--opcodes/xtensa-dis.c526
-rw-r--r--sim/arm/ChangeLog39
-rw-r--r--sim/arm/Makefile.in1
-rw-r--r--sim/arm/armcopro.c10
-rw-r--r--sim/arm/armdefs.h2
-rw-r--r--sim/arm/armemu.c23
-rw-r--r--sim/arm/arminit.c23
-rw-r--r--sim/arm/armos.c49
-rwxr-xr-xsim/arm/configure2
-rw-r--r--sim/arm/configure.in2
-rw-r--r--sim/arm/wrapper.c95
-rw-r--r--sim/testsuite/ChangeLog92
-rw-r--r--sim/testsuite/sim/arm/adc.cgs43
-rw-r--r--sim/testsuite/sim/arm/add.cgs43
-rw-r--r--sim/testsuite/sim/arm/allinsn.exp28
-rw-r--r--sim/testsuite/sim/arm/and.cgs43
-rw-r--r--sim/testsuite/sim/arm/b.cgs261
-rw-r--r--sim/testsuite/sim/arm/bic.cgs43
-rw-r--r--sim/testsuite/sim/arm/bl.cgs21
-rw-r--r--sim/testsuite/sim/arm/bx.cgs12
-rw-r--r--sim/testsuite/sim/arm/cmn.cgs36
-rw-r--r--sim/testsuite/sim/arm/cmp.cgs36
-rw-r--r--sim/testsuite/sim/arm/eor.cgs36
-rw-r--r--sim/testsuite/sim/arm/hello.ms91
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/iwmmxt.exp28
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tbcst.cgs65
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/testutils.inc118
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/textrm.cgs113
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tinsr.cgs65
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tmia.cgs35
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tmiaph.cgs35
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tmiaxy.cgs89
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/tmovmsk.cgs65
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wacc.cgs77
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wadd.cgs251
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/waligni.cgs43
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/walignr.cgs137
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wand.cgs41
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wandn.cgs41
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wavg2.cgs121
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wcmpeq.cgs95
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wcmpgt.cgs173
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmac.cgs121
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmadd.cgs69
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmax.cgs173
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmin.cgs173
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmov.cgs35
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wmul.cgs121
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wor.cgs41
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wpack.cgs173
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wror.cgs167
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wsad.cgs121
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wshufh.cgs35
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wsll.cgs167
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wsra.cgs167
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wsrl.cgs167
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wsub.cgs251
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wunpckeh.cgs137
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wunpckel.cgs137
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wunpckih.cgs95
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wunpckil.cgs95
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wxor.cgs41
-rw-r--r--sim/testsuite/sim/arm/iwmmxt/wzero.cgs29
-rw-r--r--sim/testsuite/sim/arm/ldm.cgs89
-rw-r--r--sim/testsuite/sim/arm/ldr.cgs192
-rw-r--r--sim/testsuite/sim/arm/ldrb.cgs192
-rw-r--r--sim/testsuite/sim/arm/ldrh.cgs132
-rw-r--r--sim/testsuite/sim/arm/ldrsb.cgs132
-rw-r--r--sim/testsuite/sim/arm/ldrsh.cgs132
-rw-r--r--sim/testsuite/sim/arm/misaligned1.ms61
-rw-r--r--sim/testsuite/sim/arm/misaligned2.ms60
-rw-r--r--sim/testsuite/sim/arm/misaligned3.ms62
-rw-r--r--sim/testsuite/sim/arm/misc.exp20
-rw-r--r--sim/testsuite/sim/arm/mla.cgs12
-rw-r--r--sim/testsuite/sim/arm/mov.cgs36
-rw-r--r--sim/testsuite/sim/arm/mrs.cgs24
-rw-r--r--sim/testsuite/sim/arm/msr.cgs24
-rw-r--r--sim/testsuite/sim/arm/mul.cgs12
-rw-r--r--sim/testsuite/sim/arm/mvn.cgs36
-rw-r--r--sim/testsuite/sim/arm/orr.cgs36
-rw-r--r--sim/testsuite/sim/arm/rsb.cgs36
-rw-r--r--sim/testsuite/sim/arm/rsc.cgs36
-rw-r--r--sim/testsuite/sim/arm/sbc.cgs36
-rw-r--r--sim/testsuite/sim/arm/smlal.cgs12
-rw-r--r--sim/testsuite/sim/arm/smull.cgs12
-rw-r--r--sim/testsuite/sim/arm/stm.cgs88
-rw-r--r--sim/testsuite/sim/arm/str.cgs192
-rw-r--r--sim/testsuite/sim/arm/strb.cgs192
-rw-r--r--sim/testsuite/sim/arm/strh.cgs132
-rw-r--r--sim/testsuite/sim/arm/sub.cgs36
-rw-r--r--sim/testsuite/sim/arm/swi.cgs12
-rw-r--r--sim/testsuite/sim/arm/swp.cgs12
-rw-r--r--sim/testsuite/sim/arm/swpb.cgs12
-rw-r--r--sim/testsuite/sim/arm/teq.cgs36
-rw-r--r--sim/testsuite/sim/arm/testutils.inc118
-rw-r--r--sim/testsuite/sim/arm/thumb/adc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/add-hd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/add-hd-rs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/add-rd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/add-sp.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/add.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/addi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/addi8.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/allthumb.exp21
-rw-r--r--sim/testsuite/sim/arm/thumb/and.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/asr.cgs14
-rw-r--r--sim/testsuite/sim/arm/thumb/b.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bcc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bcs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/beq.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bge.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bgt.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bhi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bic.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bl-hi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bl-lo.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ble.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bls.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/blt.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bmi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bne.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bpl.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bvc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bvs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bx-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/bx-rs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/cmn.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/cmp-hd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/cmp-hd-rs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/cmp-rd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/cmp.cgs14
-rw-r--r--sim/testsuite/sim/arm/thumb/eor.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/lda-pc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/lda-sp.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldmia.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldr-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldr-pc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldr-sprel.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldr.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldrb-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldrb.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldrh-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldrh.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldsb.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ldsh.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/lsl.cgs14
-rw-r--r--sim/testsuite/sim/arm/thumb/lsr.cgs14
-rw-r--r--sim/testsuite/sim/arm/thumb/mov-hd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/mov-hd-rs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/mov-rd-hs.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/mov.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/mul.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/mvn.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/neg.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/orr.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/pop-pc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/pop.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/push-lr.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/push.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/ror.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/sbc.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/stmia.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/str-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/str-sprel.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/str.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/strb-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/strb.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/strh-imm.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/strh.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/sub-sp.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/sub.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/subi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/subi8.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/swi.cgs12
-rw-r--r--sim/testsuite/sim/arm/thumb/testutils.inc91
-rw-r--r--sim/testsuite/sim/arm/thumb/tst.cgs12
-rw-r--r--sim/testsuite/sim/arm/tst.cgs36
-rw-r--r--sim/testsuite/sim/arm/umlal.cgs12
-rw-r--r--sim/testsuite/sim/arm/umull.cgs12
-rw-r--r--sim/testsuite/sim/arm/xscale/blx.cgs31
-rw-r--r--sim/testsuite/sim/arm/xscale/mia.cgs35
-rw-r--r--sim/testsuite/sim/arm/xscale/miaph.cgs35
-rw-r--r--sim/testsuite/sim/arm/xscale/miaxy.cgs89
-rw-r--r--sim/testsuite/sim/arm/xscale/mra.cgs30
-rw-r--r--sim/testsuite/sim/arm/xscale/testutils.inc118
-rw-r--r--sim/testsuite/sim/arm/xscale/xscale.exp28
364 files changed, 30949 insertions, 6385 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cec8e28..809e9f7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,145 @@
+2003-04-03 Nick Clifton <nickc@redhat.com>
+
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss
+ differently for object files and executables.
+ * peicode.h (coff_swap_scnhdr_in): Only set the s_size field
+ for object files or for executables who have not already
+ initialised the field.
+ * libpei.h (bfd_pe_executable_p): New macro. Return true if
+ the PE format bfd is an executable.
+
+2003-04-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL
+ here as it's too early to reliably determine locality.
+ (ppc_elf_gc_sweep_hook): Likewise.
+ (SYMBOL_REFERENCES_LOCAL): Expand comment.
+
+2003-04-02 Bob Wilson <bob.wilson@acm.org>
+
+ * xtensa-modules.c: Remove comment indicating that this is a
+ generated file.
+
+2003-04-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Test for NULL dynobj.
+
+2003-04-01 Bob Wilson <bob.wilson@acm.org>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-xtensa.lo.
+ (ALL_MACHINES_CFILES): Add cpu-xtensa.c.
+ (BFD32_BACKENDS): Add elf32-xtensa.lo, xtensa-isa.lo, and
+ xtensa-modules.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-xtensa.c, xtensa-isa.c, and
+ xtensa-modules.c.
+ (cpu-xtensa.lo): New target.
+ (elf32-xtensa.lo): Likewise.
+ (xtensa-isa.lo): Likewise.
+ (xtensa-modules.lo): Likewise.
+ * Makefile.in: Regenerate.
+ * archures.c (bfd_architecture): Add bfd_{arch,mach}_xtensa.
+ (bfd_archures_list): Add bfd_xtensa_arch.
+ * config.bfd: Handle xtensa-*-*.
+ * configure.in: Handle bfd_elf32_xtensa_{le,be}_vec.
+ * configure: Regenerate.
+ * reloc.c: Add BFD_RELOC_XTENSA_{RTLD,GLOB_DAT,JMP_SLOT,RELATIVE,
+ PLT,OP0,OP1,OP2,ASM_EXPAND,ASM_SIMPLIFY}.
+ * targets.c (bfd_elf32_xtensa_be_vec): Declare.
+ (bfd_elf32_xtensa_le_vec): Likewise.
+ (bfd_target_vector): Add bfd_elf32_xtensa_{be,le}_vec.
+ * cpu-xtensa.c: New file.
+ * elf32-xtensa.c: Likewise.
+ * xtensa-isa.c: Likewise.
+ * xtensa-modules.c: Likewise.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Likewise.
+
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_mach_arm_unknown): Define.
+ * bfd-in.h (bfd_arm_merge_machines, bfd_arm+update_notes,
+ bfd_arm_get_mach_from_notes): Prototype.
+ * bfd-in2.h: Regenerate.
+ * coff-arm.c (coff_arm_merge_private_bfd_data): Call
+ bfd_arm_merge_machines.
+ (coff_arm_final_link_postscript): Call bfd_arm_update_notes.
+ * coffcode.h (coff_set_arch_mach_hook): Call
+ bfd_arm_get_mach_from_notes.
+ * coffgen.c (coff_real_object_p): Revert previous delta.
+ * cpu_arm.c (arm_check_note): New function. Examine a note in a
+ .note section.
+ (bfd_arm_merge_machines): New function: Handle the merging of ARM
+ binaries compiled for different architectures..
+ (bfd_arm_update_notes): New function: Update an ARM note section.
+ (bfd_arm_get_mach_from_notes): New function: Extract a bfd machine
+ number from an ARM note section.
+ * elf32-arm.h (elf32_arm_object_p): Use
+ bfd_arm_get_mach_from_notes.
+ (elf32_arm_merge_private_bfd_data): Use bfd_arm_merge_machines.
+ (elf32_arm_final_write_processing): Use bfd_arm_update_notes.
+
+2003-04-01 Ben Elliston <bje@wasabisystems.com>
+
+ * dwarf2.c (read_attribute_value): Correct typo in comment.
+
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * dwarf2.c (concat_filename): Use bfd_malloc() and strdup()
+ instead of concat().
+ (decode_line_info): Only free filename if it is not NULL.
+ (add_line_info): Make a copy of the filename when storing it into
+ the info structure.
+
+2003-03-31 Andreas Schwab <schwab@suse.de>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * simple.c (bfd_simple_get_relocated_section_contents): Add
+ parameter symbol_table. Optionally use it instead of the symbol
+ table from the bfd. Save and restore output offsets and output
+ sections around bfd_get_relocated_section_contents. Fix a memory
+ leak.
+ (simple_save_output_info, simple_restore_output_info): New
+ functions.
+ * bfd-in2.h: Regenerate.
+ * dwarf2.c (read_abbrevs): Use
+ bfd_simple_get_relocated_section_contents instead of
+ bfd_get_section_contents.
+ (decode_line_info): Likewise.
+ (_bfd_dwarf2_find_nearest_line): Likewise. Don't call
+ find_rela_addend.
+ (find_rela_addend): Remove.
+ * elfxx-ia64.c (elfNN_ia64_reloc): Weaken sanity check for
+ debugging sections.
+ (elfNN_ia64_hash_table_create): Create the hash table with malloc,
+ not bfd_zalloc.
+
+2003-03-31 David Heine <dlheine@suif.stanford.edu>
+
+ * aoutx.h (aout_link_hash_table_create): Use bfd_malloc instead of
+ bfd_alloc.
+ * dwarf2.c (concat_filename): Always allocate space for the
+ returned filename.
+ (decode_line_info): Free the allocated filename returned by
+ concat_filename.
+ * elf-eh-frame.c (bfd_elf_write_section_eh_frame): Fix memory leaks.
+ * elf.c (copy_private_bfd_data): Likewise.
+ (_bfd_elf_slurp_version_tables): Fix bug freeing contents pointer.
+ * elflink.h (elf_link_sort_relocs): Fix memory leak.
+ * format.c (bfd_check_format_matches): Likewise.
+ * linker.c (bfd_generic_final_link): Likewise.
+ * opncls.c (find_separate_debug_info): Likewise.
+ * simple.c (bfd_simple_get_relocated_section_contents): Likewise.
+
+2003-03-28 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Correctly combine
+ visibilities.
+
+2003-03-27 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset
+ to -1 before recomputing got offsets.
+
2003-03-26 Andreas Schwab <schwab@suse.de>
* elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 401568f..ee04261 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -101,6 +101,7 @@ ALL_MACHINES = \
cpu-we32k.lo \
cpu-w65.lo \
cpu-xstormy16.lo \
+ cpu-xtensa.lo \
cpu-z8k.lo
ALL_MACHINES_CFILES = \
@@ -155,6 +156,7 @@ ALL_MACHINES_CFILES = \
cpu-we32k.c \
cpu-w65.c \
cpu-xstormy16.c \
+ cpu-xtensa.c \
cpu-z8k.c
# The .o files needed by all of the 32 bit vectors that are configured into
@@ -249,6 +251,7 @@ BFD32_BACKENDS = \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
+ elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elf-strtab.lo \
@@ -317,7 +320,9 @@ BFD32_BACKENDS = \
vms-misc.lo \
vms-tir.lo \
xcofflink.lo \
- xsym.lo
+ xsym.lo \
+ xtensa-isa.lo \
+ xtensa-modules.lo
BFD32_BACKENDS_CFILES = \
aout-adobe.c \
@@ -408,6 +413,7 @@ BFD32_BACKENDS_CFILES = \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
+ elf32-xtensa.c \
elf32.c \
elflink.c \
elf-strtab.c \
@@ -475,7 +481,9 @@ BFD32_BACKENDS_CFILES = \
vms-misc.c \
vms-tir.c \
xcofflink.c \
- xsym.c
+ xsym.c \
+ xtensa-isa.c \
+ xtensa-modules.c
# The .o files needed by all of the 64 bit vectors that are configured into
# target_vector in targets.c if configured with --enable-targets=all
@@ -957,6 +965,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
+cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
@@ -1286,6 +1295,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
+elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h
elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
@@ -1490,6 +1502,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
+xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index a05b342..3de6121 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -226,6 +226,7 @@ ALL_MACHINES = \
cpu-we32k.lo \
cpu-w65.lo \
cpu-xstormy16.lo \
+ cpu-xtensa.lo \
cpu-z8k.lo
@@ -281,6 +282,7 @@ ALL_MACHINES_CFILES = \
cpu-we32k.c \
cpu-w65.c \
cpu-xstormy16.c \
+ cpu-xtensa.c \
cpu-z8k.c
@@ -376,6 +378,7 @@ BFD32_BACKENDS = \
elf32-v850.lo \
elf32-vax.lo \
elf32-xstormy16.lo \
+ elf32-xtensa.lo \
elf32.lo \
elflink.lo \
elf-strtab.lo \
@@ -444,7 +447,9 @@ BFD32_BACKENDS = \
vms-misc.lo \
vms-tir.lo \
xcofflink.lo \
- xsym.lo
+ xsym.lo \
+ xtensa-isa.lo \
+ xtensa-modules.lo
BFD32_BACKENDS_CFILES = \
@@ -536,6 +541,7 @@ BFD32_BACKENDS_CFILES = \
elf32-v850.c \
elf32-vax.c \
elf32-xstormy16.c \
+ elf32-xtensa.c \
elf32.c \
elflink.c \
elf-strtab.c \
@@ -603,7 +609,9 @@ BFD32_BACKENDS_CFILES = \
vms-misc.c \
vms-tir.c \
xcofflink.c \
- xsym.c
+ xsym.c \
+ xtensa-isa.c \
+ xtensa-modules.c
# The .o files needed by all of the 64 bit vectors that are configured into
@@ -799,7 +807,7 @@ configure.in version.h
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
@@ -1490,6 +1498,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
+cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
@@ -1819,6 +1828,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
+elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h
elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
@@ -2023,6 +2035,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
libxcoff.h
xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h
+xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
+xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/xtensa-isa-internal.h
aix5ppc-core.lo: aix5ppc-core.c
aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 998bca7..7f02d13 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1,6 +1,6 @@
/* BFD semi-generic back-end for a.out binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002
+ 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -105,9 +105,7 @@ DESCRIPTION
in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
to use the
@file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your
- configuration is selected.
-
-*/
+ configuration is selected. */
/* Some assumptions:
* Any BFD with D_PAGED set is ZMAGIC, and vice versa.
@@ -157,9 +155,8 @@ DESCRIPTION
The standard records contain only an
address, a symbol index, and a type field. The extended records
(used on 29ks and sparcs) also have a full integer for an
- addend.
+ addend. */
-*/
#ifndef CTOR_TABLE_RELOC_HOWTO
#define CTOR_TABLE_RELOC_IDX 2
#define CTOR_TABLE_RELOC_HOWTO(BFD) \
@@ -230,7 +227,8 @@ reloc_howto_type howto_table_ext[] =
/* Convert standard reloc records to "arelent" format (incl byte swap). */
-reloc_howto_type howto_table_std[] = {
+reloc_howto_type howto_table_std[] =
+{
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */
HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
@@ -3067,9 +3065,10 @@ NAME(aout,link_hash_table_create) (abfd)
struct aout_link_hash_table *ret;
bfd_size_type amt = sizeof (struct aout_link_hash_table);
- ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt);
+ ret = (struct aout_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return (struct bfd_link_hash_table *) NULL;
+
if (! NAME(aout,link_hash_table_init) (ret, abfd,
NAME(aout,link_hash_newfunc)))
{
@@ -3906,10 +3905,8 @@ NAME(aout,final_link) (abfd, info, callback)
for (o = abfd->sections; o != NULL; o = o->next)
{
for (p = o->link_order_head; p != NULL; p = p->next)
- {
- if (p->type == bfd_indirect_link_order)
- p->u.indirect.section->linker_mark = TRUE;
- }
+ if (p->type == bfd_indirect_link_order)
+ p->u.indirect.section->linker_mark = TRUE;
}
have_link_order_relocs = FALSE;
diff --git a/bfd/archures.c b/bfd/archures.c
index 18ebb83..9337fb1 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -224,6 +224,7 @@ DESCRIPTION
.#define bfd_mach_alpha_ev5 0x20
.#define bfd_mach_alpha_ev6 0x30
. bfd_arch_arm, {* Advanced Risc Machines ARM. *}
+.#define bfd_mach_arm_unknown 0
.#define bfd_mach_arm_2 1
.#define bfd_mach_arm_2a 2
.#define bfd_mach_arm_3 3
@@ -307,6 +308,8 @@ DESCRIPTION
.#define bfd_mach_msp44 44
.#define bfd_mach_msp15 15
.#define bfd_mach_msp16 16
+. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
+.#define bfd_mach_xtensa 1
. bfd_arch_last
. };
*/
@@ -398,6 +401,7 @@ extern const bfd_arch_info_type bfd_vax_arch;
extern const bfd_arch_info_type bfd_we32k_arch;
extern const bfd_arch_info_type bfd_w65_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
+extern const bfd_arch_info_type bfd_xtensa_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
static const bfd_arch_info_type * const bfd_archures_list[] =
@@ -455,6 +459,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_w65_arch,
&bfd_we32k_arch,
&bfd_xstormy16_arch,
+ &bfd_xtensa_arch,
&bfd_z8k_arch,
#endif
0
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 917b46f..c39bfedd 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -835,6 +835,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
PARAMS ((bfd *, struct bfd_link_info *));
+/* ARM Note section processing. */
+extern bfd_boolean bfd_arm_merge_machines
+ PARAMS ((bfd *, bfd *));
+
+extern bfd_boolean bfd_arm_update_notes
+ PARAMS ((bfd *, const char *));
+
+extern unsigned int bfd_arm_get_mach_from_notes
+ PARAMS ((bfd *, const char *));
+
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 8960f66..a5ff0c0 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -842,6 +842,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
PARAMS ((bfd *, struct bfd_link_info *));
+/* ARM Note section processing. */
+extern bfd_boolean bfd_arm_merge_machines
+ PARAMS ((bfd *, bfd *));
+
+extern bfd_boolean bfd_arm_update_notes
+ PARAMS ((bfd *, const char *));
+
+extern unsigned int bfd_arm_get_mach_from_notes
+ PARAMS ((bfd *, const char *));
+
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
PARAMS ((struct sec *, int));
@@ -1680,6 +1690,7 @@ enum bfd_architecture
#define bfd_mach_alpha_ev5 0x20
#define bfd_mach_alpha_ev6 0x30
bfd_arch_arm, /* Advanced Risc Machines ARM. */
+#define bfd_mach_arm_unknown 0
#define bfd_mach_arm_2 1
#define bfd_mach_arm_2a 2
#define bfd_mach_arm_3 3
@@ -1763,6 +1774,8 @@ enum bfd_architecture
#define bfd_mach_msp44 44
#define bfd_mach_msp15 15
#define bfd_mach_msp16 16
+ bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
+#define bfd_mach_xtensa 1
bfd_arch_last
};
@@ -3426,6 +3439,38 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
BFD_RELOC_IQ2000_OFFSET_16,
BFD_RELOC_IQ2000_OFFSET_21,
BFD_RELOC_IQ2000_UHI16,
+
+/* Special Xtensa relocation used only by PLT entries in ELF shared
+objects to indicate that the runtime linker should set the value
+to one of its own internal functions or data structures. */
+ BFD_RELOC_XTENSA_RTLD,
+
+/* Xtensa relocations for ELF shared objects. */
+ BFD_RELOC_XTENSA_GLOB_DAT,
+ BFD_RELOC_XTENSA_JMP_SLOT,
+ BFD_RELOC_XTENSA_RELATIVE,
+
+/* Xtensa relocation used in ELF object files for symbols that may require
+PLT entries. Otherwise, this is just a generic 32-bit relocation. */
+ BFD_RELOC_XTENSA_PLT,
+
+/* Generic Xtensa relocations. Only the operand number is encoded
+in the relocation. The details are determined by extracting the
+instruction opcode. */
+ BFD_RELOC_XTENSA_OP0,
+ BFD_RELOC_XTENSA_OP1,
+ BFD_RELOC_XTENSA_OP2,
+
+/* Xtensa relocation to mark that the assembler expanded the
+instructions from an original target. The expansion size is
+encoded in the reloc size. */
+ BFD_RELOC_XTENSA_ASM_EXPAND,
+
+/* Xtensa relocation to mark that the linker should simplify
+assembler-expanded instructions. This is commonly used
+internally by the linker after analysis of a
+BFD_RELOC_XTENSA_ASM_EXPAND. */
+ BFD_RELOC_XTENSA_ASM_SIMPLIFY,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
@@ -4385,7 +4430,7 @@ bfd_link_split_section PARAMS ((bfd *abfd, asection *sec));
/* Extracted from simple.c. */
bfd_byte *
-bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf));
+bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table));
#ifdef __cplusplus
}
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 2401504..f089a6c 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -2240,25 +2240,6 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
if (ibfd == obfd)
return TRUE;
- if (bfd_get_mach (obfd) && bfd_get_mach (obfd) != bfd_get_mach (ibfd))
- {
- /* For now, allow an output file type of 'xscale' if the
- input file type is 'iWMMXt'. This means that we will
- not have to build an entire iWMMXt enabled set of libraries
- just to test a iWMMXt enabled binary. Change the output
- type to iWMMXt though. Similarly allow 'xscale' binaries
- to be linked into a 'iWMMXt' output binary. */
- if ( bfd_get_mach (obfd) == bfd_mach_arm_XScale
- && bfd_get_mach (ibfd) == bfd_mach_arm_iWMMXt)
- bfd_set_arch_mach (obfd, bfd_get_arch (obfd), bfd_mach_arm_iWMMXt);
- else if ( bfd_get_mach (ibfd) != bfd_mach_arm_XScale
- || bfd_get_mach (obfd) != bfd_mach_arm_iWMMXt)
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- }
-
/* If the two formats are different we cannot merge anything.
This is not an error, since it is permissable to change the
input and output formats. */
@@ -2266,7 +2247,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
|| obfd->xvec->flavour != bfd_target_coff_flavour)
return TRUE;
- /* Verify that the APCS is the same for the two BFDs */
+ /* Determine what should happen if the input ARM architecture
+ does not match the output ARM architecture. */
+ if (! bfd_arm_merge_machines (ibfd, obfd))
+ return FALSE;
+
+ /* Verify that the APCS is the same for the two BFDs. */
if (APCS_SET (ibfd))
{
if (APCS_SET (obfd))
@@ -2603,45 +2589,7 @@ coff_arm_final_link_postscript (abfd, pfinfo)
globals->bfd_of_glue_owner->output_has_begun = TRUE;
}
- {
- asection * arm_arch_section;
-
- /* Look for a .note section. If one is present check
- the machine number encoded in it, and set it to the current
- machine number if it is different. This allows XScale and
- iWMMXt binaries to be merged and the resulting output to be set
- to iWMMXt, even if the first input file had an XScale .note. */
-
- arm_arch_section = bfd_get_section_by_name (abfd, ".note");
-
- if (arm_arch_section != NULL)
- {
- char buffer [4];
-
- if (bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- {
- unsigned long arm_mach;
-
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- arm_mach = bfd_get_32 (abfd, buffer);
-
- if (arm_mach != bfd_get_mach (abfd))
- {
- bfd_put_32 (abfd, bfd_get_mach (abfd), buffer);
-
- if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("warning: unable to update contents of .note section in %s"),
- bfd_get_filename (abfd));
- }
- }
- }
- }
-
- return TRUE;
+ return bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
}
#include "coffcode.h"
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index da8121f..5c6c286 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1883,43 +1883,26 @@ coff_set_arch_mach_hook (abfd, filehdr)
case ARMPEMAGIC:
case THUMBPEMAGIC:
arch = bfd_arch_arm;
- switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
+ machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
+ if (machine == bfd_mach_arm_unknown)
{
- case F_ARM_2: machine = bfd_mach_arm_2; break;
- case F_ARM_2a: machine = bfd_mach_arm_2a; break;
- case F_ARM_3: machine = bfd_mach_arm_3; break;
- default:
- case F_ARM_3M: machine = bfd_mach_arm_3M; break;
- case F_ARM_4: machine = bfd_mach_arm_4; break;
- case F_ARM_4T: machine = bfd_mach_arm_4T; break;
- /* The COFF header does not have enough bits available
- to cover all the different ARM architectures. So
- we interpret F_ARM_5, the highest flag value to mean
- "the highest ARM architecture known to BFD" which is
- currently the XScale. */
- case F_ARM_5: machine = bfd_mach_arm_XScale; break;
+ switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK)
+ {
+ case F_ARM_2: machine = bfd_mach_arm_2; break;
+ case F_ARM_2a: machine = bfd_mach_arm_2a; break;
+ case F_ARM_3: machine = bfd_mach_arm_3; break;
+ default:
+ case F_ARM_3M: machine = bfd_mach_arm_3M; break;
+ case F_ARM_4: machine = bfd_mach_arm_4; break;
+ case F_ARM_4T: machine = bfd_mach_arm_4T; break;
+ /* The COFF header does not have enough bits available
+ to cover all the different ARM architectures. So
+ we interpret F_ARM_5, the highest flag value to mean
+ "the highest ARM architecture known to BFD" which is
+ currently the XScale. */
+ case F_ARM_5: machine = bfd_mach_arm_XScale; break;
+ }
}
-
- {
- asection * arm_arch_section;
-
- arm_arch_section = bfd_get_section_by_name (abfd, ".note");
-
- if (arm_arch_section)
- {
- bfd_byte buffer [4];
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("%s: warning: unable to retrieve .note section from %s"),
- bfd_get_filename (abfd));
-
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- machine = bfd_get_32 (abfd, buffer);
- }
- }
break;
#endif
#ifdef MC68MAGIC
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index a3e3eec..fcb00fc 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -241,9 +241,6 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
}
}
- bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f);
- /* make_abs_section (abfd); */
-
return abfd->xvec;
fail:
diff --git a/bfd/config.bfd b/bfd/config.bfd
index c678496..d034ce8 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -58,6 +58,7 @@ thumb*) targ_archs=bfd_arm_arch ;;
v850*) targ_archs=bfd_v850_arch ;;
x86_64) targ_archs=bfd_i386_arch ;;
xscale*) targ_archs=bfd_arm_arch ;;
+xtensa*) targ_archs=bfd_xtensa_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -1214,6 +1215,11 @@ case "${targ}" in
targ_defvec=bfd_elf32_xstormy16_vec
;;
+ xtensa-*-*)
+ targ_defvec=bfd_elf32_xtensa_le_vec
+ targ_selvecs=bfd_elf32_xtensa_be_vec
+ ;;
+
z8k*-*-*)
targ_defvec=z8kcoff_vec
targ_underscore=yes
diff --git a/bfd/configure b/bfd/configure
index 6616dc0..ad1475d 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -6155,6 +6155,8 @@ do
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
@@ -6372,10 +6374,10 @@ case ${host64}-${target64}-${want64} in
if test -n "$GCC" ; then
bad_64bit_gcc=no;
echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
-echo "configure:6376: checking for gcc version with buggy 64-bit support" >&5
+echo "configure:6378: checking for gcc version with buggy 64-bit support" >&5
# Add more tests for gcc versions with non-working 64-bit support here.
cat > conftest.$ac_ext <<EOF
-#line 6379 "configure"
+#line 6381 "configure"
#include "confdefs.h"
:__GNUC__:__GNUC_MINOR__:__i386__:
EOF
@@ -6421,17 +6423,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:6425: checking for $ac_hdr" >&5
+echo "configure:6427: 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 6430 "configure"
+#line 6432 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6437: \"$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*
@@ -6460,12 +6462,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6464: checking for $ac_func" >&5
+echo "configure:6466: 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 6469 "configure"
+#line 6471 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6488,7 +6490,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6494: \"$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
@@ -6513,7 +6515,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6517: checking for working mmap" >&5
+echo "configure:6519: 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
@@ -6521,7 +6523,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 6525 "configure"
+#line 6527 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6661,7 +6663,7 @@ main()
}
EOF
-if { (eval echo configure:6665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6667: \"$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
@@ -6686,12 +6688,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6690: checking for $ac_func" >&5
+echo "configure:6692: 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 6695 "configure"
+#line 6697 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6714,7 +6716,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
diff --git a/bfd/configure.in b/bfd/configure.in
index ddb5e8b..347ad97 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -639,6 +639,8 @@ do
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;;
bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+ bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index eb3011d..66c3a46 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -1,5 +1,5 @@
/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -21,11 +21,14 @@
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "libiberty.h"
static const bfd_arch_info_type * compatible
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
static bfd_boolean scan
PARAMS ((const struct bfd_arch_info *, const char *));
+static bfd_boolean arm_check_note
+ PARAMS ((bfd *, char *, bfd_size_type, const char *, char **));
/* This routine is provided two arch_infos and works out which ARM
machine which would be compatible with both and returns a pointer
@@ -149,3 +152,276 @@ static const bfd_arch_info_type arch_info_struct[] =
const bfd_arch_info_type bfd_arm_arch =
N (0, "arm", TRUE, & arch_info_struct[0]);
+
+/* Support functions used by both the COFF and ELF versions of the ARM port. */
+
+/* Handle the mergeing of the 'machine' settings of input file IBFD
+ and an output file OBFD. These values actually represent the
+ different possible ARM architecture variants.
+ Returns TRUE if they were merged successfully or FALSE otherwise. */
+
+bfd_boolean
+bfd_arm_merge_machines (ibfd, obfd)
+ bfd * ibfd;
+ bfd * obfd;
+{
+ unsigned int in = bfd_get_mach (ibfd);
+ unsigned int out = bfd_get_mach (obfd);
+
+ /* If the output architecture is unknown, we now have a value to set. */
+ if (out == bfd_mach_arm_unknown)
+ bfd_set_arch_mach (obfd, bfd_arch_arm, in);
+
+ /* If the input architecure is unknown,
+ then so must be the output architecture. */
+ else if (in == bfd_mach_arm_unknown)
+ /* FIXME: We ought to have some way to
+ override this on the command line. */
+ bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown);
+
+ /* If they are the same then nothing needs to be done. */
+ else if (out == in)
+ ;
+
+ /* Otherwise the general principle that a earlier architecture can be
+ linked with a later architecure to produce a binary that will execute
+ on the later architecture.
+
+ We fail however if we attempt to link a Cirrus EP9312 binary with an
+ Intel XScale binary, since these architecture have co-processors which
+ will not both be present on the same physical hardware. */
+ else if (in == bfd_mach_arm_ep9312
+ && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
+ {
+ _bfd_error_handler (_("\
+ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+ else if (out == bfd_mach_arm_ep9312
+ && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
+ {
+ _bfd_error_handler (_("\
+ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
+ bfd_archive_filename (obfd),
+ bfd_get_filename (ibfd));
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+ else if (in > out)
+ bfd_set_arch_mach (obfd, bfd_arch_arm, in);
+ /* else
+ Nothing to do. */
+
+ return TRUE;
+}
+
+typedef struct
+{
+ unsigned char namesz[4]; /* Size of entry's owner string. */
+ unsigned char descsz[4]; /* Size of the note descriptor. */
+ unsigned char type[4]; /* Interpretation of the descriptor. */
+ char name[1]; /* Start of the name+desc data. */
+} arm_Note;
+
+static bfd_boolean
+arm_check_note (abfd, buffer, buffer_size, expected_name, description_return)
+ bfd * abfd;
+ char * buffer;
+ bfd_size_type buffer_size;
+ const char * expected_name;
+ char ** description_return;
+{
+ unsigned long namesz;
+ unsigned long descsz;
+ unsigned long type;
+ char * descr;
+
+ if (buffer_size < offsetof (arm_Note, name))
+ return FALSE;
+
+ /* We have to extract the values this way to allow for a
+ host whose endian-ness is different from the target. */
+ namesz = bfd_get_32 (abfd, buffer);
+ descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz));
+ type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type));
+ descr = buffer + offsetof (arm_Note, name);
+
+ /* Check for buffer overflow. */
+ if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
+ return FALSE;
+
+ if (expected_name == NULL)
+ {
+ if (namesz != 0)
+ return FALSE;
+ }
+ else
+ {
+ if (namesz != (strlen (expected_name) + 1 + 3) & ~3)
+ return FALSE;
+
+ if (strcmp (descr, expected_name) != 0)
+ return FALSE;
+
+ descr += (namesz + 3) & ~3;
+ }
+
+ /* FIXME: We should probably check the type as well. */
+
+ if (description_return != NULL)
+ * description_return = descr;
+
+ return TRUE;
+}
+
+#define NOTE_ARCH_STRING "arch: "
+
+bfd_boolean
+bfd_arm_update_notes (abfd, note_section)
+ bfd * abfd;
+ const char * note_section;
+{
+ asection * arm_arch_section;
+ bfd_size_type buffer_size;
+ char * buffer;
+ char * arch_string;
+ char * expected;
+
+ /* Look for a note section. If one is present check the architecture
+ string encoded in it, and set it to the current architecture if it is
+ different. */
+ arm_arch_section = bfd_get_section_by_name (abfd, note_section);
+
+ if (arm_arch_section == NULL)
+ return TRUE;
+
+ buffer_size = arm_arch_section->_raw_size;
+ if (buffer_size == 0)
+ return FALSE;
+
+ buffer = bfd_malloc (buffer_size);
+ if (buffer == NULL)
+ return FALSE;
+
+ if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ goto FAIL;
+
+ /* Parse the note. */
+ if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
+ goto FAIL;
+
+ /* Check the architecture in the note against the architecture of the bfd. */
+ switch (bfd_get_mach (abfd))
+ {
+ default:
+ case bfd_mach_arm_unknown: expected = "unknown"; break;
+ case bfd_mach_arm_2: expected = "armv2"; break;
+ case bfd_mach_arm_2a: expected = "armv2a"; break;
+ case bfd_mach_arm_3: expected = "armv3"; break;
+ case bfd_mach_arm_3M: expected = "armv3M"; break;
+ case bfd_mach_arm_4: expected = "armv4"; break;
+ case bfd_mach_arm_4T: expected = "armv4t"; break;
+ case bfd_mach_arm_5: expected = "armv5"; break;
+ case bfd_mach_arm_5T: expected = "armv5t"; break;
+ case bfd_mach_arm_5TE: expected = "armv5te"; break;
+ case bfd_mach_arm_XScale: expected = "XScale"; break;
+ case bfd_mach_arm_ep9312: expected = "ep9312"; break;
+ case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break;
+ }
+
+ if (strcmp (arch_string, expected) != 0)
+ {
+ strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected);
+
+ if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ {
+ (*_bfd_error_handler)
+ (_("warning: unable to update contents of %s section in %s"),
+ note_section, bfd_get_filename (abfd));
+ goto FAIL;
+ }
+ }
+
+ free (buffer);
+ return TRUE;
+
+ FAIL:
+ free (buffer);
+ return FALSE;
+}
+
+
+static struct
+{
+ const char * string;
+ unsigned int mach;
+}
+architectures[] =
+{
+ { "armv2", bfd_mach_arm_2 },
+ { "armv2a", bfd_mach_arm_2a },
+ { "armv3", bfd_mach_arm_3 },
+ { "armv3M", bfd_mach_arm_3M },
+ { "armv4", bfd_mach_arm_4 },
+ { "armv4t", bfd_mach_arm_4T },
+ { "armv5", bfd_mach_arm_5 },
+ { "armv5t", bfd_mach_arm_5T },
+ { "armv5te", bfd_mach_arm_5TE },
+ { "XScale", bfd_mach_arm_XScale },
+ { "ep9312", bfd_mach_arm_ep9312 },
+ { "iWMMXt", bfd_mach_arm_iWMMXt }
+};
+
+/* Extract the machine number stored in a note section. */
+unsigned int
+bfd_arm_get_mach_from_notes (abfd, note_section)
+ bfd * abfd;
+ const char * note_section;
+{
+ asection * arm_arch_section;
+ bfd_size_type buffer_size;
+ char * buffer;
+ char * arch_string;
+ int i;
+
+ /* Look for a note section. If one is present check the architecture
+ string encoded in it, and set it to the current architecture if it is
+ different. */
+ arm_arch_section = bfd_get_section_by_name (abfd, note_section);
+
+ if (arm_arch_section == NULL)
+ return bfd_mach_arm_unknown;
+
+ buffer_size = arm_arch_section->_raw_size;
+ if (buffer_size == 0)
+ return bfd_mach_arm_unknown;
+
+ buffer = bfd_malloc (buffer_size);
+ if (buffer == NULL)
+ return bfd_mach_arm_unknown;
+
+ if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
+ (file_ptr) 0, buffer_size))
+ goto FAIL;
+
+ /* Parse the note. */
+ if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
+ goto FAIL;
+
+ /* Interpret the architecture string. */
+ for (i = ARRAY_SIZE (architectures); i--;)
+ if (strcmp (arch_string, architectures[i].string) == 0)
+ {
+ free (buffer);
+ return architectures[i].mach;
+ }
+
+ FAIL:
+ free (buffer);
+ return bfd_mach_arm_unknown;
+}
diff --git a/bfd/cpu-xtensa.c b/bfd/cpu-xtensa.c
new file mode 100644
index 0000000..fbfff64
--- /dev/null
+++ b/bfd/cpu-xtensa.c
@@ -0,0 +1,38 @@
+/* BFD support for the Xtensa processor.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type bfd_xtensa_arch =
+{
+ 32, /* Bits per word. */
+ 32, /* Bits per address. */
+ 8, /* Bits per byte. */
+ bfd_arch_xtensa, /* Architecture. */
+ bfd_mach_xtensa, /* Machine. */
+ "xtensa", /* Architecture name. */
+ "xtensa", /* Printable name. */
+ 4, /* Section align power. */
+ TRUE, /* The default? */
+ bfd_default_compatible, /* Architecture comparison fn. */
+ bfd_default_scan, /* String to architecture convert fn. */
+ NULL /* Next in list. */
+};
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index e7077a1..8a4cc64 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1,5 +1,5 @@
/* DWARF 2 support.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
@@ -245,8 +245,6 @@ static bfd_boolean lookup_address_in_line_info_table
static bfd_boolean lookup_address_in_function_table
PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **));
static bfd_boolean scan_unit_for_functions PARAMS ((struct comp_unit *));
-static bfd_vma find_rela_addend
- PARAMS ((bfd *, asection *, bfd_size_type, asymbol**));
static struct comp_unit *parse_comp_unit
PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int));
static bfd_boolean comp_unit_contains_address
@@ -546,13 +544,11 @@ read_abbrevs (abfd, offset, stash)
}
stash->dwarf_abbrev_size = msec->_raw_size;
- stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size);
+ stash->dwarf_abbrev_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
+ stash->syms);
if (! stash->dwarf_abbrev_buffer)
return 0;
-
- if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer,
- (bfd_vma) 0, msec->_raw_size))
- return 0;
}
if (offset >= stash->dwarf_abbrev_size)
@@ -654,7 +650,7 @@ read_attribute_value (attr, form, unit, info_ptr)
switch (form)
{
case DW_FORM_addr:
- /* FIXME: DWARF3 draft sais DW_FORM_ref_addr is offset_size. */
+ /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */
case DW_FORM_ref_addr:
DW_ADDR (attr) = read_address (unit, info_ptr);
info_ptr += unit->addr_size;
@@ -821,11 +817,11 @@ struct funcinfo
bfd_vma high;
};
-/* add_line_info: adds a new entry to the line_info list in the
- line_info_table, ensuring that the list is sorted. Note that the
- line_info list is sorted from highest to lowest VMA (with possible
- duplicates); that is, line_info->prev_line always accesses an equal
- or smaller VMA. */
+/* Adds a new entry to the line_info list in the line_info_table, ensuring
+ that the list is sorted. Note that the line_info list is sorted from
+ highest to lowest VMA (with possible duplicates); that is,
+ line_info->prev_line always accesses an equal or smaller VMA. */
+
static void
add_line_info (table, address, filename, line, column, end_sequence)
struct line_info_table* table;
@@ -905,12 +901,25 @@ add_line_info (table, address, filename, line, column, end_sequence)
/* Set member data of 'info'. */
info->address = address;
- info->filename = filename;
info->line = line;
info->column = column;
info->end_sequence = end_sequence;
+
+ amt = strlen (filename);
+ if (amt)
+ {
+ info->filename = bfd_alloc (table->abfd, amt + 1);
+ if (info->filename)
+ strcpy (info->filename, filename);
+ }
+ else
+ info->filename = NULL;
}
+/* Extract a fully qualified filename from a line info table.
+ The returned string has been malloc'ed and it is the caller's
+ responsibility to free it. */
+
static char *
concat_filename (table, file)
struct line_info_table* table;
@@ -922,25 +931,32 @@ concat_filename (table, file)
{
(*_bfd_error_handler)
(_("Dwarf Error: mangled line number section (bad file number)."));
- return "<unknown>";
+ return strdup ("<unknown>");
}
filename = table->files[file - 1].name;
- if (IS_ABSOLUTE_PATH(filename))
- return filename;
- else
+
+ if (! IS_ABSOLUTE_PATH (filename))
{
char* dirname = (table->files[file - 1].dir
? table->dirs[table->files[file - 1].dir - 1]
: table->comp_dir);
- /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The
- best we can do is return the filename part. */
- if (dirname == NULL)
- return filename;
- else
- return (char*) concat (dirname, "/", filename, NULL);
+ /* Not all tools set DW_AT_comp_dir, so dirname may be unknown.
+ The best we can do is return the filename part. */
+ if (dirname != NULL)
+ {
+ unsigned int len = strlen (dirname) + strlen (filename) + 2;
+ char * name;
+
+ name = bfd_malloc (len);
+ if (name)
+ sprintf (name, "%s/%s", dirname, filename);
+ return name;
+ }
}
+
+ return strdup (filename);
}
static void
@@ -1019,21 +1035,15 @@ decode_line_info (unit, stash)
}
stash->dwarf_line_size = msec->_raw_size;
- stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size);
+ stash->dwarf_line_buffer
+ = bfd_simple_get_relocated_section_contents (abfd, msec, NULL,
+ stash->syms);
if (! stash->dwarf_line_buffer)
return 0;
-
- if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer,
- (bfd_vma) 0, msec->_raw_size))
- return 0;
-
- /* FIXME: We ought to apply the relocs against this section before
- we process it... */
}
- /* Since we are using un-relocated data, it is possible to get a bad value
- for the line_offset. Validate it here so that we won't get a segfault
- below. */
+ /* It is possible to get a bad value for the line_offset. Validate
+ it here so that we won't get a segfault below. */
if (unit->line_offset >= stash->dwarf_line_size)
{
(*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."),
@@ -1272,6 +1282,8 @@ decode_line_info (unit, stash)
based, the references are 1 based. */
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
+ if (filename)
+ free (filename);
filename = concat_filename (table, file);
break;
}
@@ -1296,6 +1308,7 @@ decode_line_info (unit, stash)
default:
{
int i;
+
/* Unknown standard opcode, ignore it. */
for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
{
@@ -1305,6 +1318,9 @@ decode_line_info (unit, stash)
}
}
}
+
+ if (filename)
+ free (filename);
}
return table;
@@ -1521,60 +1537,6 @@ scan_unit_for_functions (unit)
return TRUE;
}
-/* Look for a RELA relocation to be applied on OFFSET of section SEC,
- and return the addend if such a relocation is found. Since this is
- only used to find relocations referring to the .debug_abbrev
- section, we make sure the relocation refers to this section, but
- this is not strictly necessary, and it can probably be safely
- removed if needed. However, it is important to note that this
- function only returns the addend, it doesn't serve the purpose of
- applying a generic relocation.
-
- If no suitable relocation is found, or if it is not a real RELA
- relocation, this function returns 0. */
-
-static bfd_vma
-find_rela_addend (abfd, sec, offset, syms)
- bfd* abfd;
- asection* sec;
- bfd_size_type offset;
- asymbol** syms;
-{
- long reloc_size = bfd_get_reloc_upper_bound (abfd, sec);
- arelent **relocs = NULL;
- long reloc_count, relc;
-
- if (reloc_size <= 0)
- return 0;
-
- relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
- if (relocs == NULL)
- return 0;
-
- reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, syms);
-
- if (reloc_count <= 0)
- {
- free (relocs);
- return 0;
- }
-
- for (relc = 0; relc < reloc_count; relc++)
- if (relocs[relc]->address == offset
- && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM
- && strcmp ((*relocs[relc]->sym_ptr_ptr)->name,
- ".debug_abbrev") == 0)
- {
- bfd_vma addend = (relocs[relc]->howto->partial_inplace
- ? 0 : relocs[relc]->addend);
- free (relocs);
- return addend;
- }
-
- free (relocs);
- return 0;
-}
-
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
includes the compilation unit header that proceeds the DIE's, but
does not include the length field that preceeds each compilation
@@ -1602,7 +1564,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
char *info_ptr = stash->info_ptr;
char *end_ptr = info_ptr + unit_length;
bfd_size_type amt;
- bfd_size_type off;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
@@ -1611,12 +1572,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size)
abbrev_offset = read_4_bytes (abfd, info_ptr);
else
abbrev_offset = read_8_bytes (abfd, info_ptr);
- /* The abbrev offset is generally a relocation pointing to
- .debug_abbrev+offset. On RELA targets, we have to find the
- relocation and extract the addend to obtain the actual
- abbrev_offset, so do it here. */
- off = info_ptr - stash->sec_info_ptr;
- abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms);
info_ptr += offset_size;
addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
@@ -1939,8 +1894,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
start = stash->info_ptr_end - stash->info_ptr;
- if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start,
- (bfd_vma) 0, size))
+ if ((bfd_simple_get_relocated_section_contents
+ (abfd, msec, stash->info_ptr + start, symbols)) == NULL)
continue;
stash->info_ptr_end = stash->info_ptr + start + size;
@@ -1953,21 +1908,6 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
stash->syms = symbols;
}
- /* FIXME: There is a problem with the contents of the
- .debug_info section. The 'low' and 'high' addresses of the
- comp_units are computed by relocs against symbols in the
- .text segment. We need these addresses in order to determine
- the nearest line number, and so we have to resolve the
- relocs. There is a similar problem when the .debug_line
- section is processed as well (e.g., there may be relocs
- against the operand of the DW_LNE_set_address operator).
-
- Unfortunately getting hold of the reloc information is hard...
-
- For now, this means that disassembling object files (as
- opposed to fully executables) does not always work as well as
- we would like. */
-
/* A null info_ptr indicates that there is no dwarf2 info
(or that an error occured while setting up the stash). */
if (! stash->info_ptr)
@@ -2034,10 +1974,10 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
{
if (comp_unit_contains_address (each, addr))
return comp_unit_find_nearest_line (each, addr,
- filename_ptr,
- functionname_ptr,
- linenumber_ptr,
- stash);
+ filename_ptr,
+ functionname_ptr,
+ linenumber_ptr,
+ stash);
}
else
{
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 7764074..7d0b52b 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -2,21 +2,21 @@
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -39,7 +39,7 @@ static void write_value
static int cie_compare
PARAMS ((struct cie *, struct cie *));
static int vma_compare
- PARAMS ((const PTR a, const PTR b));
+ PARAMS ((const PTR, const PTR));
/* Helper function for reading uleb128 encoded data. */
@@ -1112,7 +1112,7 @@ vma_compare (a, b)
fde_count x [encoded] initial_loc, fde
(array of encoded pairs containing
FDE initial_location field and FDE address,
- sorted by increasing initial_loc) */
+ sorted by increasing initial_loc). */
bfd_boolean
_bfd_elf_write_section_eh_frame_hdr (abfd, info)
@@ -1125,6 +1125,7 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info)
bfd_byte *contents;
asection *eh_frame_sec;
bfd_size_type size;
+ bfd_boolean retval;
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
@@ -1141,15 +1142,18 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info)
eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
if (eh_frame_sec == NULL)
- return FALSE;
+ {
+ free (contents);
+ return FALSE;
+ }
memset (contents, 0, EH_FRAME_HDR_SIZE);
- contents[0] = 1; /* Version */
- contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset */
+ contents[0] = 1; /* Version. */
+ contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset. */
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
{
- contents[2] = DW_EH_PE_udata4; /* FDE count encoding */
- contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* search table enc */
+ contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */
+ contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */
}
else
{
@@ -1177,7 +1181,9 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info)
}
}
- return bfd_set_section_contents (abfd, sec->output_section,
- contents, (file_ptr) sec->output_offset,
- sec->_cooked_size);
+ retval = bfd_set_section_contents (abfd, sec->output_section,
+ contents, (file_ptr) sec->output_offset,
+ sec->_cooked_size);
+ free (contents);
+ return retval;
}
diff --git a/bfd/elf.c b/bfd/elf.c
index 0331f3d..56dfda3 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5068,7 +5068,10 @@ copy_private_bfd_data (ibfd, obfd)
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
if (map == NULL)
- return FALSE;
+ {
+ free (sections);
+ return FALSE;
+ }
/* Initialise the fields of the segment map. Set the physical
physical address to the LMA of the first section that has
@@ -5303,7 +5306,10 @@ swap_out_syms (abfd, sttp, relocatable_p)
amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym;
outbound_syms = bfd_alloc (abfd, amt);
if (outbound_syms == NULL)
- return FALSE;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
symtab_hdr->contents = (PTR) outbound_syms;
outbound_shndx = NULL;
@@ -5313,7 +5319,11 @@ swap_out_syms (abfd, sttp, relocatable_p)
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
outbound_shndx = bfd_zalloc (abfd, amt);
if (outbound_shndx == NULL)
- return FALSE;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
+
symtab_shndx_hdr->contents = outbound_shndx;
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
symtab_shndx_hdr->sh_size = amt;
@@ -5357,7 +5367,10 @@ swap_out_syms (abfd, sttp, relocatable_p)
syms[idx]->name,
TRUE, FALSE);
if (sym.st_name == (unsigned long) -1)
- return FALSE;
+ {
+ _bfd_stringtab_free (stt);
+ return FALSE;
+ }
}
type_ptr = elf_symbol_from (abfd, syms[idx]);
@@ -5446,6 +5459,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"),
syms[idx]->name ? syms[idx]->name : "<Local sym>",
sec->name);
bfd_set_error (bfd_error_invalid_operation);
+ _bfd_stringtab_free (stt);
return FALSE;
}
@@ -5906,7 +5920,7 @@ _bfd_elf_slurp_version_tables (abfd)
return TRUE;
error_return:
- if (contents == NULL)
+ if (contents != NULL)
free (contents);
return FALSE;
}
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 417284b..631b2b9 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -2119,43 +2119,18 @@ static bfd_boolean
elf32_arm_object_p (abfd)
bfd *abfd;
{
- asection * arm_arch_section;
+ unsigned int mach;
+
+ mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
- arm_arch_section = bfd_get_section_by_name (abfd, ARM_NOTE_SECTION);
+ if (mach != bfd_mach_arm_unknown)
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
+
+ else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
- if (arm_arch_section)
- {
- char buffer [4];
- unsigned long arm_mach;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("%s: warning: unable to retrieve %s section from %s"),
- ARM_NOTE_SECTION, bfd_get_filename (abfd));
- else
- {
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- arm_mach = bfd_get_32 (abfd, buffer);
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, arm_mach);
-
- if (bfd_get_arch (abfd) == bfd_arch_arm)
- return TRUE;
-
- /* If the set failed for some reason, do not leave the architecture
- type as 0 (unknown), but issue a warning message and force it to
- be set to bfd_arch_arm. */
- (*_bfd_error_handler)
- (_("%s: warning: unrecognized ARM machine number: %x"),
- bfd_get_filename (abfd), arm_mach);
- }
- }
else
- {
- if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
- }
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
return TRUE;
}
@@ -2296,24 +2271,10 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
return TRUE;
}
- if (bfd_get_mach (obfd) && bfd_get_mach (obfd) != bfd_get_mach (ibfd))
- {
- /* For now, allow an output file type of 'xscale' if the
- input file type is 'iWMMXt'. This means that we will
- not have to build an entire iWMMXt enabled set of libraries
- just to test a iWMMXt enabled binary. Change the output
- type to iWMMXt though. Similarly allow 'xscale' binaries
- to be linked into a 'iWMMXt' output binary. */
- if ( bfd_get_mach (obfd) == bfd_mach_arm_XScale
- && bfd_get_mach (ibfd) == bfd_mach_arm_iWMMXt)
- bfd_set_arch_mach (obfd, bfd_get_arch (obfd), bfd_mach_arm_iWMMXt);
- else if ( bfd_get_mach (ibfd) != bfd_mach_arm_XScale
- || bfd_get_mach (obfd) != bfd_mach_arm_iWMMXt)
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- }
+ /* Determine what should happen if the input ARM architecture
+ does not match the output ARM architecture. */
+ if (! bfd_arm_merge_machines (ibfd, obfd))
+ return FALSE;
/* Identical flags must be compatible. */
if (in_flags == out_flags)
@@ -3733,42 +3694,7 @@ elf32_arm_final_write_processing (abfd, linker)
bfd *abfd;
bfd_boolean linker ATTRIBUTE_UNUSED;
{
- asection * arm_arch_section;
- char buffer [4];
- unsigned long arm_mach;
-
- /* Look for a .note.arm.ident section. If one is present check
- the machine number encoded in it, and set it to the current
- machine number if it is different. This allows XScale and
- iWMMXt binaries to be merged and the resulting output to be set
- to iWMMXt, even if the first input file had an XScale .note. */
-
- arm_arch_section = bfd_get_section_by_name (abfd, ARM_NOTE_SECTION);
-
- if (arm_arch_section == NULL)
- return;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- /* If the ident section does not exist then just skip this check. */
- return;
-
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- arm_mach = bfd_get_32 (abfd, buffer);
-
- if (arm_mach == bfd_get_mach (abfd))
- return;
-
- bfd_put_32 (abfd, bfd_get_mach (abfd), buffer);
-
- if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("warning: unable to update contents of %s section in %s"),
- ARM_NOTE_SECTION, bfd_get_filename (abfd));
-
- return;
+ bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
}
#define ELF_ARCH bfd_arch_arm
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 6d54419..186f39d 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -147,8 +147,12 @@ static bfd_boolean ppc_elf_grok_psinfo
#define DTP_OFFSET 0x8000
/* Will references to this symbol always reference the symbol
- in this object? */
-#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
+ in this object? STV_PROTECTED is excluded from the visibility test
+ here so that function pointer comparisons work properly. Since
+ function symbols not defined in an app are set to their .plt entry,
+ it's necessary for shared libs to also reference the .plt even
+ though the symbol is really local to the shared lib. */
+#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
((! INFO->shared \
|| INFO->symbolic \
|| H->dynindx == -1 \
@@ -3459,8 +3463,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || SYMBOL_REFERENCES_LOCAL (info, h))
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
/* fall through */
@@ -3745,8 +3748,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
case R_PPC_REL14_BRNTAKEN:
case R_PPC_REL32:
if (h == NULL
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || SYMBOL_REFERENCES_LOCAL (info, h))
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
/* Fall thru */
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
new file mode 100644
index 0000000..92fb98c
--- /dev/null
+++ b/bfd/elf32-xtensa.c
@@ -0,0 +1,5846 @@
+/* Xtensa-specific support for 32-bit ELF.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+
+#ifdef ANSI_PROTOTYPES
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#include <strings.h>
+
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/xtensa.h"
+#include "xtensa-isa.h"
+#include "xtensa-config.h"
+
+/* Main interface functions. */
+static void elf_xtensa_info_to_howto_rela
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static reloc_howto_type *elf_xtensa_reloc_type_lookup
+ PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+extern int xtensa_read_table_entries
+ PARAMS ((bfd *, asection *, property_table_entry **, const char *));
+static bfd_boolean elf_xtensa_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static void elf_xtensa_hide_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
+static void elf_xtensa_copy_indirect_symbol
+ PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
+ struct elf_link_hash_entry *));
+static asection *elf_xtensa_gc_mark_hook
+ PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static bfd_boolean elf_xtensa_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static bfd_boolean elf_xtensa_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_adjust_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static bfd_boolean elf_xtensa_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_modify_segment_map
+ PARAMS ((bfd *));
+static bfd_boolean elf_xtensa_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static bfd_boolean elf_xtensa_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *again));
+static bfd_boolean elf_xtensa_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+static bfd_boolean elf_xtensa_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_merge_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+static bfd_boolean elf_xtensa_set_private_flags
+ PARAMS ((bfd *, flagword));
+extern flagword elf_xtensa_get_private_bfd_flags
+ PARAMS ((bfd *));
+static bfd_boolean elf_xtensa_print_private_bfd_data
+ PARAMS ((bfd *, PTR));
+static bfd_boolean elf_xtensa_object_p
+ PARAMS ((bfd *));
+static void elf_xtensa_final_write_processing
+ PARAMS ((bfd *, bfd_boolean));
+static enum elf_reloc_type_class elf_xtensa_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+static bfd_boolean elf_xtensa_discard_info
+ PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
+static bfd_boolean elf_xtensa_ignore_discarded_relocs
+ PARAMS ((asection *));
+static bfd_boolean elf_xtensa_grok_prstatus
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elf_xtensa_grok_psinfo
+ PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elf_xtensa_new_section_hook
+ PARAMS ((bfd *, asection *));
+
+
+/* Local helper functions. */
+
+static int property_table_compare
+ PARAMS ((const PTR, const PTR));
+static bfd_boolean elf_xtensa_in_literal_pool
+ PARAMS ((property_table_entry *, int, bfd_vma));
+static void elf_xtensa_make_sym_local
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static bfd_boolean add_extra_plt_sections
+ PARAMS ((bfd *, int));
+static bfd_boolean elf_xtensa_fix_refcounts
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_xtensa_allocate_plt_size
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static bfd_boolean elf_xtensa_allocate_got_size
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static void elf_xtensa_allocate_local_got_size
+ PARAMS ((struct bfd_link_info *, asection *));
+static bfd_reloc_status_type elf_xtensa_do_reloc
+ PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_vma, bfd_byte *,
+ bfd_vma, bfd_boolean, char **));
+static char * vsprint_msg
+ VPARAMS ((const char *, const char *, int, ...));
+static char *build_encoding_error_message
+ PARAMS ((xtensa_opcode, xtensa_encode_result));
+static bfd_reloc_status_type bfd_elf_xtensa_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static void do_fix_for_relocateable_link
+ PARAMS ((Elf_Internal_Rela *, bfd *, asection *));
+static void do_fix_for_final_link
+ PARAMS ((Elf_Internal_Rela *, asection *, bfd_vma *));
+static bfd_boolean xtensa_elf_dynamic_symbol_p
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static bfd_vma elf_xtensa_create_plt_entry
+ PARAMS ((bfd *, bfd *, unsigned));
+static int elf_xtensa_combine_prop_entries
+ PARAMS ((bfd *, const char *));
+static bfd_boolean elf_xtensa_discard_info_for_section
+ PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *,
+ asection *));
+
+/* Local functions to handle Xtensa configurability. */
+
+static void init_call_opcodes
+ PARAMS ((void));
+static bfd_boolean is_indirect_call_opcode
+ PARAMS ((xtensa_opcode));
+static bfd_boolean is_direct_call_opcode
+ PARAMS ((xtensa_opcode));
+static bfd_boolean is_windowed_call_opcode
+ PARAMS ((xtensa_opcode));
+static xtensa_opcode get_l32r_opcode
+ PARAMS ((void));
+static bfd_vma l32r_offset
+ PARAMS ((bfd_vma, bfd_vma));
+static int get_relocation_opnd
+ PARAMS ((Elf_Internal_Rela *));
+static xtensa_opcode get_relocation_opcode
+ PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *));
+static bfd_boolean is_l32r_relocation
+ PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *));
+
+/* Functions for link-time code simplifications. */
+
+static bfd_reloc_status_type elf_xtensa_do_asm_simplify
+ PARAMS ((bfd_byte *, bfd_vma, bfd_vma));
+static bfd_reloc_status_type contract_asm_expansion
+ PARAMS ((bfd_byte *, bfd_vma, Elf_Internal_Rela *));
+static xtensa_opcode swap_callx_for_call_opcode
+ PARAMS ((xtensa_opcode));
+static xtensa_opcode get_expanded_call_opcode
+ PARAMS ((bfd_byte *, int));
+
+/* Access to internal relocations, section contents and symbols. */
+
+static Elf_Internal_Rela *retrieve_internal_relocs
+ PARAMS ((bfd *, asection *, bfd_boolean));
+static void pin_internal_relocs
+ PARAMS ((asection *, Elf_Internal_Rela *));
+static void release_internal_relocs
+ PARAMS ((asection *, Elf_Internal_Rela *));
+static bfd_byte *retrieve_contents
+ PARAMS ((bfd *, asection *, bfd_boolean));
+static void pin_contents
+ PARAMS ((asection *, bfd_byte *));
+static void release_contents
+ PARAMS ((asection *, bfd_byte *));
+static Elf_Internal_Sym *retrieve_local_syms
+ PARAMS ((bfd *));
+
+/* Miscellaneous utility functions. */
+
+static asection *elf_xtensa_get_plt_section
+ PARAMS ((bfd *, int));
+static asection *elf_xtensa_get_gotplt_section
+ PARAMS ((bfd *, int));
+static asection *get_elf_r_symndx_section
+ PARAMS ((bfd *, unsigned long));
+static struct elf_link_hash_entry *get_elf_r_symndx_hash_entry
+ PARAMS ((bfd *, unsigned long));
+static bfd_vma get_elf_r_symndx_offset
+ PARAMS ((bfd *, unsigned long));
+static bfd_boolean pcrel_reloc_fits
+ PARAMS ((xtensa_operand, bfd_vma, bfd_vma));
+static bfd_boolean xtensa_is_property_section
+ PARAMS ((asection *));
+static bfd_boolean is_literal_section
+ PARAMS ((asection *));
+static int internal_reloc_compare
+ PARAMS ((const PTR, const PTR));
+static bfd_boolean get_is_linkonce_section
+ PARAMS ((bfd *, asection *));
+extern char *xtensa_get_property_section_name
+ PARAMS ((bfd *, asection *, const char *));
+
+/* Other functions called directly by the linker. */
+
+typedef void (*deps_callback_t)
+ PARAMS ((asection *, bfd_vma, asection *, bfd_vma, PTR));
+extern bfd_boolean xtensa_callback_required_dependence
+ PARAMS ((bfd *, asection *, struct bfd_link_info *,
+ deps_callback_t, PTR));
+
+
+typedef struct xtensa_relax_info_struct xtensa_relax_info;
+
+
+/* Total count of PLT relocations seen during check_relocs.
+ The actual PLT code must be split into multiple sections and all
+ the sections have to be created before size_dynamic_sections,
+ where we figure out the exact number of PLT entries that will be
+ needed. It is OK is this count is an overestimate, e.g., some
+ relocations may be removed by GC. */
+
+static int plt_reloc_count = 0;
+
+
+/* When this is true, relocations may have been modified to refer to
+ symbols from other input files. The per-section list of "fix"
+ records needs to be checked when resolving relocations. */
+
+static bfd_boolean relaxing_section = FALSE;
+
+
+static reloc_howto_type elf_howto_table[] =
+{
+ HOWTO (R_XTENSA_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_NONE",
+ FALSE, 0x00000000, 0x00000000, FALSE),
+ HOWTO (R_XTENSA_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_xtensa_reloc, "R_XTENSA_32",
+ TRUE, 0xffffffff, 0xffffffff, FALSE),
+ /* Replace a 32-bit value with a value from the runtime linker (only
+ used by linker-generated stub functions). The r_addend value is
+ special: 1 means to substitute a pointer to the runtime linker's
+ dynamic resolver function; 2 means to substitute the link map for
+ the shared object. */
+ HOWTO (R_XTENSA_RTLD, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ NULL, "R_XTENSA_RTLD",
+ FALSE, 0x00000000, 0x00000000, FALSE),
+ HOWTO (R_XTENSA_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_XTENSA_GLOB_DAT",
+ FALSE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO (R_XTENSA_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_XTENSA_JMP_SLOT",
+ FALSE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO (R_XTENSA_RELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_generic_reloc, "R_XTENSA_RELATIVE",
+ FALSE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO (R_XTENSA_PLT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
+ bfd_elf_xtensa_reloc, "R_XTENSA_PLT",
+ FALSE, 0xffffffff, 0xffffffff, FALSE),
+ EMPTY_HOWTO (7),
+ HOWTO (R_XTENSA_OP0, 0, 0, 0, TRUE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP0",
+ FALSE, 0x00000000, 0x00000000, TRUE),
+ HOWTO (R_XTENSA_OP1, 0, 0, 0, TRUE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP1",
+ FALSE, 0x00000000, 0x00000000, TRUE),
+ HOWTO (R_XTENSA_OP2, 0, 0, 0, TRUE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_OP2",
+ FALSE, 0x00000000, 0x00000000, TRUE),
+ /* Assembly auto-expansion. */
+ HOWTO (R_XTENSA_ASM_EXPAND, 0, 0, 0, TRUE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_ASM_EXPAND",
+ FALSE, 0x00000000, 0x00000000, FALSE),
+ /* Relax assembly auto-expansion. */
+ HOWTO (R_XTENSA_ASM_SIMPLIFY, 0, 0, 0, TRUE, 0, complain_overflow_dont,
+ bfd_elf_xtensa_reloc, "R_XTENSA_ASM_SIMPLIFY",
+ FALSE, 0x00000000, 0x00000000, TRUE),
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_XTENSA_GNU_VTINHERIT, 0, 2, 0, FALSE, 0, complain_overflow_dont,
+ NULL, "R_XTENSA_GNU_VTINHERIT",
+ FALSE, 0x00000000, 0x00000000, FALSE),
+ /* GNU extension to record C++ vtable member usage. */
+ HOWTO (R_XTENSA_GNU_VTENTRY, 0, 2, 0, FALSE, 0, complain_overflow_dont,
+ _bfd_elf_rel_vtable_reloc_fn, "R_XTENSA_GNU_VTENTRY",
+ FALSE, 0x00000000, 0x00000000, FALSE)
+};
+
+#ifdef DEBUG_GEN_RELOC
+#define TRACE(str) \
+ fprintf (stderr, "Xtensa bfd reloc lookup %d (%s)\n", code, str)
+#else
+#define TRACE(str)
+#endif
+
+static reloc_howto_type *
+elf_xtensa_reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ switch (code)
+ {
+ case BFD_RELOC_NONE:
+ TRACE ("BFD_RELOC_NONE");
+ return &elf_howto_table[(unsigned) R_XTENSA_NONE ];
+
+ case BFD_RELOC_32:
+ TRACE ("BFD_RELOC_32");
+ return &elf_howto_table[(unsigned) R_XTENSA_32 ];
+
+ case BFD_RELOC_XTENSA_RTLD:
+ TRACE ("BFD_RELOC_XTENSA_RTLD");
+ return &elf_howto_table[(unsigned) R_XTENSA_RTLD ];
+
+ case BFD_RELOC_XTENSA_GLOB_DAT:
+ TRACE ("BFD_RELOC_XTENSA_GLOB_DAT");
+ return &elf_howto_table[(unsigned) R_XTENSA_GLOB_DAT ];
+
+ case BFD_RELOC_XTENSA_JMP_SLOT:
+ TRACE ("BFD_RELOC_XTENSA_JMP_SLOT");
+ return &elf_howto_table[(unsigned) R_XTENSA_JMP_SLOT ];
+
+ case BFD_RELOC_XTENSA_RELATIVE:
+ TRACE ("BFD_RELOC_XTENSA_RELATIVE");
+ return &elf_howto_table[(unsigned) R_XTENSA_RELATIVE ];
+
+ case BFD_RELOC_XTENSA_PLT:
+ TRACE ("BFD_RELOC_XTENSA_PLT");
+ return &elf_howto_table[(unsigned) R_XTENSA_PLT ];
+
+ case BFD_RELOC_XTENSA_OP0:
+ TRACE ("BFD_RELOC_XTENSA_OP0");
+ return &elf_howto_table[(unsigned) R_XTENSA_OP0 ];
+
+ case BFD_RELOC_XTENSA_OP1:
+ TRACE ("BFD_RELOC_XTENSA_OP1");
+ return &elf_howto_table[(unsigned) R_XTENSA_OP1 ];
+
+ case BFD_RELOC_XTENSA_OP2:
+ TRACE ("BFD_RELOC_XTENSA_OP2");
+ return &elf_howto_table[(unsigned) R_XTENSA_OP2 ];
+
+ case BFD_RELOC_XTENSA_ASM_EXPAND:
+ TRACE ("BFD_RELOC_XTENSA_ASM_EXPAND");
+ return &elf_howto_table[(unsigned) R_XTENSA_ASM_EXPAND ];
+
+ case BFD_RELOC_XTENSA_ASM_SIMPLIFY:
+ TRACE ("BFD_RELOC_XTENSA_ASM_SIMPLIFY");
+ return &elf_howto_table[(unsigned) R_XTENSA_ASM_SIMPLIFY ];
+
+ case BFD_RELOC_VTABLE_INHERIT:
+ TRACE ("BFD_RELOC_VTABLE_INHERIT");
+ return &elf_howto_table[(unsigned) R_XTENSA_GNU_VTINHERIT ];
+
+ case BFD_RELOC_VTABLE_ENTRY:
+ TRACE ("BFD_RELOC_VTABLE_ENTRY");
+ return &elf_howto_table[(unsigned) R_XTENSA_GNU_VTENTRY ];
+
+ default:
+ break;
+ }
+
+ TRACE ("Unknown");
+ return NULL;
+}
+
+
+/* Given an ELF "rela" relocation, find the corresponding howto and record
+ it in the BFD internal arelent representation of the relocation. */
+
+static void
+elf_xtensa_info_to_howto_rela (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr;
+ Elf_Internal_Rela *dst;
+{
+ unsigned int r_type = ELF32_R_TYPE (dst->r_info);
+
+ BFD_ASSERT (r_type < (unsigned int) R_XTENSA_max);
+ cache_ptr->howto = &elf_howto_table[r_type];
+}
+
+
+/* Functions for the Xtensa ELF linker. */
+
+/* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so"
+
+/* The size in bytes of an entry in the procedure linkage table.
+ (This does _not_ include the space for the literals associated with
+ the PLT entry.) */
+
+#define PLT_ENTRY_SIZE 16
+
+/* For _really_ large PLTs, we may need to alternate between literals
+ and code to keep the literals within the 256K range of the L32R
+ instructions in the code. It's unlikely that anyone would ever need
+ such a big PLT, but an arbitrary limit on the PLT size would be bad.
+ Thus, we split the PLT into chunks. Since there's very little
+ overhead (2 extra literals) for each chunk, the chunk size is kept
+ small so that the code for handling multiple chunks get used and
+ tested regularly. With 254 entries, there are 1K of literals for
+ each chunk, and that seems like a nice round number. */
+
+#define PLT_ENTRIES_PER_CHUNK 254
+
+/* PLT entries are actually used as stub functions for lazy symbol
+ resolution. Once the symbol is resolved, the stub function is never
+ invoked. Note: the 32-byte frame size used here cannot be changed
+ without a corresponding change in the runtime linker. */
+
+static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] =
+{
+ 0x6c, 0x10, 0x04, /* entry sp, 32 */
+ 0x18, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
+ 0x1a, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
+ 0x1b, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
+ 0x0a, 0x80, 0x00, /* jx a8 */
+ 0 /* unused */
+};
+
+static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] =
+{
+ 0x36, 0x41, 0x00, /* entry sp, 32 */
+ 0x81, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
+ 0xa1, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
+ 0xb1, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
+ 0xa0, 0x08, 0x00, /* jx a8 */
+ 0 /* unused */
+};
+
+
+static int
+property_table_compare (ap, bp)
+ const PTR ap;
+ const PTR bp;
+{
+ const property_table_entry *a = (const property_table_entry *) ap;
+ const property_table_entry *b = (const property_table_entry *) bp;
+
+ /* Check if one entry overlaps with the other; this shouldn't happen
+ except when searching for a match. */
+ if ((b->address >= a->address && b->address < (a->address + a->size))
+ || (a->address >= b->address && a->address < (b->address + b->size)))
+ return 0;
+
+ return (a->address - b->address);
+}
+
+
+/* Get the literal table or instruction table entries for the given
+ section. Sets TABLE_P and returns the number of entries. On error,
+ returns a negative value. */
+
+int
+xtensa_read_table_entries (abfd, section, table_p, sec_name)
+ bfd *abfd;
+ asection *section;
+ property_table_entry **table_p;
+ const char *sec_name;
+{
+ asection *table_section;
+ char *table_section_name;
+ bfd_size_type table_size = 0;
+ bfd_byte *table_data;
+ property_table_entry *blocks;
+ int block_count;
+ bfd_size_type num_records;
+ Elf_Internal_Rela *internal_relocs;
+
+ table_section_name =
+ xtensa_get_property_section_name (abfd, section, sec_name);
+ table_section = bfd_get_section_by_name (abfd, table_section_name);
+ if (table_section != NULL)
+ table_size = bfd_get_section_size_before_reloc (table_section);
+
+ if (table_size == 0)
+ {
+ *table_p = NULL;
+ return 0;
+ }
+
+ num_records = table_size / sizeof (property_table_entry);
+ table_data = retrieve_contents (abfd, table_section, TRUE);
+ blocks = (property_table_entry *)
+ bfd_malloc (num_records * sizeof (property_table_entry));
+ block_count = 0;
+
+ /* If the file has not yet been relocated, process the relocations
+ and sort out the table entries that apply to the specified section. */
+ internal_relocs = retrieve_internal_relocs (abfd, table_section, TRUE);
+ if (internal_relocs)
+ {
+ unsigned i;
+
+ for (i = 0; i < table_section->reloc_count; i++)
+ {
+ Elf_Internal_Rela *rel = &internal_relocs[i];
+ unsigned long r_symndx;
+
+ if (ELF32_R_TYPE (rel->r_info) == R_XTENSA_NONE)
+ continue;
+
+ BFD_ASSERT (ELF32_R_TYPE (rel->r_info) == R_XTENSA_32);
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ if (get_elf_r_symndx_section (abfd, r_symndx) == section)
+ {
+ bfd_vma sym_off = get_elf_r_symndx_offset (abfd, r_symndx);
+ blocks[block_count].address =
+ (section->vma + sym_off + rel->r_addend
+ + bfd_get_32 (abfd, table_data + rel->r_offset));
+ blocks[block_count].size =
+ bfd_get_32 (abfd, table_data + rel->r_offset + 4);
+ block_count++;
+ }
+ }
+ }
+ else
+ {
+ /* No relocations. Presumably the file has been relocated
+ and the addresses are already in the table. */
+ bfd_vma off;
+
+ for (off = 0; off < table_size; off += sizeof (property_table_entry))
+ {
+ bfd_vma address = bfd_get_32 (abfd, table_data + off);
+
+ if (address >= section->vma
+ && address < ( section->vma + section->_raw_size))
+ {
+ blocks[block_count].address = address;
+ blocks[block_count].size =
+ bfd_get_32 (abfd, table_data + off + 4);
+ block_count++;
+ }
+ }
+ }
+
+ release_contents (table_section, table_data);
+ release_internal_relocs (table_section, internal_relocs);
+
+ if (block_count > 0)
+ {
+ /* Now sort them into address order for easy reference. */
+ qsort (blocks, block_count, sizeof (property_table_entry),
+ property_table_compare);
+ }
+
+ *table_p = blocks;
+ return block_count;
+}
+
+
+static bfd_boolean
+elf_xtensa_in_literal_pool (lit_table, lit_table_size, addr)
+ property_table_entry *lit_table;
+ int lit_table_size;
+ bfd_vma addr;
+{
+ property_table_entry entry;
+
+ if (lit_table_size == 0)
+ return FALSE;
+
+ entry.address = addr;
+ entry.size = 1;
+
+ if (bsearch (&entry, lit_table, lit_table_size,
+ sizeof (property_table_entry), property_table_compare))
+ return TRUE;
+
+ return FALSE;
+}
+
+
+/* Look through the relocs for a section during the first phase, and
+ calculate needed space in the dynamic reloc sections. */
+
+static bfd_boolean
+elf_xtensa_check_relocs (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ property_table_entry *lit_table;
+ int ltblsize;
+
+ if (info->relocateable)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+
+ ltblsize = xtensa_read_table_entries (abfd, sec, &lit_table,
+ XTENSA_LIT_SEC_NAME);
+ if (ltblsize < 0)
+ return FALSE;
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ unsigned int r_type;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ r_type = ELF32_R_TYPE (rel->r_info);
+
+ if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
+ bfd_archive_filename (abfd),
+ r_symndx);
+ return FALSE;
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
+ switch (r_type)
+ {
+ case R_XTENSA_32:
+ if (h == NULL)
+ goto local_literal;
+
+ if ((sec->flags & SEC_ALLOC) != 0)
+ {
+ if ((sec->flags & SEC_READONLY) != 0
+ && !elf_xtensa_in_literal_pool (lit_table, ltblsize,
+ sec->vma + rel->r_offset))
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
+ if (h->got.refcount <= 0)
+ h->got.refcount = 1;
+ else
+ h->got.refcount += 1;
+ }
+ break;
+
+ case R_XTENSA_PLT:
+ /* If this relocation is against a local symbol, then it's
+ exactly the same as a normal local GOT entry. */
+ if (h == NULL)
+ goto local_literal;
+
+ if ((sec->flags & SEC_ALLOC) != 0)
+ {
+ if ((sec->flags & SEC_READONLY) != 0
+ && !elf_xtensa_in_literal_pool (lit_table, ltblsize,
+ sec->vma + rel->r_offset))
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
+ if (h->plt.refcount <= 0)
+ {
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount = 1;
+ }
+ else
+ h->plt.refcount += 1;
+
+ /* Keep track of the total PLT relocation count even if we
+ don't yet know whether the dynamic sections will be
+ created. */
+ plt_reloc_count += 1;
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ if (!add_extra_plt_sections (elf_hash_table (info)->dynobj,
+ plt_reloc_count))
+ return FALSE;
+ }
+ }
+ break;
+
+ local_literal:
+ if ((sec->flags & SEC_ALLOC) != 0)
+ {
+ bfd_signed_vma *local_got_refcounts;
+
+ /* This is a global offset table entry for a local symbol. */
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+ if (local_got_refcounts == NULL)
+ {
+ bfd_size_type size;
+
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma);
+ local_got_refcounts = ((bfd_signed_vma *)
+ bfd_zalloc (abfd, size));
+ if (local_got_refcounts == NULL)
+ return FALSE;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ }
+ local_got_refcounts[r_symndx] += 1;
+
+ /* If the relocation is not inside the GOT, the DF_TEXTREL
+ flag needs to be set. */
+ if (info->shared
+ && (sec->flags & SEC_READONLY) != 0
+ && !elf_xtensa_in_literal_pool (lit_table, ltblsize,
+ sec->vma + rel->r_offset))
+ info->flags |= DF_TEXTREL;
+ }
+ break;
+
+ case R_XTENSA_OP0:
+ case R_XTENSA_OP1:
+ case R_XTENSA_OP2:
+ case R_XTENSA_ASM_EXPAND:
+ case R_XTENSA_ASM_SIMPLIFY:
+ /* Nothing to do for these. */
+ break;
+
+ case R_XTENSA_GNU_VTINHERIT:
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return FALSE;
+ break;
+
+ case R_XTENSA_GNU_VTENTRY:
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return FALSE;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ free (lit_table);
+ return TRUE;
+}
+
+
+static void
+elf_xtensa_hide_symbol (info, h, force_local)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+ bfd_boolean force_local;
+{
+ /* For a shared link, move the plt refcount to the got refcount to leave
+ space for RELATIVE relocs. */
+ elf_xtensa_make_sym_local (info, h);
+
+ _bfd_elf_link_hash_hide_symbol (info, h, force_local);
+}
+
+
+static void
+elf_xtensa_copy_indirect_symbol (bed, dir, ind)
+ struct elf_backend_data *bed;
+ struct elf_link_hash_entry *dir, *ind;
+{
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+
+ /* The standard function doesn't copy the NEEDS_PLT flag. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT);
+}
+
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+elf_xtensa_gc_mark_hook (sec, info, rel, h, sym)
+ asection *sec;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *rel;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+{
+ if (h != NULL)
+ {
+ switch (ELF32_R_TYPE (rel->r_info))
+ {
+ case R_XTENSA_GNU_VTINHERIT:
+ case R_XTENSA_GNU_VTENTRY:
+ break;
+
+ default:
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
+ }
+ }
+ else
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
+ return NULL;
+}
+
+/* Update the GOT & PLT entry reference counts
+ for the section being removed. */
+
+static bfd_boolean
+elf_xtensa_gc_sweep_hook (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_signed_vma *local_got_refcounts;
+ const Elf_Internal_Rela *rel, *relend;
+
+ if ((sec->flags & SEC_ALLOC) == 0)
+ return TRUE;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+
+ relend = relocs + sec->reloc_count;
+ for (rel = relocs; rel < relend; rel++)
+ {
+ unsigned long r_symndx;
+ unsigned int r_type;
+ struct elf_link_hash_entry *h = NULL;
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_XTENSA_32:
+ if (h == NULL)
+ goto local_literal;
+ if (h->got.refcount > 0)
+ h->got.refcount--;
+ break;
+
+ case R_XTENSA_PLT:
+ if (h == NULL)
+ goto local_literal;
+ if (h->plt.refcount > 0)
+ h->plt.refcount--;
+ break;
+
+ local_literal:
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/* Create all the dynamic sections. */
+
+static bfd_boolean
+elf_xtensa_create_dynamic_sections (dynobj, info)
+ bfd *dynobj;
+ struct bfd_link_info *info;
+{
+ flagword flags;
+ asection *s;
+
+ /* First do all the standard stuff. */
+ if (! _bfd_elf_create_dynamic_sections (dynobj, info))
+ return FALSE;
+
+ /* Create any extra PLT sections in case check_relocs has already
+ been called on all the non-dynamic input files. */
+ if (!add_extra_plt_sections (dynobj, plt_reloc_count))
+ return FALSE;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+
+ /* Mark the ".got.plt" section READONLY. */
+ s = bfd_get_section_by_name (dynobj, ".got.plt");
+ if (s == NULL
+ || ! bfd_set_section_flags (dynobj, s, flags))
+ return FALSE;
+
+ /* Create ".rela.got". */
+ s = bfd_make_section (dynobj, ".rela.got");
+ if (s == NULL
+ || ! bfd_set_section_flags (dynobj, s, flags)
+ || ! bfd_set_section_alignment (dynobj, s, 2))
+ return FALSE;
+
+ /* Create ".xt.lit.plt" (literal table for ".got.plt*"). */
+ s = bfd_make_section (dynobj, ".xt.lit.plt");
+ if (s == NULL
+ || ! bfd_set_section_flags (dynobj, s, flags)
+ || ! bfd_set_section_alignment (dynobj, s, 2))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+static bfd_boolean
+add_extra_plt_sections (dynobj, count)
+ bfd *dynobj;
+ int count;
+{
+ int chunk;
+
+ /* Iterate over all chunks except 0 which uses the standard ".plt" and
+ ".got.plt" sections. */
+ for (chunk = count / PLT_ENTRIES_PER_CHUNK; chunk > 0; chunk--)
+ {
+ char *sname;
+ flagword flags;
+ asection *s;
+
+ /* Stop when we find a section has already been created. */
+ if (elf_xtensa_get_plt_section (dynobj, chunk))
+ break;
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+
+ sname = (char *) bfd_malloc (10);
+ sprintf (sname, ".plt.%u", chunk);
+ s = bfd_make_section (dynobj, sname);
+ if (s == NULL
+ || ! bfd_set_section_flags (dynobj, s, flags | SEC_CODE)
+ || ! bfd_set_section_alignment (dynobj, s, 2))
+ return FALSE;
+
+ sname = (char *) bfd_malloc (14);
+ sprintf (sname, ".got.plt.%u", chunk);
+ s = bfd_make_section (dynobj, sname);
+ if (s == NULL
+ || ! bfd_set_section_flags (dynobj, s, flags)
+ || ! bfd_set_section_alignment (dynobj, s, 2))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+ regular object. The current definition is in some section of the
+ dynamic object, but we're not including those sections. We have to
+ change the definition to something the rest of the link can
+ understand. */
+
+static bfd_boolean
+elf_xtensa_adjust_dynamic_symbol (info, h)
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ struct elf_link_hash_entry *h;
+{
+ /* If this is a weak symbol, and there is a real definition, the
+ processor independent code will have arranged for us to see the
+ real definition first, and we can just use the same value. */
+ if (h->weakdef != NULL)
+ {
+ BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+ || h->weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->weakdef->root.u.def.section;
+ h->root.u.def.value = h->weakdef->root.u.def.value;
+ return TRUE;
+ }
+
+ /* This is a reference to a symbol defined by a dynamic object. The
+ reference must go through the GOT, so there's no need for COPY relocs,
+ .dynbss, etc. */
+
+ return TRUE;
+}
+
+
+static void
+elf_xtensa_make_sym_local (info, h)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+{
+ if (info->shared)
+ {
+ if (h->plt.refcount > 0)
+ {
+ /* Will use RELATIVE relocs instead of JMP_SLOT relocs. */
+ if (h->got.refcount < 0)
+ h->got.refcount = 0;
+ h->got.refcount += h->plt.refcount;
+ h->plt.refcount = 0;
+ }
+ }
+ else
+ {
+ /* Don't need any dynamic relocations at all. */
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ h->plt.refcount = 0;
+ h->got.refcount = 0;
+ }
+}
+
+
+static bfd_boolean
+elf_xtensa_fix_refcounts (h, arg)
+ struct elf_link_hash_entry *h;
+ PTR arg;
+{
+ struct bfd_link_info *info = (struct bfd_link_info *) arg;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (! xtensa_elf_dynamic_symbol_p (info, h))
+ elf_xtensa_make_sym_local (info, h);
+
+ /* If the symbol has a relocation outside the GOT, set the
+ DF_TEXTREL flag. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) != 0)
+ info->flags |= DF_TEXTREL;
+
+ return TRUE;
+}
+
+
+static bfd_boolean
+elf_xtensa_allocate_plt_size (h, arg)
+ struct elf_link_hash_entry *h;
+ PTR arg;
+{
+ asection *srelplt = (asection *) arg;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->plt.refcount > 0)
+ srelplt->_raw_size += (h->plt.refcount * sizeof (Elf32_External_Rela));
+
+ return TRUE;
+}
+
+
+static bfd_boolean
+elf_xtensa_allocate_got_size (h, arg)
+ struct elf_link_hash_entry *h;
+ PTR arg;
+{
+ asection *srelgot = (asection *) arg;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->got.refcount > 0)
+ srelgot->_raw_size += (h->got.refcount * sizeof (Elf32_External_Rela));
+
+ return TRUE;
+}
+
+
+static void
+elf_xtensa_allocate_local_got_size (info, srelgot)
+ struct bfd_link_info *info;
+ asection *srelgot;
+{
+ bfd *i;
+
+ for (i = info->input_bfds; i; i = i->link_next)
+ {
+ bfd_signed_vma *local_got_refcounts;
+ bfd_size_type j, cnt;
+ Elf_Internal_Shdr *symtab_hdr;
+
+ local_got_refcounts = elf_local_got_refcounts (i);
+ if (!local_got_refcounts)
+ continue;
+
+ symtab_hdr = &elf_tdata (i)->symtab_hdr;
+ cnt = symtab_hdr->sh_info;
+
+ for (j = 0; j < cnt; ++j)
+ {
+ if (local_got_refcounts[j] > 0)
+ srelgot->_raw_size += (local_got_refcounts[j]
+ * sizeof (Elf32_External_Rela));
+ }
+ }
+}
+
+
+/* Set the sizes of the dynamic sections. */
+
+static bfd_boolean
+elf_xtensa_size_dynamic_sections (output_bfd, info)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *s, *srelplt, *splt, *sgotplt, *srelgot, *spltlittbl;
+ bfd_boolean relplt, relgot;
+ int plt_entries, plt_chunks, chunk;
+
+ plt_entries = 0;
+ plt_chunks = 0;
+ srelgot = 0;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ if (dynobj == NULL)
+ abort ();
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Set the contents of the .interp section to the interpreter. */
+ if (! info->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ if (s == NULL)
+ abort ();
+ s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
+
+ /* Allocate room for one word in ".got". */
+ s = bfd_get_section_by_name (dynobj, ".got");
+ if (s == NULL)
+ abort ();
+ s->_raw_size = 4;
+
+ /* Adjust refcounts for symbols that we now know are not "dynamic". */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_xtensa_fix_refcounts,
+ (PTR) info);
+
+ /* Allocate space in ".rela.got" for literals that reference
+ global symbols. */
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ if (srelgot == NULL)
+ abort ();
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_xtensa_allocate_got_size,
+ (PTR) srelgot);
+
+ /* If we are generating a shared object, we also need space in
+ ".rela.got" for R_XTENSA_RELATIVE relocs for literals that
+ reference local symbols. */
+ if (info->shared)
+ elf_xtensa_allocate_local_got_size (info, srelgot);
+
+ /* Allocate space in ".rela.plt" for literals that have PLT entries. */
+ srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ if (srelplt == NULL)
+ abort ();
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_xtensa_allocate_plt_size,
+ (PTR) srelplt);
+
+ /* Allocate space in ".plt" to match the size of ".rela.plt". For
+ each PLT entry, we need the PLT code plus a 4-byte literal.
+ For each chunk of ".plt", we also need two more 4-byte
+ literals, two corresponding entries in ".rela.got", and an
+ 8-byte entry in ".xt.lit.plt". */
+ spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt");
+ if (spltlittbl == NULL)
+ abort ();
+
+ plt_entries = srelplt->_raw_size / sizeof (Elf32_External_Rela);
+ plt_chunks =
+ (plt_entries + PLT_ENTRIES_PER_CHUNK - 1) / PLT_ENTRIES_PER_CHUNK;
+
+ /* Iterate over all the PLT chunks, including any extra sections
+ created earlier because the initial count of PLT relocations
+ was an overestimate. */
+ for (chunk = 0;
+ (splt = elf_xtensa_get_plt_section (dynobj, chunk)) != NULL;
+ chunk++)
+ {
+ int chunk_entries;
+
+ sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ if (sgotplt == NULL)
+ abort ();
+
+ if (chunk < plt_chunks - 1)
+ chunk_entries = PLT_ENTRIES_PER_CHUNK;
+ else if (chunk == plt_chunks - 1)
+ chunk_entries = plt_entries - (chunk * PLT_ENTRIES_PER_CHUNK);
+ else
+ chunk_entries = 0;
+
+ if (chunk_entries != 0)
+ {
+ sgotplt->_raw_size = 4 * (chunk_entries + 2);
+ splt->_raw_size = PLT_ENTRY_SIZE * chunk_entries;
+ srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
+ spltlittbl->_raw_size += 8;
+ }
+ else
+ {
+ sgotplt->_raw_size = 0;
+ splt->_raw_size = 0;
+ }
+ }
+ }
+
+ /* Allocate memory for dynamic sections. */
+ relplt = FALSE;
+ relgot = FALSE;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ const char *name;
+ bfd_boolean strip;
+
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ /* It's OK to base decisions on the section name, because none
+ of the dynobj section names depend upon the input files. */
+ name = bfd_get_section_name (dynobj, s);
+
+ strip = FALSE;
+
+ if (strncmp (name, ".rela", 5) == 0)
+ {
+ if (strcmp (name, ".rela.plt") == 0)
+ relplt = TRUE;
+ else if (strcmp (name, ".rela.got") == 0)
+ relgot = TRUE;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
+ }
+ else if (strncmp (name, ".plt.", 5) == 0
+ || strncmp (name, ".got.plt.", 9) == 0)
+ {
+ if (s->_raw_size == 0)
+ {
+ /* If we don't need this section, strip it from the output
+ file. We must create the ".plt*" and ".got.plt*"
+ sections in create_dynamic_sections and/or check_relocs
+ based on a conservative estimate of the PLT relocation
+ count, because the sections must be created before the
+ linker maps input sections to output sections. The
+ linker does that before size_dynamic_sections, where we
+ compute the exact size of the PLT, so there may be more
+ of these sections than are actually needed. */
+ strip = TRUE;
+ }
+ }
+ else if (strcmp (name, ".got") != 0
+ && strcmp (name, ".plt") != 0
+ && strcmp (name, ".got.plt") != 0
+ && strcmp (name, ".xt.lit.plt") != 0)
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ if (strip)
+ _bfd_strip_section_from_output (info, s);
+ else
+ {
+ /* Allocate memory for the section contents. */
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
+ if (s->contents == NULL && s->_raw_size != 0)
+ return FALSE;
+ }
+ }
+
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ /* Add the special XTENSA_RTLD relocations now. The offsets won't be
+ known until finish_dynamic_sections, but we need to get the relocs
+ in place before they are sorted. */
+ if (srelgot == NULL)
+ abort ();
+ for (chunk = 0; chunk < plt_chunks; chunk++)
+ {
+ Elf_Internal_Rela irela;
+ bfd_byte *loc;
+
+ irela.r_offset = 0;
+ irela.r_info = ELF32_R_INFO (0, R_XTENSA_RTLD);
+ irela.r_addend = 0;
+
+ loc = (srelgot->contents
+ + srelgot->reloc_count * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, &irela, loc);
+ bfd_elf32_swap_reloca_out (output_bfd, &irela,
+ loc + sizeof (Elf32_External_Rela));
+ srelgot->reloc_count += 2;
+ }
+
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in elf_xtensa_finish_dynamic_sections, but we
+ must add the entries now so that we get the correct size for
+ the .dynamic section. The DT_DEBUG entry is filled in by the
+ dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (! info->shared)
+ {
+ if (!add_dynamic_entry (DT_DEBUG, 0))
+ return FALSE;
+ }
+
+ if (relplt)
+ {
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
+ return FALSE;
+ }
+
+ if (relgot)
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
+ return FALSE;
+ }
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
+ return FALSE;
+ }
+
+ if (!add_dynamic_entry (DT_XTENSA_GOT_LOC_OFF, 0)
+ || !add_dynamic_entry (DT_XTENSA_GOT_LOC_SZ, 0))
+ return FALSE;
+ }
+#undef add_dynamic_entry
+
+ return TRUE;
+}
+
+
+/* Remove any PT_LOAD segments with no allocated sections. Prior to
+ binutils 2.13, this function used to remove the non-SEC_ALLOC
+ sections from PT_LOAD segments, but that task has now been moved
+ into elf.c. We still need this function to remove any empty
+ segments that result, but there's nothing Xtensa-specific about
+ this and it probably ought to be moved into elf.c as well. */
+
+static bfd_boolean
+elf_xtensa_modify_segment_map (abfd)
+ bfd *abfd;
+{
+ struct elf_segment_map **m_p;
+
+ m_p = &elf_tdata (abfd)->segment_map;
+ while (*m_p != NULL)
+ {
+ if ((*m_p)->p_type == PT_LOAD && (*m_p)->count == 0)
+ *m_p = (*m_p)->next;
+ else
+ m_p = &(*m_p)->next;
+ }
+ return TRUE;
+}
+
+
+/* Perform the specified relocation. The instruction at (contents + address)
+ is modified to set one operand to represent the value in "relocation". The
+ operand position is determined by the relocation type recorded in the
+ howto. */
+
+#define CALL_SEGMENT_BITS (30)
+#define CALL_SEGMENT_SIZE (1<<CALL_SEGMENT_BITS)
+
+static bfd_reloc_status_type
+elf_xtensa_do_reloc (howto, abfd, input_section, relocation,
+ contents, address, is_weak_undef, error_message)
+ reloc_howto_type *howto;
+ bfd *abfd;
+ asection *input_section;
+ bfd_vma relocation;
+ bfd_byte *contents;
+ bfd_vma address;
+ bfd_boolean is_weak_undef;
+ char **error_message;
+{
+ xtensa_opcode opcode;
+ xtensa_operand operand;
+ xtensa_encode_result encode_result;
+ xtensa_isa isa = xtensa_default_isa;
+ xtensa_insnbuf ibuff;
+ bfd_vma self_address;
+ int opnd;
+ uint32 newval;
+
+ switch (howto->type)
+ {
+ case R_XTENSA_NONE:
+ return bfd_reloc_ok;
+
+ case R_XTENSA_ASM_EXPAND:
+ if (!is_weak_undef)
+ {
+ /* Check for windowed CALL across a 1GB boundary. */
+ xtensa_opcode opcode =
+ get_expanded_call_opcode (contents + address,
+ input_section->_raw_size - address);
+ if (is_windowed_call_opcode (opcode))
+ {
+ self_address = (input_section->output_section->vma
+ + input_section->output_offset
+ + address);
+ if ((self_address >> CALL_SEGMENT_BITS) !=
+ (relocation >> CALL_SEGMENT_BITS))
+ {
+ *error_message = "windowed longcall crosses 1GB boundary; "
+ "return may fail";
+ return bfd_reloc_dangerous;
+ }
+ }
+ }
+ return bfd_reloc_ok;
+
+ case R_XTENSA_ASM_SIMPLIFY:
+ {
+ /* Convert the L32R/CALLX to CALL. */
+ bfd_reloc_status_type retval =
+ elf_xtensa_do_asm_simplify (contents, address,
+ input_section->_raw_size);
+ if (retval != bfd_reloc_ok)
+ return retval;
+
+ /* The CALL needs to be relocated. Continue below for that part. */
+ address += 3;
+ howto = &elf_howto_table[(unsigned) R_XTENSA_OP0 ];
+ }
+ break;
+
+ case R_XTENSA_32:
+ case R_XTENSA_PLT:
+ {
+ bfd_vma x;
+ x = bfd_get_32 (abfd, contents + address);
+ x = x + relocation;
+ bfd_put_32 (abfd, x, contents + address);
+ }
+ return bfd_reloc_ok;
+ }
+
+ /* Read the instruction into a buffer and decode the opcode. */
+ ibuff = xtensa_insnbuf_alloc (isa);
+ xtensa_insnbuf_from_chars (isa, ibuff, contents + address);
+ opcode = xtensa_decode_insn (isa, ibuff);
+
+ /* Determine which operand is being relocated. */
+ if (opcode == XTENSA_UNDEFINED)
+ {
+ *error_message = "cannot decode instruction";
+ return bfd_reloc_dangerous;
+ }
+
+ if (howto->type < R_XTENSA_OP0 || howto->type > R_XTENSA_OP2)
+ {
+ *error_message = "unexpected relocation";
+ return bfd_reloc_dangerous;
+ }
+
+ opnd = howto->type - R_XTENSA_OP0;
+
+ /* Calculate the PC address for this instruction. */
+ if (!howto->pc_relative)
+ {
+ *error_message = "expected PC-relative relocation";
+ return bfd_reloc_dangerous;
+ }
+
+ self_address = (input_section->output_section->vma
+ + input_section->output_offset
+ + address);
+
+ /* Apply the relocation. */
+ operand = xtensa_get_operand (isa, opcode, opnd);
+ newval = xtensa_operand_do_reloc (operand, relocation, self_address);
+ encode_result = xtensa_operand_encode (operand, &newval);
+ xtensa_operand_set_field (operand, ibuff, newval);
+
+ /* Write the modified instruction back out of the buffer. */
+ xtensa_insnbuf_to_chars (isa, ibuff, contents + address);
+ free (ibuff);
+
+ if (encode_result != xtensa_encode_result_ok)
+ {
+ char *message = build_encoding_error_message (opcode, encode_result);
+ *error_message = message;
+ return bfd_reloc_dangerous;
+ }
+
+ /* Final check for call. */
+ if (is_direct_call_opcode (opcode)
+ && is_windowed_call_opcode (opcode))
+ {
+ if ((self_address >> CALL_SEGMENT_BITS) !=
+ (relocation >> CALL_SEGMENT_BITS))
+ {
+ *error_message = "windowed call crosses 1GB boundary; "
+ "return may fail";
+ return bfd_reloc_dangerous;
+ }
+ }
+
+ return bfd_reloc_ok;
+}
+
+
+static char *
+vsprint_msg VPARAMS ((const char *origmsg, const char *fmt, int arglen, ...))
+{
+ /* To reduce the size of the memory leak,
+ we only use a single message buffer. */
+ static bfd_size_type alloc_size = 0;
+ static char *message = NULL;
+ bfd_size_type orig_len, len = 0;
+ bfd_boolean is_append;
+
+ VA_OPEN (ap, arglen);
+ VA_FIXEDARG (ap, const char *, origmsg);
+
+ is_append = (origmsg == message);
+
+ orig_len = strlen (origmsg);
+ len = orig_len + strlen (fmt) + arglen + 20;
+ if (len > alloc_size)
+ {
+ message = (char *) bfd_realloc (message, len);
+ alloc_size = len;
+ }
+ if (!is_append)
+ memcpy (message, origmsg, orig_len);
+ vsprintf (message + orig_len, fmt, ap);
+ VA_CLOSE (ap);
+ return message;
+}
+
+
+static char *
+build_encoding_error_message (opcode, encode_result)
+ xtensa_opcode opcode;
+ xtensa_encode_result encode_result;
+{
+ const char *opname = xtensa_opcode_name (xtensa_default_isa, opcode);
+ const char *msg = NULL;
+
+ switch (encode_result)
+ {
+ case xtensa_encode_result_ok:
+ msg = "unexpected valid encoding";
+ break;
+ case xtensa_encode_result_align:
+ msg = "misaligned encoding";
+ break;
+ case xtensa_encode_result_not_in_table:
+ msg = "encoding not in lookup table";
+ break;
+ case xtensa_encode_result_too_low:
+ msg = "encoding out of range: too low";
+ break;
+ case xtensa_encode_result_too_high:
+ msg = "encoding out of range: too high";
+ break;
+ case xtensa_encode_result_not_ok:
+ default:
+ msg = "could not encode";
+ break;
+ }
+
+ if (is_direct_call_opcode (opcode)
+ && (encode_result == xtensa_encode_result_too_low
+ || encode_result == xtensa_encode_result_too_high))
+
+ msg = "direct call out of range";
+
+ else if (opcode == get_l32r_opcode ())
+ {
+ /* L32Rs have the strange interaction with encoding in that they
+ have an unsigned immediate field, so libisa returns "too high"
+ when the absolute value is out of range and never returns "too
+ low", but I leave the "too low" message in case anything
+ changes. */
+ if (encode_result == xtensa_encode_result_too_low)
+ msg = "literal out of range";
+ else if (encode_result == xtensa_encode_result_too_high)
+ msg = "literal placed after use";
+ }
+
+ return vsprint_msg (opname, ": %s", strlen (msg) + 2, msg);
+}
+
+
+/* This function is registered as the "special_function" in the
+ Xtensa howto for handling simplify operations.
+ bfd_perform_relocation / bfd_install_relocation use it to
+ perform (install) the specified relocation. Since this replaces the code
+ in bfd_perform_relocation, it is basically an Xtensa-specific,
+ stripped-down version of bfd_perform_relocation. */
+
+static bfd_reloc_status_type
+bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message;
+{
+ bfd_vma relocation;
+ bfd_reloc_status_type flag;
+ bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+ bfd_vma output_base = 0;
+ reloc_howto_type *howto = reloc_entry->howto;
+ asection *reloc_target_output_section;
+ bfd_boolean is_weak_undef;
+
+ /* ELF relocs are against symbols. If we are producing relocateable
+ output, and the reloc is against an external symbol, the resulting
+ reloc will also be against the same symbol. In such a case, we
+ don't want to change anything about the way the reloc is handled,
+ since it will all be done at final link time. This test is similar
+ to what bfd_elf_generic_reloc does except that it lets relocs with
+ howto->partial_inplace go through even if the addend is non-zero.
+ (The real problem is that partial_inplace is set for XTENSA_32
+ relocs to begin with, but that's a long story and there's little we
+ can do about it now....) */
+
+ if (output_bfd != (bfd *) NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ /* Is the address of the relocation really within the section? */
+ if (reloc_entry->address > (input_section->_cooked_size
+ / bfd_octets_per_byte (abfd)))
+ return bfd_reloc_outofrange;
+
+ /* Work out which section the relocation is targetted at and the
+ initial relocation command value. */
+
+ /* Get symbol value. (Common symbols are special.) */
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ reloc_target_output_section = symbol->section->output_section;
+
+ /* Convert input-section-relative symbol value to absolute. */
+ if ((output_bfd && !howto->partial_inplace)
+ || reloc_target_output_section == NULL)
+ output_base = 0;
+ else
+ output_base = reloc_target_output_section->vma;
+
+ relocation += output_base + symbol->section->output_offset;
+
+ /* Add in supplied addend. */
+ relocation += reloc_entry->addend;
+
+ /* Here the variable relocation holds the final address of the
+ symbol we are relocating against, plus any addend. */
+ if (output_bfd)
+ {
+ if (!howto->partial_inplace)
+ {
+ /* This is a partial relocation, and we want to apply the relocation
+ to the reloc entry rather than the raw data. Everything except
+ relocations against section symbols has already been handled
+ above. */
+
+ BFD_ASSERT (symbol->flags & BSF_SECTION_SYM);
+ reloc_entry->addend = relocation;
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+ else
+ {
+ reloc_entry->address += input_section->output_offset;
+ reloc_entry->addend = 0;
+ }
+ }
+
+ is_weak_undef = (bfd_is_und_section (symbol->section)
+ && (symbol->flags & BSF_WEAK) != 0);
+ flag = elf_xtensa_do_reloc (howto, abfd, input_section, relocation,
+ (bfd_byte *) data, (bfd_vma) octets,
+ is_weak_undef, error_message);
+
+ if (flag == bfd_reloc_dangerous)
+ {
+ /* Add the symbol name to the error message. */
+ if (! *error_message)
+ *error_message = "";
+ *error_message = vsprint_msg (*error_message, ": (%s + 0x%lx)",
+ strlen (symbol->name) + 17,
+ symbol->name, reloc_entry->addend);
+ }
+
+ return flag;
+}
+
+
+/* Set up an entry in the procedure linkage table. */
+
+static bfd_vma
+elf_xtensa_create_plt_entry (dynobj, output_bfd, reloc_index)
+ bfd *dynobj;
+ bfd *output_bfd;
+ unsigned reloc_index;
+{
+ asection *splt, *sgotplt;
+ bfd_vma plt_base, got_base;
+ bfd_vma code_offset, lit_offset;
+ int chunk;
+
+ chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
+ splt = elf_xtensa_get_plt_section (dynobj, chunk);
+ sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ BFD_ASSERT (splt != NULL && sgotplt != NULL);
+
+ plt_base = splt->output_section->vma + splt->output_offset;
+ got_base = sgotplt->output_section->vma + sgotplt->output_offset;
+
+ lit_offset = 8 + (reloc_index % PLT_ENTRIES_PER_CHUNK) * 4;
+ code_offset = (reloc_index % PLT_ENTRIES_PER_CHUNK) * PLT_ENTRY_SIZE;
+
+ /* Fill in the literal entry. This is the offset of the dynamic
+ relocation entry. */
+ bfd_put_32 (output_bfd, reloc_index * sizeof (Elf32_External_Rela),
+ sgotplt->contents + lit_offset);
+
+ /* Fill in the entry in the procedure linkage table. */
+ memcpy (splt->contents + code_offset,
+ (bfd_big_endian (output_bfd)
+ ? elf_xtensa_be_plt_entry
+ : elf_xtensa_le_plt_entry),
+ PLT_ENTRY_SIZE);
+ bfd_put_16 (output_bfd, l32r_offset (got_base + 0,
+ plt_base + code_offset + 3),
+ splt->contents + code_offset + 4);
+ bfd_put_16 (output_bfd, l32r_offset (got_base + 4,
+ plt_base + code_offset + 6),
+ splt->contents + code_offset + 7);
+ bfd_put_16 (output_bfd, l32r_offset (got_base + lit_offset,
+ plt_base + code_offset + 9),
+ splt->contents + code_offset + 10);
+
+ return plt_base + code_offset;
+}
+
+
+static bfd_boolean
+xtensa_elf_dynamic_symbol_p (info, h)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+{
+ if (h == NULL)
+ return FALSE;
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if (h->dynindx == -1)
+ return FALSE;
+
+ if (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_defweak)
+ return TRUE;
+
+ switch (ELF_ST_VISIBILITY (h->other))
+ {
+ case STV_DEFAULT:
+ break;
+ case STV_HIDDEN:
+ case STV_INTERNAL:
+ return FALSE;
+ case STV_PROTECTED:
+ if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
+ return FALSE;
+ break;
+ }
+
+ if ((info->shared && !info->symbolic)
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+/* Relocate an Xtensa ELF section. This is invoked by the linker for
+ both relocateable and final links. */
+
+static bfd_boolean
+elf_xtensa_relocate_section (output_bfd, info, input_bfd,
+ input_section, contents, relocs,
+ local_syms, local_sections)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents;
+ Elf_Internal_Rela *relocs;
+ Elf_Internal_Sym *local_syms;
+ asection **local_sections;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ struct elf_link_hash_entry **sym_hashes;
+ asection *srelgot, *srelplt;
+ bfd *dynobj;
+ char *error_message = NULL;
+
+ if (xtensa_default_isa == NULL)
+ xtensa_isa_init ();
+
+ dynobj = elf_hash_table (info)->dynobj;
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+
+ srelgot = NULL;
+ srelplt = NULL;
+ if (dynobj != NULL)
+ {
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");;
+ srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ }
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ int r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+ bfd_boolean is_weak_undef;
+ bfd_boolean unresolved_reloc;
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ if (r_type == (int) R_XTENSA_GNU_VTINHERIT
+ || r_type == (int) R_XTENSA_GNU_VTENTRY)
+ continue;
+
+ if (r_type < 0 || r_type >= (int) R_XTENSA_max)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ howto = &elf_howto_table[r_type];
+
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ if (info->relocateable)
+ {
+ /* This is a relocateable link.
+ 1) If the reloc is against a section symbol, adjust
+ according to the output section.
+ 2) If there is a new target for this relocation,
+ the new target will be in the same output section.
+ We adjust the relocation by the output section
+ difference. */
+
+ if (relaxing_section)
+ {
+ /* Check if this references a section in another input file. */
+ do_fix_for_relocateable_link (rel, input_bfd, input_section);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ }
+
+ if (r_type == R_XTENSA_ASM_SIMPLIFY)
+ {
+ /* Convert ASM_SIMPLIFY into the simpler relocation
+ so that they never escape a relaxing link. */
+ contract_asm_expansion (contents, input_section->_raw_size, rel);
+ r_type = ELF32_R_TYPE (rel->r_info);
+ }
+
+ /* This is a relocateable link, so we don't have to change
+ anything unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ sec = local_sections[r_symndx];
+ rel->r_addend += sec->output_offset + sym->st_value;
+ }
+ }
+
+ /* If there is an addend with a partial_inplace howto,
+ then move the addend to the contents. This is a hack
+ to work around problems with DWARF in relocateable links
+ with some previous version of BFD. Now we can't easily get
+ rid of the hack without breaking backward compatibility.... */
+ if (rel->r_addend)
+ {
+ howto = &elf_howto_table[r_type];
+ if (howto->partial_inplace)
+ {
+ r = elf_xtensa_do_reloc (howto, input_bfd, input_section,
+ rel->r_addend, contents,
+ rel->r_offset, FALSE,
+ &error_message);
+ if (r != bfd_reloc_ok)
+ {
+ if (!((*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ }
+ rel->r_addend = 0;
+ }
+ }
+
+ /* Done with work for relocateable link; continue with next reloc. */
+ continue;
+ }
+
+ /* This is a final link. */
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+ is_weak_undef = FALSE;
+ unresolved_reloc = FALSE;
+
+ if (howto->partial_inplace)
+ {
+ /* Because R_XTENSA_32 was made partial_inplace to fix some
+ problems with DWARF info in partial links, there may be
+ an addend stored in the contents. Take it out of there
+ and move it back into the addend field of the reloc. */
+ rel->r_addend += bfd_get_32 (input_bfd, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ relocation = 0;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+
+ if (sec->output_section == NULL)
+ /* Set a flag that will be cleared later if we find a
+ relocation value for this symbol. output_section
+ is typically NULL for symbols satisfied by a shared
+ library. */
+ unresolved_reloc = TRUE;
+ else
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ is_weak_undef = TRUE;
+ else if (info->shared
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ ;
+ else
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset,
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
+ return FALSE;
+
+ /* To avoid any more warning messages, like "call out of
+ range", we continue immediately to the next relocation. */
+ continue;
+ }
+ }
+
+ if (relaxing_section)
+ {
+ /* Check if this references a section in another input file. */
+ do_fix_for_final_link (rel, input_section, &relocation);
+
+ /* Update some already cached values. */
+ r_type = ELF32_R_TYPE (rel->r_info);
+ howto = &elf_howto_table[r_type];
+ }
+
+ /* Sanity check the address. */
+ if (rel->r_offset >= input_section->_raw_size
+ && ELF32_R_TYPE (rel->r_info) != R_XTENSA_NONE)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ /* Generate dynamic relocations. */
+ if (elf_hash_table (info)->dynamic_sections_created)
+ {
+ bfd_boolean dynamic_symbol = xtensa_elf_dynamic_symbol_p (info, h);
+
+ if (dynamic_symbol && (r_type == R_XTENSA_OP0
+ || r_type == R_XTENSA_OP1
+ || r_type == R_XTENSA_OP2))
+ {
+ /* This is an error. The symbol's real value won't be known
+ until runtime and it's likely to be out of range anyway. */
+ const char *name = h->root.root.string;
+ error_message = vsprint_msg ("invalid relocation for dynamic "
+ "symbol", ": %s",
+ strlen (name) + 2, name);
+ if (!((*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ }
+ else if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (dynamic_symbol || info->shared))
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ asection *srel;
+
+ if (dynamic_symbol && r_type == R_XTENSA_PLT)
+ srel = srelplt;
+ else
+ srel = srelgot;
+
+ BFD_ASSERT (srel != NULL);
+
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info,
+ input_section, rel->r_offset);
+
+ if ((outrel.r_offset | 1) == (bfd_vma) -1)
+ memset (&outrel, 0, sizeof outrel);
+ else
+ {
+ outrel.r_offset = (input_section->output_section->vma
+ + input_section->output_offset);
+
+ if (dynamic_symbol)
+ {
+ outrel.r_addend = rel->r_addend;
+ rel->r_addend = 0;
+
+ if (r_type == R_XTENSA_32)
+ {
+ outrel.r_info =
+ ELF32_R_INFO (h->dynindx, R_XTENSA_GLOB_DAT);
+ relocation = 0;
+ }
+ else /* r_type == R_XTENSA_PLT */
+ {
+ outrel.r_info =
+ ELF32_R_INFO (h->dynindx, R_XTENSA_JMP_SLOT);
+
+ /* Create the PLT entry and set the initial
+ contents of the literal entry to the address of
+ the PLT entry. */
+ relocation =
+ elf_xtensa_create_plt_entry (dynobj, output_bfd,
+ srel->reloc_count);
+ }
+ unresolved_reloc = FALSE;
+ }
+ else
+ {
+ /* Generate a RELATIVE relocation. */
+ outrel.r_info = ELF32_R_INFO (0, R_XTENSA_RELATIVE);
+ outrel.r_addend = 0;
+ }
+ }
+
+ loc = (srel->contents
+ + srel->reloc_count++ * sizeof (Elf32_External_Rela));
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+ BFD_ASSERT (sizeof (Elf32_External_Rela) * srel->reloc_count
+ <= srel->_cooked_size);
+ }
+ }
+
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
+ because such sections are not SEC_ALLOC and thus ld.so will
+ not process them. */
+ if (unresolved_reloc
+ && !((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ h->root.root.string);
+
+ /* There's no point in calling bfd_perform_relocation here.
+ Just go directly to our "special function". */
+ r = elf_xtensa_do_reloc (howto, input_bfd, input_section,
+ relocation + rel->r_addend,
+ contents, rel->r_offset, is_weak_undef,
+ &error_message);
+
+ if (r != bfd_reloc_ok)
+ {
+ const char *name;
+
+ BFD_ASSERT (r == bfd_reloc_dangerous);
+ BFD_ASSERT (error_message != (char *) NULL);
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name);
+ if (name && *name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+ if (name)
+ error_message = vsprint_msg (error_message, ": %s",
+ strlen (name), name);
+ if (!((*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section,
+ rel->r_offset)))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/* Finish up dynamic symbol handling. There's not much to do here since
+ the PLT and GOT entries are all set up by relocate_section. */
+
+static bfd_boolean
+elf_xtensa_finish_dynamic_symbol (output_bfd, info, h, sym)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+{
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ /* Mark the symbol as undefined, rather than as defined in
+ the .plt section. Leave the value alone. */
+ sym->st_shndx = SHN_UNDEF;
+ }
+
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ sym->st_shndx = SHN_ABS;
+
+ return TRUE;
+}
+
+
+/* Combine adjacent literal table entries in the output. Adjacent
+ entries within each input section may have been removed during
+ relaxation, but we repeat the process here, even though it's too late
+ to shrink the output section, because it's important to minimize the
+ number of literal table entries to reduce the start-up work for the
+ runtime linker. Returns the number of remaining table entries or -1
+ on error. */
+
+static int
+elf_xtensa_combine_prop_entries (output_bfd, secname)
+ bfd *output_bfd;
+ const char *secname;
+{
+ asection *sec;
+ bfd_byte *contents;
+ property_table_entry *table;
+ bfd_size_type section_size;
+ bfd_vma offset;
+ int n, m, num;
+
+ sec = bfd_get_section_by_name (output_bfd, secname);
+ if (!sec)
+ return -1;
+
+ section_size = (sec->_cooked_size != 0 ? sec->_cooked_size : sec->_raw_size);
+ BFD_ASSERT (section_size % 8 == 0);
+ num = section_size / 8;
+
+ contents = (bfd_byte *) bfd_malloc (section_size);
+ table = (property_table_entry *)
+ bfd_malloc (num * sizeof (property_table_entry));
+ if (contents == 0 || table == 0)
+ return -1;
+
+ /* The ".xt.lit.plt" section has the SEC_IN_MEMORY flag set and this
+ propagates to the output section, where it doesn't really apply and
+ where it breaks the following call to bfd_get_section_contents. */
+ sec->flags &= ~SEC_IN_MEMORY;
+
+ if (! bfd_get_section_contents (output_bfd, sec, contents, 0, section_size))
+ return -1;
+
+ /* There should never be any relocations left at this point, so this
+ is quite a bit easier than what is done during relaxation. */
+
+ /* Copy the raw contents into a property table array and sort it. */
+ offset = 0;
+ for (n = 0; n < num; n++)
+ {
+ table[n].address = bfd_get_32 (output_bfd, &contents[offset]);
+ table[n].size = bfd_get_32 (output_bfd, &contents[offset + 4]);
+ offset += 8;
+ }
+ qsort (table, num, sizeof (property_table_entry), property_table_compare);
+
+ for (n = 0; n < num; n++)
+ {
+ bfd_boolean remove = FALSE;
+
+ if (table[n].size == 0)
+ remove = TRUE;
+ else if (n > 0 &&
+ (table[n-1].address + table[n-1].size == table[n].address))
+ {
+ table[n-1].size += table[n].size;
+ remove = TRUE;
+ }
+
+ if (remove)
+ {
+ for (m = n; m < num - 1; m++)
+ {
+ table[m].address = table[m+1].address;
+ table[m].size = table[m+1].size;
+ }
+
+ n--;
+ num--;
+ }
+ }
+
+ /* Copy the data back to the raw contents. */
+ offset = 0;
+ for (n = 0; n < num; n++)
+ {
+ bfd_put_32 (output_bfd, table[n].address, &contents[offset]);
+ bfd_put_32 (output_bfd, table[n].size, &contents[offset + 4]);
+ offset += 8;
+ }
+
+ /* Clear the removed bytes. */
+ if ((bfd_size_type) (num * 8) < section_size)
+ {
+ memset (&contents[num * 8], 0, section_size - num * 8);
+ sec->_cooked_size = num * 8;
+ }
+
+ if (! bfd_set_section_contents (output_bfd, sec, contents, 0, section_size))
+ return -1;
+
+ free (contents);
+ return num;
+}
+
+
+/* Finish up the dynamic sections. */
+
+static bfd_boolean
+elf_xtensa_finish_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ bfd *dynobj;
+ asection *sdyn, *srelplt, *sgot;
+ Elf32_External_Dyn *dyncon, *dynconend;
+ int num_xtlit_entries;
+
+ if (! elf_hash_table (info)->dynamic_sections_created)
+ return TRUE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ BFD_ASSERT (sdyn != NULL);
+
+ /* Set the first entry in the global offset table to the address of
+ the dynamic section. */
+ sgot = bfd_get_section_by_name (dynobj, ".got");
+ if (sgot)
+ {
+ BFD_ASSERT (sgot->_raw_size == 4);
+ if (sdyn == NULL)
+ bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
+ else
+ bfd_put_32 (output_bfd,
+ sdyn->output_section->vma + sdyn->output_offset,
+ sgot->contents);
+ }
+
+ srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ if (srelplt != NULL && srelplt->_raw_size != 0)
+ {
+ asection *sgotplt, *srelgot, *spltlittbl;
+ int chunk, plt_chunks, plt_entries;
+ Elf_Internal_Rela irela;
+ bfd_byte *loc;
+ unsigned rtld_reloc;
+
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");;
+ BFD_ASSERT (srelgot != NULL);
+
+ spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt");
+ BFD_ASSERT (spltlittbl != NULL);
+
+ /* Find the first XTENSA_RTLD relocation. Presumably the rest
+ of them follow immediately after.... */
+ for (rtld_reloc = 0; rtld_reloc < srelgot->reloc_count; rtld_reloc++)
+ {
+ loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &irela);
+ if (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD)
+ break;
+ }
+ BFD_ASSERT (rtld_reloc < srelgot->reloc_count);
+
+ plt_entries = (srelplt->_raw_size / sizeof (Elf32_External_Rela));
+ plt_chunks =
+ (plt_entries + PLT_ENTRIES_PER_CHUNK - 1) / PLT_ENTRIES_PER_CHUNK;
+
+ for (chunk = 0; chunk < plt_chunks; chunk++)
+ {
+ int chunk_entries = 0;
+
+ sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ BFD_ASSERT (sgotplt != NULL);
+
+ /* Emit special RTLD relocations for the first two entries in
+ each chunk of the .got.plt section. */
+
+ loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &irela);
+ BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD);
+ irela.r_offset = (sgotplt->output_section->vma
+ + sgotplt->output_offset);
+ irela.r_addend = 1; /* tell rtld to set value to resolver function */
+ bfd_elf32_swap_reloca_out (output_bfd, &irela, loc);
+ rtld_reloc += 1;
+ BFD_ASSERT (rtld_reloc <= srelgot->reloc_count);
+
+ /* Next literal immediately follows the first. */
+ loc += sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_in (output_bfd, loc, &irela);
+ BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD);
+ irela.r_offset = (sgotplt->output_section->vma
+ + sgotplt->output_offset + 4);
+ /* Tell rtld to set value to object's link map. */
+ irela.r_addend = 2;
+ bfd_elf32_swap_reloca_out (output_bfd, &irela, loc);
+ rtld_reloc += 1;
+ BFD_ASSERT (rtld_reloc <= srelgot->reloc_count);
+
+ /* Fill in the literal table. */
+ if (chunk < plt_chunks - 1)
+ chunk_entries = PLT_ENTRIES_PER_CHUNK;
+ else
+ chunk_entries = plt_entries - (chunk * PLT_ENTRIES_PER_CHUNK);
+
+ BFD_ASSERT ((unsigned) (chunk + 1) * 8 <= spltlittbl->_cooked_size);
+ bfd_put_32 (output_bfd,
+ sgotplt->output_section->vma + sgotplt->output_offset,
+ spltlittbl->contents + (chunk * 8) + 0);
+ bfd_put_32 (output_bfd,
+ 8 + (chunk_entries * 4),
+ spltlittbl->contents + (chunk * 8) + 4);
+ }
+
+ /* All the dynamic relocations have been emitted at this point.
+ Make sure the relocation sections are the correct size. */
+ if (srelgot->_cooked_size != (sizeof (Elf32_External_Rela)
+ * srelgot->reloc_count)
+ || srelplt->_cooked_size != (sizeof (Elf32_External_Rela)
+ * srelplt->reloc_count))
+ abort ();
+
+ /* The .xt.lit.plt section has just been modified. This must
+ happen before the code below which combines adjacent literal
+ table entries, and the .xt.lit.plt contents have to be forced to
+ the output here. */
+ if (! bfd_set_section_contents (output_bfd,
+ spltlittbl->output_section,
+ spltlittbl->contents,
+ spltlittbl->output_offset,
+ spltlittbl->_raw_size))
+ return FALSE;
+ /* Clear SEC_HAS_CONTENTS so the contents won't be output again. */
+ spltlittbl->flags &= ~SEC_HAS_CONTENTS;
+ }
+
+ /* Combine adjacent literal table entries. */
+ BFD_ASSERT (! info->relocateable);
+ num_xtlit_entries = elf_xtensa_combine_prop_entries (output_bfd, ".xt.lit");
+ if (num_xtlit_entries < 0)
+ return FALSE;
+
+ dyncon = (Elf32_External_Dyn *) sdyn->contents;
+ dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ for (; dyncon < dynconend; dyncon++)
+ {
+ Elf_Internal_Dyn dyn;
+ const char *name;
+ asection *s;
+
+ bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+ switch (dyn.d_tag)
+ {
+ default:
+ break;
+
+ case DT_XTENSA_GOT_LOC_SZ:
+ s = bfd_get_section_by_name (output_bfd, ".xt.lit");
+ BFD_ASSERT (s);
+ dyn.d_un.d_val = num_xtlit_entries;
+ break;
+
+ case DT_XTENSA_GOT_LOC_OFF:
+ name = ".xt.lit";
+ goto get_vma;
+ case DT_PLTGOT:
+ name = ".got";
+ goto get_vma;
+ case DT_JMPREL:
+ name = ".rela.plt";
+ get_vma:
+ s = bfd_get_section_by_name (output_bfd, name);
+ BFD_ASSERT (s);
+ dyn.d_un.d_ptr = s->vma;
+ break;
+
+ case DT_PLTRELSZ:
+ s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+ BFD_ASSERT (s);
+ dyn.d_un.d_val = (s->_cooked_size ? s->_cooked_size : s->_raw_size);
+ break;
+
+ case DT_RELASZ:
+ /* Adjust RELASZ to not include JMPREL. This matches what
+ glibc expects and what is done for several other ELF
+ targets (e.g., i386, alpha), but the "correct" behavior
+ seems to be unresolved. Since the linker script arranges
+ for .rela.plt to follow all other relocation sections, we
+ don't have to worry about changing the DT_RELA entry. */
+ s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+ if (s)
+ {
+ dyn.d_un.d_val -=
+ (s->_cooked_size ? s->_cooked_size : s->_raw_size);
+ }
+ break;
+ }
+
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+
+ return TRUE;
+}
+
+
+/* Functions for dealing with the e_flags field. */
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bfd_boolean
+elf_xtensa_merge_private_bfd_data (ibfd, obfd)
+ bfd *ibfd;
+ bfd *obfd;
+{
+ unsigned out_mach, in_mach;
+ flagword out_flag, in_flag;
+
+ /* Check if we have the same endianess. */
+ if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ return FALSE;
+
+ /* Don't even pretend to support mixed-format linking. */
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return FALSE;
+
+ out_flag = elf_elfheader (obfd)->e_flags;
+ in_flag = elf_elfheader (ibfd)->e_flags;
+
+ out_mach = out_flag & EF_XTENSA_MACH;
+ in_mach = in_flag & EF_XTENSA_MACH;
+ if (out_mach != in_mach)
+ {
+ (*_bfd_error_handler)
+ ("%s: incompatible machine type. Output is 0x%x. Input is 0x%x\n",
+ bfd_archive_filename (ibfd), out_mach, in_mach);
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
+
+ if (! elf_flags_init (obfd))
+ {
+ elf_flags_init (obfd) = TRUE;
+ elf_elfheader (obfd)->e_flags = in_flag;
+
+ if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
+ && bfd_get_arch_info (obfd)->the_default)
+ return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
+ bfd_get_mach (ibfd));
+
+ return TRUE;
+ }
+
+ if ((out_flag & EF_XTENSA_XT_INSN) !=
+ (in_flag & EF_XTENSA_XT_INSN))
+ elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_INSN);
+
+ if ((out_flag & EF_XTENSA_XT_LIT) !=
+ (in_flag & EF_XTENSA_XT_LIT))
+ elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_LIT);
+
+ return TRUE;
+}
+
+
+static bfd_boolean
+elf_xtensa_set_private_flags (abfd, flags)
+ bfd *abfd;
+ flagword flags;
+{
+ BFD_ASSERT (!elf_flags_init (abfd)
+ || elf_elfheader (abfd)->e_flags == flags);
+
+ elf_elfheader (abfd)->e_flags |= flags;
+ elf_flags_init (abfd) = TRUE;
+
+ return TRUE;
+}
+
+
+extern flagword
+elf_xtensa_get_private_bfd_flags (abfd)
+ bfd *abfd;
+{
+ return elf_elfheader (abfd)->e_flags;
+}
+
+
+static bfd_boolean
+elf_xtensa_print_private_bfd_data (abfd, farg)
+ bfd *abfd;
+ PTR farg;
+{
+ FILE *f = (FILE *) farg;
+ flagword e_flags = elf_elfheader (abfd)->e_flags;
+
+ fprintf (f, "\nXtensa header:\n");
+ if ((e_flags & EF_XTENSA_MACH) == E_XTENSA_MACH)
+ fprintf (f, "\nMachine = Base\n");
+ else
+ fprintf (f, "\nMachine Id = 0x%x\n", e_flags & EF_XTENSA_MACH);
+
+ fprintf (f, "Insn tables = %s\n",
+ (e_flags & EF_XTENSA_XT_INSN) ? "true" : "false");
+
+ fprintf (f, "Literal tables = %s\n",
+ (e_flags & EF_XTENSA_XT_LIT) ? "true" : "false");
+
+ return _bfd_elf_print_private_bfd_data (abfd, farg);
+}
+
+
+/* Set the right machine number for an Xtensa ELF file. */
+
+static bfd_boolean
+elf_xtensa_object_p (abfd)
+ bfd *abfd;
+{
+ int mach;
+ unsigned long arch = elf_elfheader (abfd)->e_flags & EF_XTENSA_MACH;
+
+ switch (arch)
+ {
+ case E_XTENSA_MACH:
+ mach = bfd_mach_xtensa;
+ break;
+ default:
+ return FALSE;
+ }
+
+ (void) bfd_default_set_arch_mach (abfd, bfd_arch_xtensa, mach);
+ return TRUE;
+}
+
+
+/* The final processing done just before writing out an Xtensa ELF object
+ file. This gets the Xtensa architecture right based on the machine
+ number. */
+
+static void
+elf_xtensa_final_write_processing (abfd, linker)
+ bfd *abfd;
+ bfd_boolean linker ATTRIBUTE_UNUSED;
+{
+ int mach;
+ unsigned long val;
+
+ switch (mach = bfd_get_mach (abfd))
+ {
+ case bfd_mach_xtensa:
+ val = E_XTENSA_MACH;
+ break;
+ default:
+ return;
+ }
+
+ elf_elfheader (abfd)->e_flags &= (~ EF_XTENSA_MACH);
+ elf_elfheader (abfd)->e_flags |= val;
+}
+
+
+static enum elf_reloc_type_class
+elf_xtensa_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_XTENSA_RELATIVE:
+ return reloc_class_relative;
+ case R_XTENSA_JMP_SLOT:
+ return reloc_class_plt;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+
+static bfd_boolean
+elf_xtensa_discard_info_for_section (abfd, cookie, info, sec)
+ bfd *abfd;
+ struct elf_reloc_cookie *cookie;
+ struct bfd_link_info *info;
+ asection *sec;
+{
+ bfd_byte *contents;
+ bfd_vma section_size;
+ bfd_vma offset, actual_offset;
+ size_t removed_bytes = 0;
+
+ section_size = (sec->_cooked_size ? sec->_cooked_size : sec->_raw_size);
+ if (section_size == 0 || section_size % 8 != 0)
+ return FALSE;
+
+ if (sec->output_section
+ && bfd_is_abs_section (sec->output_section))
+ return FALSE;
+
+ contents = retrieve_contents (abfd, sec, info->keep_memory);
+ if (!contents)
+ return FALSE;
+
+ cookie->rels = retrieve_internal_relocs (abfd, sec, info->keep_memory);
+ if (!cookie->rels)
+ {
+ release_contents (sec, contents);
+ return FALSE;
+ }
+
+ cookie->rel = cookie->rels;
+ cookie->relend = cookie->rels + sec->reloc_count;
+
+ for (offset = 0; offset < section_size; offset += 8)
+ {
+ actual_offset = offset - removed_bytes;
+
+ /* The ...symbol_deleted_p function will skip over relocs but it
+ won't adjust their offsets, so do that here. */
+ while (cookie->rel < cookie->relend
+ && cookie->rel->r_offset < offset)
+ {
+ cookie->rel->r_offset -= removed_bytes;
+ cookie->rel++;
+ }
+
+ while (cookie->rel < cookie->relend
+ && cookie->rel->r_offset == offset)
+ {
+ if (_bfd_elf32_reloc_symbol_deleted_p (offset, cookie))
+ {
+ /* Remove the table entry. (If the reloc type is NONE, then
+ the entry has already been merged with another and deleted
+ during relaxation.) */
+ if (ELF32_R_TYPE (cookie->rel->r_info) != R_XTENSA_NONE)
+ {
+ /* Shift the contents up. */
+ if (offset + 8 < section_size)
+ memmove (&contents[actual_offset],
+ &contents[actual_offset+8],
+ section_size - offset - 8);
+ removed_bytes += 8;
+ }
+
+ /* Remove this relocation. */
+ cookie->rel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ }
+
+ /* Adjust the relocation offset for previous removals. This
+ should not be done before calling ...symbol_deleted_p
+ because it might mess up the offset comparisons there.
+ Make sure the offset doesn't underflow in the case where
+ the first entry is removed. */
+ if (cookie->rel->r_offset >= removed_bytes)
+ cookie->rel->r_offset -= removed_bytes;
+ else
+ cookie->rel->r_offset = 0;
+
+ cookie->rel++;
+ }
+ }
+
+ if (removed_bytes != 0)
+ {
+ /* Adjust any remaining relocs (shouldn't be any). */
+ for (; cookie->rel < cookie->relend; cookie->rel++)
+ {
+ if (cookie->rel->r_offset >= removed_bytes)
+ cookie->rel->r_offset -= removed_bytes;
+ else
+ cookie->rel->r_offset = 0;
+ }
+
+ /* Clear the removed bytes. */
+ memset (&contents[section_size - removed_bytes], 0, removed_bytes);
+
+ pin_contents (sec, contents);
+ pin_internal_relocs (sec, cookie->rels);
+
+ sec->_cooked_size = section_size - removed_bytes;
+ /* Also shrink _raw_size. See comments in relax_property_section. */
+ sec->_raw_size = sec->_cooked_size;
+ }
+ else
+ {
+ release_contents (sec, contents);
+ release_internal_relocs (sec, cookie->rels);
+ }
+
+ return (removed_bytes != 0);
+}
+
+
+static bfd_boolean
+elf_xtensa_discard_info (abfd, cookie, info)
+ bfd *abfd;
+ struct elf_reloc_cookie *cookie;
+ struct bfd_link_info *info;
+{
+ asection *sec;
+ bfd_boolean changed = FALSE;
+
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (xtensa_is_property_section (sec))
+ {
+ if (elf_xtensa_discard_info_for_section (abfd, cookie, info, sec))
+ changed = TRUE;
+ }
+ }
+
+ return changed;
+}
+
+
+static bfd_boolean
+elf_xtensa_ignore_discarded_relocs (sec)
+ asection *sec;
+{
+ return xtensa_is_property_section (sec);
+}
+
+
+/* Support for core dump NOTE sections. */
+
+static bfd_boolean
+elf_xtensa_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ unsigned int raw_size;
+
+ /* The size for Xtensa is variable, so don't try to recognize the format
+ based on the size. Just assume this is GNU/Linux. */
+
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = note->descsz - offset - 4;
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+
+static bfd_boolean
+elf_xtensa_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return FALSE;
+
+ case 128: /* GNU/Linux elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return TRUE;
+}
+
+
+/* Generic Xtensa configurability stuff. */
+
+static xtensa_opcode callx0_op = XTENSA_UNDEFINED;
+static xtensa_opcode callx4_op = XTENSA_UNDEFINED;
+static xtensa_opcode callx8_op = XTENSA_UNDEFINED;
+static xtensa_opcode callx12_op = XTENSA_UNDEFINED;
+static xtensa_opcode call0_op = XTENSA_UNDEFINED;
+static xtensa_opcode call4_op = XTENSA_UNDEFINED;
+static xtensa_opcode call8_op = XTENSA_UNDEFINED;
+static xtensa_opcode call12_op = XTENSA_UNDEFINED;
+
+static void
+init_call_opcodes ()
+{
+ if (callx0_op == XTENSA_UNDEFINED)
+ {
+ callx0_op = xtensa_opcode_lookup (xtensa_default_isa, "callx0");
+ callx4_op = xtensa_opcode_lookup (xtensa_default_isa, "callx4");
+ callx8_op = xtensa_opcode_lookup (xtensa_default_isa, "callx8");
+ callx12_op = xtensa_opcode_lookup (xtensa_default_isa, "callx12");
+ call0_op = xtensa_opcode_lookup (xtensa_default_isa, "call0");
+ call4_op = xtensa_opcode_lookup (xtensa_default_isa, "call4");
+ call8_op = xtensa_opcode_lookup (xtensa_default_isa, "call8");
+ call12_op = xtensa_opcode_lookup (xtensa_default_isa, "call12");
+ }
+}
+
+
+static bfd_boolean
+is_indirect_call_opcode (opcode)
+ xtensa_opcode opcode;
+{
+ init_call_opcodes ();
+ return (opcode == callx0_op
+ || opcode == callx4_op
+ || opcode == callx8_op
+ || opcode == callx12_op);
+}
+
+
+static bfd_boolean
+is_direct_call_opcode (opcode)
+ xtensa_opcode opcode;
+{
+ init_call_opcodes ();
+ return (opcode == call0_op
+ || opcode == call4_op
+ || opcode == call8_op
+ || opcode == call12_op);
+}
+
+
+static bfd_boolean
+is_windowed_call_opcode (opcode)
+ xtensa_opcode opcode;
+{
+ init_call_opcodes ();
+ return (opcode == call4_op
+ || opcode == call8_op
+ || opcode == call12_op
+ || opcode == callx4_op
+ || opcode == callx8_op
+ || opcode == callx12_op);
+}
+
+
+static xtensa_opcode
+get_l32r_opcode (void)
+{
+ static xtensa_opcode l32r_opcode = XTENSA_UNDEFINED;
+ if (l32r_opcode == XTENSA_UNDEFINED)
+ {
+ l32r_opcode = xtensa_opcode_lookup (xtensa_default_isa, "l32r");
+ BFD_ASSERT (l32r_opcode != XTENSA_UNDEFINED);
+ }
+ return l32r_opcode;
+}
+
+
+static bfd_vma
+l32r_offset (addr, pc)
+ bfd_vma addr;
+ bfd_vma pc;
+{
+ bfd_vma offset;
+
+ offset = addr - ((pc+3) & -4);
+ BFD_ASSERT ((offset & ((1 << 2) - 1)) == 0);
+ offset = (signed int) offset >> 2;
+ BFD_ASSERT ((signed int) offset >> 16 == -1);
+ return offset;
+}
+
+
+/* Get the operand number for a PC-relative relocation.
+ If the relocation is not a PC-relative one, return (-1). */
+
+static int
+get_relocation_opnd (irel)
+ Elf_Internal_Rela *irel;
+{
+ if (ELF32_R_TYPE (irel->r_info) < R_XTENSA_OP0
+ || ELF32_R_TYPE (irel->r_info) >= R_XTENSA_max)
+ return -1;
+ return ELF32_R_TYPE (irel->r_info) - R_XTENSA_OP0;
+}
+
+
+/* Get the opcode for a relocation. */
+
+static xtensa_opcode
+get_relocation_opcode (sec, contents, irel)
+ asection *sec;
+ bfd_byte *contents;
+ Elf_Internal_Rela *irel;
+{
+ static xtensa_insnbuf ibuff = NULL;
+ xtensa_isa isa = xtensa_default_isa;
+
+ if (get_relocation_opnd (irel) == -1)
+ return XTENSA_UNDEFINED;
+
+ if (contents == NULL)
+ return XTENSA_UNDEFINED;
+
+ if (sec->_raw_size <= irel->r_offset)
+ return XTENSA_UNDEFINED;
+
+ if (ibuff == NULL)
+ ibuff = xtensa_insnbuf_alloc (isa);
+
+ /* Decode the instruction. */
+ xtensa_insnbuf_from_chars (isa, ibuff, &contents[irel->r_offset]);
+ return xtensa_decode_insn (isa, ibuff);
+}
+
+
+bfd_boolean
+is_l32r_relocation (sec, contents, irel)
+ asection *sec;
+ bfd_byte *contents;
+ Elf_Internal_Rela *irel;
+{
+ xtensa_opcode opcode;
+
+ if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_OP1)
+ return FALSE;
+
+ opcode = get_relocation_opcode (sec, contents, irel);
+ return (opcode == get_l32r_opcode ());
+}
+
+
+/* Code for transforming CALLs at link-time. */
+
+static bfd_reloc_status_type
+elf_xtensa_do_asm_simplify (contents, address, content_length)
+ bfd_byte *contents;
+ bfd_vma address;
+ bfd_vma content_length;
+{
+ static xtensa_insnbuf insnbuf = NULL;
+ xtensa_opcode opcode;
+ xtensa_operand operand;
+ xtensa_opcode direct_call_opcode;
+ xtensa_isa isa = xtensa_default_isa;
+ bfd_byte *chbuf = contents + address;
+ int opn;
+
+ if (insnbuf == NULL)
+ insnbuf = xtensa_insnbuf_alloc (isa);
+
+ if (content_length < address)
+ {
+ (*_bfd_error_handler)
+ ("Attempt to convert L32R/CALLX to CALL failed\n");
+ return bfd_reloc_other;
+ }
+
+ opcode = get_expanded_call_opcode (chbuf, content_length - address);
+ direct_call_opcode = swap_callx_for_call_opcode (opcode);
+ if (direct_call_opcode == XTENSA_UNDEFINED)
+ {
+ (*_bfd_error_handler)
+ ("Attempt to convert L32R/CALLX to CALL failed\n");
+ return bfd_reloc_other;
+ }
+
+ /* Assemble a NOP ("or a1, a1, a1") into the 0 byte offset. */
+ opcode = xtensa_opcode_lookup (isa, "or");
+ xtensa_encode_insn (isa, opcode, insnbuf);
+ for (opn = 0; opn < 3; opn++)
+ {
+ operand = xtensa_get_operand (isa, opcode, opn);
+ xtensa_operand_set_field (operand, insnbuf, 1);
+ }
+ xtensa_insnbuf_to_chars (isa, insnbuf, chbuf);
+
+ /* Assemble a CALL ("callN 0") into the 3 byte offset. */
+ xtensa_encode_insn (isa, direct_call_opcode, insnbuf);
+ operand = xtensa_get_operand (isa, opcode, 0);
+ xtensa_operand_set_field (operand, insnbuf, 0);
+ xtensa_insnbuf_to_chars (isa, insnbuf, chbuf + 3);
+
+ return bfd_reloc_ok;
+}
+
+
+static bfd_reloc_status_type
+contract_asm_expansion (contents, content_length, irel)
+ bfd_byte *contents;
+ bfd_vma content_length;
+ Elf_Internal_Rela *irel;
+{
+ bfd_reloc_status_type retval =
+ elf_xtensa_do_asm_simplify (contents, irel->r_offset, content_length);
+
+ if (retval != bfd_reloc_ok)
+ return retval;
+
+ /* Update the irel->r_offset field so that the right immediate and
+ the right instruction are modified during the relocation. */
+ irel->r_offset += 3;
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_XTENSA_OP0);
+ return bfd_reloc_ok;
+}
+
+
+static xtensa_opcode
+swap_callx_for_call_opcode (opcode)
+ xtensa_opcode opcode;
+{
+ init_call_opcodes ();
+
+ if (opcode == callx0_op) return call0_op;
+ if (opcode == callx4_op) return call4_op;
+ if (opcode == callx8_op) return call8_op;
+ if (opcode == callx12_op) return call12_op;
+
+ /* Return XTENSA_UNDEFINED if the opcode is not an indirect call. */
+ return XTENSA_UNDEFINED;
+}
+
+
+/* Check if "buf" is pointing to a "L32R aN; CALLX aN" sequence, and
+ if so, return the CALLX opcode. If not, return XTENSA_UNDEFINED. */
+
+#define L32R_TARGET_REG_OPERAND 0
+#define CALLN_SOURCE_OPERAND 0
+
+static xtensa_opcode
+get_expanded_call_opcode (buf, bufsize)
+ bfd_byte *buf;
+ int bufsize;
+{
+ static xtensa_insnbuf insnbuf = NULL;
+ xtensa_opcode opcode;
+ xtensa_operand operand;
+ xtensa_isa isa = xtensa_default_isa;
+ uint32 regno, call_regno;
+
+ /* Buffer must be at least 6 bytes. */
+ if (bufsize < 6)
+ return XTENSA_UNDEFINED;
+
+ if (insnbuf == NULL)
+ insnbuf = xtensa_insnbuf_alloc (isa);
+
+ xtensa_insnbuf_from_chars (isa, insnbuf, buf);
+ opcode = xtensa_decode_insn (isa, insnbuf);
+
+ if (opcode != get_l32r_opcode ())
+ return XTENSA_UNDEFINED;
+
+ operand = xtensa_get_operand (isa, opcode, L32R_TARGET_REG_OPERAND);
+ regno = xtensa_operand_decode
+ (operand, xtensa_operand_get_field (operand, insnbuf));
+
+ /* Next instruction should be an CALLXn with operand 0 == regno. */
+ xtensa_insnbuf_from_chars (isa, insnbuf,
+ buf + xtensa_insn_length (isa, opcode));
+ opcode = xtensa_decode_insn (isa, insnbuf);
+
+ if (!is_indirect_call_opcode (opcode))
+ return XTENSA_UNDEFINED;
+
+ operand = xtensa_get_operand (isa, opcode, CALLN_SOURCE_OPERAND);
+ call_regno = xtensa_operand_decode
+ (operand, xtensa_operand_get_field (operand, insnbuf));
+ if (call_regno != regno)
+ return XTENSA_UNDEFINED;
+
+ return opcode;
+}
+
+
+/* Data structures used during relaxation. */
+
+/* r_reloc: relocation values. */
+
+/* Through the relaxation process, we need to keep track of the values
+ that will result from evaluating relocations. The standard ELF
+ relocation structure is not sufficient for this purpose because we're
+ operating on multiple input files at once, so we need to know which
+ input file a relocation refers to. The r_reloc structure thus
+ records both the input file (bfd) and ELF relocation.
+
+ For efficiency, an r_reloc also contains a "target_offset" field to
+ cache the target-section-relative offset value that is represented by
+ the relocation. */
+
+typedef struct r_reloc_struct r_reloc;
+
+struct r_reloc_struct
+{
+ bfd *abfd;
+ Elf_Internal_Rela rela;
+ bfd_vma target_offset;
+};
+
+static bfd_boolean r_reloc_is_const
+ PARAMS ((const r_reloc *));
+static void r_reloc_init
+ PARAMS ((r_reloc *, bfd *, Elf_Internal_Rela *));
+static bfd_vma r_reloc_get_target_offset
+ PARAMS ((const r_reloc *));
+static asection *r_reloc_get_section
+ PARAMS ((const r_reloc *));
+static bfd_boolean r_reloc_is_defined
+ PARAMS ((const r_reloc *));
+static struct elf_link_hash_entry *r_reloc_get_hash_entry
+ PARAMS ((const r_reloc *));
+
+
+/* The r_reloc structure is included by value in literal_value, but not
+ every literal_value has an associated relocation -- some are simple
+ constants. In such cases, we set all the fields in the r_reloc
+ struct to zero. The r_reloc_is_const function should be used to
+ detect this case. */
+
+static bfd_boolean
+r_reloc_is_const (r_rel)
+ const r_reloc *r_rel;
+{
+ return (r_rel->abfd == NULL);
+}
+
+
+static void
+r_reloc_init (r_rel, abfd, irel)
+ r_reloc *r_rel;
+ bfd *abfd;
+ Elf_Internal_Rela *irel;
+{
+ if (irel != NULL)
+ {
+ r_rel->rela = *irel;
+ r_rel->abfd = abfd;
+ r_rel->target_offset = r_reloc_get_target_offset (r_rel);
+ }
+ else
+ memset (r_rel, 0, sizeof (r_reloc));
+}
+
+
+static bfd_vma
+r_reloc_get_target_offset (r_rel)
+ const r_reloc *r_rel;
+{
+ bfd_vma target_offset;
+ unsigned long r_symndx;
+
+ BFD_ASSERT (!r_reloc_is_const (r_rel));
+ r_symndx = ELF32_R_SYM (r_rel->rela.r_info);
+ target_offset = get_elf_r_symndx_offset (r_rel->abfd, r_symndx);
+ return (target_offset + r_rel->rela.r_addend);
+}
+
+
+static struct elf_link_hash_entry *
+r_reloc_get_hash_entry (r_rel)
+ const r_reloc *r_rel;
+{
+ unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info);
+ return get_elf_r_symndx_hash_entry (r_rel->abfd, r_symndx);
+}
+
+
+static asection *
+r_reloc_get_section (r_rel)
+ const r_reloc *r_rel;
+{
+ unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info);
+ return get_elf_r_symndx_section (r_rel->abfd, r_symndx);
+}
+
+
+static bfd_boolean
+r_reloc_is_defined (r_rel)
+ const r_reloc *r_rel;
+{
+ asection *sec = r_reloc_get_section (r_rel);
+ if (sec == bfd_abs_section_ptr
+ || sec == bfd_com_section_ptr
+ || sec == bfd_und_section_ptr)
+ return FALSE;
+ return TRUE;
+}
+
+
+/* source_reloc: relocations that reference literal sections. */
+
+/* To determine whether literals can be coalesced, we need to first
+ record all the relocations that reference the literals. The
+ source_reloc structure below is used for this purpose. The
+ source_reloc entries are kept in a per-literal-section array, sorted
+ by offset within the literal section (i.e., target offset).
+
+ The source_sec and r_rel.rela.r_offset fields identify the source of
+ the relocation. The r_rel field records the relocation value, i.e.,
+ the offset of the literal being referenced. The opnd field is needed
+ to determine the range of the immediate field to which the relocation
+ applies, so we can determine whether another literal with the same
+ value is within range. The is_null field is true when the relocation
+ is being removed (e.g., when an L32R is being removed due to a CALLX
+ that is converted to a direct CALL). */
+
+typedef struct source_reloc_struct source_reloc;
+
+struct source_reloc_struct
+{
+ asection *source_sec;
+ r_reloc r_rel;
+ xtensa_operand opnd;
+ bfd_boolean is_null;
+};
+
+
+static void init_source_reloc
+ PARAMS ((source_reloc *, asection *, const r_reloc *, xtensa_operand));
+static source_reloc *find_source_reloc
+ PARAMS ((source_reloc *, int, asection *, Elf_Internal_Rela *));
+static int source_reloc_compare
+ PARAMS ((const PTR, const PTR));
+
+
+static void
+init_source_reloc (reloc, source_sec, r_rel, opnd)
+ source_reloc *reloc;
+ asection *source_sec;
+ const r_reloc *r_rel;
+ xtensa_operand opnd;
+{
+ reloc->source_sec = source_sec;
+ reloc->r_rel = *r_rel;
+ reloc->opnd = opnd;
+ reloc->is_null = FALSE;
+}
+
+
+/* Find the source_reloc for a particular source offset and relocation
+ type. Note that the array is sorted by _target_ offset, so this is
+ just a linear search. */
+
+static source_reloc *
+find_source_reloc (src_relocs, src_count, sec, irel)
+ source_reloc *src_relocs;
+ int src_count;
+ asection *sec;
+ Elf_Internal_Rela *irel;
+{
+ int i;
+
+ for (i = 0; i < src_count; i++)
+ {
+ if (src_relocs[i].source_sec == sec
+ && src_relocs[i].r_rel.rela.r_offset == irel->r_offset
+ && (ELF32_R_TYPE (src_relocs[i].r_rel.rela.r_info)
+ == ELF32_R_TYPE (irel->r_info)))
+ return &src_relocs[i];
+ }
+
+ return NULL;
+}
+
+
+static int
+source_reloc_compare (ap, bp)
+ const PTR ap;
+ const PTR bp;
+{
+ const source_reloc *a = (const source_reloc *) ap;
+ const source_reloc *b = (const source_reloc *) bp;
+
+ return (a->r_rel.target_offset - b->r_rel.target_offset);
+}
+
+
+/* Literal values and value hash tables. */
+
+/* Literals with the same value can be coalesced. The literal_value
+ structure records the value of a literal: the "r_rel" field holds the
+ information from the relocation on the literal (if there is one) and
+ the "value" field holds the contents of the literal word itself.
+
+ The value_map structure records a literal value along with the
+ location of a literal holding that value. The value_map hash table
+ is indexed by the literal value, so that we can quickly check if a
+ particular literal value has been seen before and is thus a candidate
+ for coalescing. */
+
+typedef struct literal_value_struct literal_value;
+typedef struct value_map_struct value_map;
+typedef struct value_map_hash_table_struct value_map_hash_table;
+
+struct literal_value_struct
+{
+ r_reloc r_rel;
+ unsigned long value;
+};
+
+struct value_map_struct
+{
+ literal_value val; /* The literal value. */
+ r_reloc loc; /* Location of the literal. */
+ value_map *next;
+};
+
+struct value_map_hash_table_struct
+{
+ unsigned bucket_count;
+ value_map **buckets;
+ unsigned count;
+};
+
+
+static bfd_boolean is_same_value
+ PARAMS ((const literal_value *, const literal_value *));
+static value_map_hash_table *value_map_hash_table_init
+ PARAMS ((void));
+static unsigned hash_literal_value
+ PARAMS ((const literal_value *));
+static unsigned hash_bfd_vma
+ PARAMS ((bfd_vma));
+static value_map *get_cached_value
+ PARAMS ((value_map_hash_table *, const literal_value *));
+static value_map *add_value_map
+ PARAMS ((value_map_hash_table *, const literal_value *, const r_reloc *));
+
+
+static bfd_boolean
+is_same_value (src1, src2)
+ const literal_value *src1;
+ const literal_value *src2;
+{
+ if (r_reloc_is_const (&src1->r_rel) != r_reloc_is_const (&src2->r_rel))
+ return FALSE;
+
+ if (r_reloc_is_const (&src1->r_rel))
+ return (src1->value == src2->value);
+
+ if (ELF32_R_TYPE (src1->r_rel.rela.r_info)
+ != ELF32_R_TYPE (src2->r_rel.rela.r_info))
+ return FALSE;
+
+ if (r_reloc_get_target_offset (&src1->r_rel)
+ != r_reloc_get_target_offset (&src2->r_rel))
+ return FALSE;
+
+ if (src1->value != src2->value)
+ return FALSE;
+
+ /* Now check for the same section and the same elf_hash. */
+ if (r_reloc_is_defined (&src1->r_rel))
+ {
+ if (r_reloc_get_section (&src1->r_rel)
+ != r_reloc_get_section (&src2->r_rel))
+ return FALSE;
+ }
+ else
+ {
+ if (r_reloc_get_hash_entry (&src1->r_rel)
+ != r_reloc_get_hash_entry (&src2->r_rel))
+ return FALSE;
+
+ if (r_reloc_get_hash_entry (&src1->r_rel) == 0)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Must be power of 2. */
+#define INITIAL_HASH_RELOC_BUCKET_COUNT 1024
+
+static value_map_hash_table *
+value_map_hash_table_init ()
+{
+ value_map_hash_table *values;
+
+ values = (value_map_hash_table *)
+ bfd_malloc (sizeof (value_map_hash_table));
+
+ values->bucket_count = INITIAL_HASH_RELOC_BUCKET_COUNT;
+ values->count = 0;
+ values->buckets = (value_map **)
+ bfd_zmalloc (sizeof (value_map *) * values->bucket_count);
+
+ return values;
+}
+
+
+static unsigned
+hash_bfd_vma (val)
+ bfd_vma val;
+{
+ return (val >> 2) + (val >> 10);
+}
+
+
+static unsigned
+hash_literal_value (src)
+ const literal_value *src;
+{
+ unsigned hash_val;
+ if (r_reloc_is_const (&src->r_rel))
+ return hash_bfd_vma (src->value);
+
+ hash_val = (hash_bfd_vma (r_reloc_get_target_offset (&src->r_rel))
+ + hash_bfd_vma (src->value));
+
+ /* Now check for the same section and the same elf_hash. */
+ if (r_reloc_is_defined (&src->r_rel))
+ hash_val += hash_bfd_vma ((bfd_vma) r_reloc_get_section (&src->r_rel));
+ else
+ hash_val += hash_bfd_vma ((bfd_vma) r_reloc_get_hash_entry (&src->r_rel));
+
+ return hash_val;
+}
+
+
+/* Check if the specified literal_value has been seen before. */
+
+static value_map *
+get_cached_value (map, val)
+ value_map_hash_table *map;
+ const literal_value *val;
+{
+ value_map *map_e;
+ value_map *bucket;
+ unsigned idx;
+
+ idx = hash_literal_value (val);
+ idx = idx & (map->bucket_count - 1);
+ bucket = map->buckets[idx];
+ for (map_e = bucket; map_e; map_e = map_e->next)
+ {
+ if (is_same_value (&map_e->val, val))
+ return map_e;
+ }
+ return NULL;
+}
+
+
+/* Record a new literal value. It is illegal to call this if VALUE
+ already has an entry here. */
+
+static value_map *
+add_value_map (map, val, loc)
+ value_map_hash_table *map;
+ const literal_value *val;
+ const r_reloc *loc;
+{
+ value_map **bucket_p;
+ unsigned idx;
+
+ value_map *val_e = (value_map *) bfd_zmalloc (sizeof (value_map));
+
+ BFD_ASSERT (get_cached_value (map, val) == NULL);
+ val_e->val = *val;
+ val_e->loc = *loc;
+
+ idx = hash_literal_value (val);
+ idx = idx & (map->bucket_count - 1);
+ bucket_p = &map->buckets[idx];
+
+ val_e->next = *bucket_p;
+ *bucket_p = val_e;
+ map->count++;
+ /* FIXME: consider resizing the hash table if we get too many entries */
+
+ return val_e;
+}
+
+
+/* Lists of literals being coalesced or removed. */
+
+/* In the usual case, the literal identified by "from" is being
+ coalesced with another literal identified by "to". If the literal is
+ unused and is being removed altogether, "to.abfd" will be NULL.
+ The removed_literal entries are kept on a per-section list, sorted
+ by the "from" offset field. */
+
+typedef struct removed_literal_struct removed_literal;
+typedef struct removed_literal_list_struct removed_literal_list;
+
+struct removed_literal_struct
+{
+ r_reloc from;
+ r_reloc to;
+ removed_literal *next;
+};
+
+struct removed_literal_list_struct
+{
+ removed_literal *head;
+ removed_literal *tail;
+};
+
+
+static void add_removed_literal
+ PARAMS ((removed_literal_list *, const r_reloc *, const r_reloc *));
+static removed_literal *find_removed_literal
+ PARAMS ((removed_literal_list *, bfd_vma));
+static bfd_vma offset_with_removed_literals
+ PARAMS ((removed_literal_list *, bfd_vma));
+
+
+/* Record that the literal at "from" is being removed. If "to" is not
+ NULL, the "from" literal is being coalesced with the "to" literal. */
+
+static void
+add_removed_literal (removed_list, from, to)
+ removed_literal_list *removed_list;
+ const r_reloc *from;
+ const r_reloc *to;
+{
+ removed_literal *r, *new_r, *next_r;
+
+ new_r = (removed_literal *) bfd_zmalloc (sizeof (removed_literal));
+
+ new_r->from = *from;
+ if (to)
+ new_r->to = *to;
+ else
+ new_r->to.abfd = NULL;
+ new_r->next = NULL;
+
+ r = removed_list->head;
+ if (r == NULL)
+ {
+ removed_list->head = new_r;
+ removed_list->tail = new_r;
+ }
+ /* Special check for common case of append. */
+ else if (removed_list->tail->from.target_offset < from->target_offset)
+ {
+ removed_list->tail->next = new_r;
+ removed_list->tail = new_r;
+ }
+ else
+ {
+ while (r->from.target_offset < from->target_offset
+ && r->next != NULL)
+ {
+ r = r->next;
+ }
+ next_r = r->next;
+ r->next = new_r;
+ new_r->next = next_r;
+ if (next_r == NULL)
+ removed_list->tail = new_r;
+ }
+}
+
+
+/* Check if the list of removed literals contains an entry for the
+ given address. Return the entry if found. */
+
+static removed_literal *
+find_removed_literal (removed_list, addr)
+ removed_literal_list *removed_list;
+ bfd_vma addr;
+{
+ removed_literal *r = removed_list->head;
+ while (r && r->from.target_offset < addr)
+ r = r->next;
+ if (r && r->from.target_offset == addr)
+ return r;
+ return NULL;
+}
+
+
+/* Adjust an offset in a section to compensate for literals that are
+ being removed. Search the list of removed literals and subtract
+ 4 bytes for every removed literal prior to the given address. */
+
+static bfd_vma
+offset_with_removed_literals (removed_list, addr)
+ removed_literal_list *removed_list;
+ bfd_vma addr;
+{
+ removed_literal *r = removed_list->head;
+ unsigned num_bytes = 0;
+
+ if (r == NULL)
+ return addr;
+
+ while (r && r->from.target_offset <= addr)
+ {
+ num_bytes += 4;
+ r = r->next;
+ }
+ if (num_bytes > addr)
+ return 0;
+ return (addr - num_bytes);
+}
+
+
+/* Coalescing literals may require a relocation to refer to a section in
+ a different input file, but the standard relocation information
+ cannot express that. Instead, the reloc_bfd_fix structures are used
+ to "fix" the relocations that refer to sections in other input files.
+ These structures are kept on per-section lists. The "src_type" field
+ records the relocation type in case there are multiple relocations on
+ the same location. FIXME: This is ugly; an alternative might be to
+ add new symbols with the "owner" field to some other input file. */
+
+typedef struct reloc_bfd_fix_struct reloc_bfd_fix;
+
+struct reloc_bfd_fix_struct
+{
+ asection *src_sec;
+ bfd_vma src_offset;
+ unsigned src_type; /* Relocation type. */
+
+ bfd *target_abfd;
+ asection *target_sec;
+ bfd_vma target_offset;
+
+ reloc_bfd_fix *next;
+};
+
+
+static reloc_bfd_fix *reloc_bfd_fix_init
+ PARAMS ((asection *, bfd_vma, unsigned, bfd *, asection *, bfd_vma));
+static reloc_bfd_fix *get_bfd_fix
+ PARAMS ((reloc_bfd_fix *, asection *, bfd_vma, unsigned));
+
+
+static reloc_bfd_fix *
+reloc_bfd_fix_init (src_sec, src_offset, src_type,
+ target_abfd, target_sec, target_offset)
+ asection *src_sec;
+ bfd_vma src_offset;
+ unsigned src_type;
+ bfd *target_abfd;
+ asection *target_sec;
+ bfd_vma target_offset;
+{
+ reloc_bfd_fix *fix;
+
+ fix = (reloc_bfd_fix *) bfd_malloc (sizeof (reloc_bfd_fix));
+ fix->src_sec = src_sec;
+ fix->src_offset = src_offset;
+ fix->src_type = src_type;
+ fix->target_abfd = target_abfd;
+ fix->target_sec = target_sec;
+ fix->target_offset = target_offset;
+
+ return fix;
+}
+
+
+static reloc_bfd_fix *
+get_bfd_fix (fix_list, sec, offset, type)
+ reloc_bfd_fix *fix_list;
+ asection *sec;
+ bfd_vma offset;
+ unsigned type;
+{
+ reloc_bfd_fix *r;
+
+ for (r = fix_list; r != NULL; r = r->next)
+ {
+ if (r->src_sec == sec
+ && r->src_offset == offset
+ && r->src_type == type)
+ return r;
+ }
+ return NULL;
+}
+
+
+/* Per-section data for relaxation. */
+
+struct xtensa_relax_info_struct
+{
+ bfd_boolean is_relaxable_literal_section;
+ int visited; /* Number of times visited. */
+
+ source_reloc *src_relocs; /* Array[src_count]. */
+ int src_count;
+ int src_next; /* Next src_relocs entry to assign. */
+
+ removed_literal_list removed_list;
+
+ reloc_bfd_fix *fix_list;
+};
+
+struct elf_xtensa_section_data
+{
+ struct bfd_elf_section_data elf;
+ xtensa_relax_info relax_info;
+};
+
+static void init_xtensa_relax_info
+ PARAMS ((asection *));
+static xtensa_relax_info *get_xtensa_relax_info
+ PARAMS ((asection *));
+static void add_fix
+ PARAMS ((asection *, reloc_bfd_fix *));
+
+
+static bfd_boolean
+elf_xtensa_new_section_hook (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct elf_xtensa_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
+
+ sdata = (struct elf_xtensa_section_data *) bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return FALSE;
+ sec->used_by_bfd = (PTR) sdata;
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+
+static void
+init_xtensa_relax_info (sec)
+ asection *sec;
+{
+ xtensa_relax_info *relax_info = get_xtensa_relax_info (sec);
+
+ relax_info->is_relaxable_literal_section = FALSE;
+ relax_info->visited = 0;
+
+ relax_info->src_relocs = NULL;
+ relax_info->src_count = 0;
+ relax_info->src_next = 0;
+
+ relax_info->removed_list.head = NULL;
+ relax_info->removed_list.tail = NULL;
+
+ relax_info->fix_list = NULL;
+}
+
+
+static xtensa_relax_info *
+get_xtensa_relax_info (sec)
+ asection *sec;
+{
+ struct elf_xtensa_section_data *section_data;
+
+ /* No info available if no section or if it is an output section. */
+ if (!sec || sec == sec->output_section)
+ return NULL;
+
+ section_data = (struct elf_xtensa_section_data *) elf_section_data (sec);
+ return &section_data->relax_info;
+}
+
+
+static void
+add_fix (src_sec, fix)
+ asection *src_sec;
+ reloc_bfd_fix *fix;
+{
+ xtensa_relax_info *relax_info;
+
+ relax_info = get_xtensa_relax_info (src_sec);
+ fix->next = relax_info->fix_list;
+ relax_info->fix_list = fix;
+}
+
+
+/* Access to internal relocations, section contents and symbols. */
+
+/* During relaxation, we need to modify relocations, section contents,
+ and symbol definitions, and we need to keep the original values from
+ being reloaded from the input files, i.e., we need to "pin" the
+ modified values in memory. We also want to continue to observe the
+ setting of the "keep-memory" flag. The following functions wrap the
+ standard BFD functions to take care of this for us. */
+
+static Elf_Internal_Rela *
+retrieve_internal_relocs (abfd, sec, keep_memory)
+ bfd *abfd;
+ asection *sec;
+ bfd_boolean keep_memory;
+{
+ Elf_Internal_Rela *internal_relocs;
+
+ if ((sec->flags & SEC_LINKER_CREATED) != 0)
+ return NULL;
+
+ internal_relocs = elf_section_data (sec)->relocs;
+ if (internal_relocs == NULL)
+ internal_relocs = (_bfd_elf32_link_read_relocs
+ (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+ keep_memory));
+ return internal_relocs;
+}
+
+
+static void
+pin_internal_relocs (sec, internal_relocs)
+ asection *sec;
+ Elf_Internal_Rela *internal_relocs;
+{
+ elf_section_data (sec)->relocs = internal_relocs;
+}
+
+
+static void
+release_internal_relocs (sec, internal_relocs)
+ asection *sec;
+ Elf_Internal_Rela *internal_relocs;
+{
+ if (internal_relocs
+ && elf_section_data (sec)->relocs != internal_relocs)
+ free (internal_relocs);
+}
+
+
+static bfd_byte *
+retrieve_contents (abfd, sec, keep_memory)
+ bfd *abfd;
+ asection *sec;
+ bfd_boolean keep_memory;
+{
+ bfd_byte *contents;
+
+ contents = elf_section_data (sec)->this_hdr.contents;
+
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
+ if (contents != NULL)
+ {
+ if (! bfd_get_section_contents (abfd, sec, contents,
+ (file_ptr) 0, sec->_raw_size))
+ {
+ free (contents);
+ return NULL;
+ }
+ if (keep_memory)
+ elf_section_data (sec)->this_hdr.contents = contents;
+ }
+ }
+ return contents;
+}
+
+
+static void
+pin_contents (sec, contents)
+ asection *sec;
+ bfd_byte *contents;
+{
+ elf_section_data (sec)->this_hdr.contents = contents;
+}
+
+
+static void
+release_contents (sec, contents)
+ asection *sec;
+ bfd_byte *contents;
+{
+ if (contents &&
+ elf_section_data (sec)->this_hdr.contents != contents)
+ free (contents);
+}
+
+
+static Elf_Internal_Sym *
+retrieve_local_syms (input_bfd)
+ bfd *input_bfd;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Sym *isymbuf;
+ size_t locsymcount;
+
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ locsymcount = symtab_hdr->sh_info;
+
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (isymbuf == NULL && locsymcount != 0)
+ isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0,
+ NULL, NULL, NULL);
+
+ /* Save the symbols for this input file so they won't be read again. */
+ if (isymbuf && isymbuf != (Elf_Internal_Sym *) symtab_hdr->contents)
+ symtab_hdr->contents = (unsigned char *) isymbuf;
+
+ return isymbuf;
+}
+
+
+/* Code for link-time relaxation. */
+
+/* Local helper functions. */
+static bfd_boolean analyze_relocations
+ PARAMS ((struct bfd_link_info *));
+static bfd_boolean find_relaxable_sections
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+static bfd_boolean collect_source_relocs
+ PARAMS ((bfd *, asection *, struct bfd_link_info *));
+static bfd_boolean is_resolvable_asm_expansion
+ PARAMS ((bfd *, asection *, bfd_byte *, Elf_Internal_Rela *,
+ struct bfd_link_info *, bfd_boolean *));
+static bfd_boolean remove_literals
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, value_map_hash_table *));
+static bfd_boolean relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *));
+static bfd_boolean relax_property_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *));
+static bfd_boolean relax_section_symbols
+ PARAMS ((bfd *, asection *));
+static bfd_boolean relocations_reach
+ PARAMS ((source_reloc *, int, const r_reloc *));
+static void translate_reloc
+ PARAMS ((const r_reloc *, r_reloc *));
+static Elf_Internal_Rela *get_irel_at_offset
+ PARAMS ((asection *, Elf_Internal_Rela *, bfd_vma));
+static Elf_Internal_Rela *find_associated_l32r_irel
+ PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *,
+ Elf_Internal_Rela *));
+static void shrink_dynamic_reloc_sections
+ PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *));
+
+
+static bfd_boolean
+elf_xtensa_relax_section (abfd, sec, link_info, again)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+ bfd_boolean *again;
+{
+ static value_map_hash_table *values = NULL;
+ xtensa_relax_info *relax_info;
+
+ if (!values)
+ {
+ /* Do some overall initialization for relaxation. */
+ values = value_map_hash_table_init ();
+ relaxing_section = TRUE;
+ if (!analyze_relocations (link_info))
+ return FALSE;
+ }
+ *again = FALSE;
+
+ /* Don't mess with linker-created sections. */
+ if ((sec->flags & SEC_LINKER_CREATED) != 0)
+ return TRUE;
+
+ relax_info = get_xtensa_relax_info (sec);
+ BFD_ASSERT (relax_info != NULL);
+
+ switch (relax_info->visited)
+ {
+ case 0:
+ /* Note: It would be nice to fold this pass into
+ analyze_relocations, but it is important for this step that the
+ sections be examined in link order. */
+ if (!remove_literals (abfd, sec, link_info, values))
+ return FALSE;
+ *again = TRUE;
+ break;
+
+ case 1:
+ if (!relax_section (abfd, sec, link_info))
+ return FALSE;
+ *again = TRUE;
+ break;
+
+ case 2:
+ if (!relax_section_symbols (abfd, sec))
+ return FALSE;
+ break;
+ }
+
+ relax_info->visited++;
+ return TRUE;
+}
+
+/* Initialization for relaxation. */
+
+/* This function is called once at the start of relaxation. It scans
+ all the input sections and marks the ones that are relaxable (i.e.,
+ literal sections with L32R relocations against them). It then
+ collect source_reloc information for all the relocations against
+ those relaxable sections. */
+
+static bfd_boolean
+analyze_relocations (link_info)
+ struct bfd_link_info *link_info;
+{
+ bfd *abfd;
+ asection *sec;
+ bfd_boolean is_relaxable = FALSE;
+
+ /* Initialize the per-section relaxation info. */
+ for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ init_xtensa_relax_info (sec);
+ }
+
+ /* Mark relaxable sections (and count relocations against each one). */
+ for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (!find_relaxable_sections (abfd, sec, link_info, &is_relaxable))
+ return FALSE;
+ }
+
+ /* Bail out if there are no relaxable sections. */
+ if (!is_relaxable)
+ return TRUE;
+
+ /* Allocate space for source_relocs. */
+ for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ xtensa_relax_info *relax_info;
+
+ relax_info = get_xtensa_relax_info (sec);
+ if (relax_info->is_relaxable_literal_section)
+ {
+ relax_info->src_relocs = (source_reloc *)
+ bfd_malloc (relax_info->src_count * sizeof (source_reloc));
+ }
+ }
+
+ /* Collect info on relocations against each relaxable section. */
+ for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ for (sec = abfd->sections; sec != NULL; sec = sec->next)
+ {
+ if (!collect_source_relocs (abfd, sec, link_info))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Find all the literal sections that might be relaxed. The motivation
+ for this pass is that collect_source_relocs() needs to record _all_
+ the relocations that target each relaxable section. That is
+ expensive and unnecessary unless the target section is actually going
+ to be relaxed. This pass identifies all such sections by checking if
+ they have L32Rs pointing to them. In the process, the total number
+ of relocations targetting each section is also counted so that we
+ know how much space to allocate for source_relocs against each
+ relaxable literal section. */
+
+static bfd_boolean
+find_relaxable_sections (abfd, sec, link_info, is_relaxable_p)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+ bfd_boolean *is_relaxable_p;
+{
+ Elf_Internal_Rela *internal_relocs;
+ bfd_byte *contents;
+ bfd_boolean ok = TRUE;
+ unsigned i;
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+ if (internal_relocs == NULL)
+ return ok;
+
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+ r_reloc r_rel;
+ asection *target_sec;
+ xtensa_relax_info *target_relax_info;
+
+ r_reloc_init (&r_rel, abfd, irel);
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_relax_info = get_xtensa_relax_info (target_sec);
+ if (!target_relax_info)
+ continue;
+
+ /* Count relocations against the target section. */
+ target_relax_info->src_count++;
+
+ if (is_literal_section (target_sec)
+ && is_l32r_relocation (sec, contents, irel)
+ && r_reloc_is_defined (&r_rel))
+ {
+ /* Mark the target section as relaxable. */
+ target_relax_info->is_relaxable_literal_section = TRUE;
+ *is_relaxable_p = TRUE;
+ }
+ }
+
+ error_return:
+ release_contents (sec, contents);
+ release_internal_relocs (sec, internal_relocs);
+ return ok;
+}
+
+
+/* Record _all_ the relocations that point to relaxable literal
+ sections, and get rid of ASM_EXPAND relocs by either converting them
+ to ASM_SIMPLIFY or by removing them. */
+
+static bfd_boolean
+collect_source_relocs (abfd, sec, link_info)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+{
+ Elf_Internal_Rela *internal_relocs;
+ bfd_byte *contents;
+ bfd_boolean ok = TRUE;
+ unsigned i;
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+ if (internal_relocs == NULL)
+ return ok;
+
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ /* Record relocations against relaxable literal sections. */
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+ r_reloc r_rel;
+ asection *target_sec;
+ xtensa_relax_info *target_relax_info;
+
+ r_reloc_init (&r_rel, abfd, irel);
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_relax_info = get_xtensa_relax_info (target_sec);
+
+ if (target_relax_info
+ && target_relax_info->is_relaxable_literal_section)
+ {
+ xtensa_opcode opcode;
+ xtensa_operand opnd;
+ source_reloc *s_reloc;
+ int src_next;
+
+ src_next = target_relax_info->src_next++;
+ s_reloc = &target_relax_info->src_relocs[src_next];
+
+ opcode = get_relocation_opcode (sec, contents, irel);
+ if (opcode == XTENSA_UNDEFINED)
+ opnd = NULL;
+ else
+ opnd = xtensa_get_operand (xtensa_default_isa, opcode,
+ get_relocation_opnd (irel));
+
+ init_source_reloc (s_reloc, sec, &r_rel, opnd);
+ }
+ }
+
+ /* Now get rid of ASM_EXPAND relocations. At this point, the
+ src_relocs array for the target literal section may still be
+ incomplete, but it must at least contain the entries for the L32R
+ relocations associated with ASM_EXPANDs because they were just
+ added in the preceding loop over the relocations. */
+
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+ bfd_boolean is_reachable;
+
+ if (!is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info,
+ &is_reachable))
+ continue;
+
+ if (is_reachable)
+ {
+ Elf_Internal_Rela *l32r_irel;
+ r_reloc r_rel;
+ asection *target_sec;
+ xtensa_relax_info *target_relax_info;
+
+ /* Mark the source_reloc for the L32R so that it will be
+ removed in remove_literals(), along with the associated
+ literal. */
+ l32r_irel = find_associated_l32r_irel (sec, contents,
+ irel, internal_relocs);
+ if (l32r_irel == NULL)
+ continue;
+
+ r_reloc_init (&r_rel, abfd, l32r_irel);
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_relax_info = get_xtensa_relax_info (target_sec);
+
+ if (target_relax_info
+ && target_relax_info->is_relaxable_literal_section)
+ {
+ source_reloc *s_reloc;
+
+ /* Search the source_relocs for the entry corresponding to
+ the l32r_irel. Note: The src_relocs array is not yet
+ sorted, but it wouldn't matter anyway because we're
+ searching by source offset instead of target offset. */
+ s_reloc = find_source_reloc (target_relax_info->src_relocs,
+ target_relax_info->src_next,
+ sec, l32r_irel);
+ BFD_ASSERT (s_reloc);
+ s_reloc->is_null = TRUE;
+ }
+
+ /* Convert this reloc to ASM_SIMPLIFY. */
+ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
+ R_XTENSA_ASM_SIMPLIFY);
+ l32r_irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+
+ pin_internal_relocs (sec, internal_relocs);
+ }
+ else
+ {
+ /* It is resolvable but doesn't reach. We resolve now
+ by eliminating the relocation -- the call will remain
+ expanded into L32R/CALLX. */
+ irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ pin_internal_relocs (sec, internal_relocs);
+ }
+ }
+
+ error_return:
+ release_contents (sec, contents);
+ release_internal_relocs (sec, internal_relocs);
+ return ok;
+}
+
+
+/* Return TRUE if the asm expansion can be resolved. Generally it can
+ be resolved on a final link or when a partial link locates it in the
+ same section as the target. Set "is_reachable" flag if the target of
+ the call is within the range of a direct call, given the current VMA
+ for this section and the target section. */
+
+bfd_boolean
+is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info,
+ is_reachable_p)
+ bfd *abfd;
+ asection *sec;
+ bfd_byte *contents;
+ Elf_Internal_Rela *irel;
+ struct bfd_link_info *link_info;
+ bfd_boolean *is_reachable_p;
+{
+ asection *target_sec;
+ bfd_vma target_offset;
+ r_reloc r_rel;
+ xtensa_opcode opcode, direct_call_opcode;
+ bfd_vma self_address;
+ bfd_vma dest_address;
+
+ *is_reachable_p = FALSE;
+
+ if (contents == NULL)
+ return FALSE;
+
+ if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_EXPAND)
+ return FALSE;
+
+ opcode = get_expanded_call_opcode (contents + irel->r_offset,
+ sec->_raw_size - irel->r_offset);
+
+ direct_call_opcode = swap_callx_for_call_opcode (opcode);
+ if (direct_call_opcode == XTENSA_UNDEFINED)
+ return FALSE;
+
+ /* Check and see that the target resolves. */
+ r_reloc_init (&r_rel, abfd, irel);
+ if (!r_reloc_is_defined (&r_rel))
+ return FALSE;
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_offset = r_reloc_get_target_offset (&r_rel);
+
+ /* If the target is in a shared library, then it doesn't reach. This
+ isn't supposed to come up because the compiler should never generate
+ non-PIC calls on systems that use shared libraries, but the linker
+ shouldn't crash regardless. */
+ if (!target_sec->output_section)
+ return FALSE;
+
+ /* For relocateable sections, we can only simplify when the output
+ section of the target is the same as the output section of the
+ source. */
+ if (link_info->relocateable
+ && (target_sec->output_section != sec->output_section))
+ return FALSE;
+
+ self_address = (sec->output_section->vma
+ + sec->output_offset + irel->r_offset + 3);
+ dest_address = (target_sec->output_section->vma
+ + target_sec->output_offset + target_offset);
+
+ *is_reachable_p = pcrel_reloc_fits
+ (xtensa_get_operand (xtensa_default_isa, direct_call_opcode, 0),
+ self_address, dest_address);
+
+ if ((self_address >> CALL_SEGMENT_BITS) !=
+ (dest_address >> CALL_SEGMENT_BITS))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+static Elf_Internal_Rela *
+find_associated_l32r_irel (sec, contents, other_irel, internal_relocs)
+ asection *sec;
+ bfd_byte *contents;
+ Elf_Internal_Rela *other_irel;
+ Elf_Internal_Rela *internal_relocs;
+{
+ unsigned i;
+
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+
+ if (irel == other_irel)
+ continue;
+ if (irel->r_offset != other_irel->r_offset)
+ continue;
+ if (is_l32r_relocation (sec, contents, irel))
+ return irel;
+ }
+
+ return NULL;
+}
+
+/* First relaxation pass. */
+
+/* If the section is relaxable (i.e., a literal section), check each
+ literal to see if it has the same value as another literal that has
+ already been seen, either in the current section or a previous one.
+ If so, add an entry to the per-section list of removed literals. The
+ actual changes are deferred until the next pass. */
+
+static bfd_boolean
+remove_literals (abfd, sec, link_info, values)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+ value_map_hash_table *values;
+{
+ xtensa_relax_info *relax_info;
+ bfd_byte *contents;
+ Elf_Internal_Rela *internal_relocs;
+ source_reloc *src_relocs;
+ bfd_boolean ok = TRUE;
+ int i;
+
+ /* Do nothing if it is not a relaxable literal section. */
+ relax_info = get_xtensa_relax_info (sec);
+ BFD_ASSERT (relax_info);
+
+ if (!relax_info->is_relaxable_literal_section)
+ return ok;
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ /* Sort the source_relocs by target offset. */
+ src_relocs = relax_info->src_relocs;
+ qsort (src_relocs, relax_info->src_count,
+ sizeof (source_reloc), source_reloc_compare);
+
+ for (i = 0; i < relax_info->src_count; i++)
+ {
+ source_reloc *rel;
+ Elf_Internal_Rela *irel = NULL;
+ literal_value val;
+ value_map *val_map;
+
+ rel = &src_relocs[i];
+ irel = get_irel_at_offset (sec, internal_relocs,
+ rel->r_rel.target_offset);
+
+ /* If the target_offset for this relocation is the same as the
+ previous relocation, then we've already considered whether the
+ literal can be coalesced. Skip to the next one.... */
+ if (i != 0 && (src_relocs[i-1].r_rel.target_offset
+ == rel->r_rel.target_offset))
+ continue;
+
+ /* Check if the relocation was from an L32R that is being removed
+ because a CALLX was converted to a direct CALL, and check if
+ there are no other relocations to the literal. */
+ if (rel->is_null
+ && (i == relax_info->src_count - 1
+ || (src_relocs[i+1].r_rel.target_offset
+ != rel->r_rel.target_offset)))
+ {
+ /* Mark the unused literal so that it will be removed. */
+ add_removed_literal (&relax_info->removed_list, &rel->r_rel, NULL);
+
+ /* Zero out the relocation on this literal location. */
+ if (irel)
+ {
+ if (elf_hash_table (link_info)->dynamic_sections_created)
+ shrink_dynamic_reloc_sections (link_info, abfd, sec, irel);
+
+ irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ }
+
+ continue;
+ }
+
+ /* Find the literal value. */
+ r_reloc_init (&val.r_rel, abfd, irel);
+ BFD_ASSERT (rel->r_rel.target_offset < sec->_raw_size);
+ val.value = bfd_get_32 (abfd, contents + rel->r_rel.target_offset);
+
+ /* Check if we've seen another literal with the same value. */
+ val_map = get_cached_value (values, &val);
+ if (val_map != NULL)
+ {
+ /* First check that THIS and all the other relocs to this
+ literal will FIT if we move them to the new address. */
+
+ if (relocations_reach (rel, relax_info->src_count - i,
+ &val_map->loc))
+ {
+ /* Mark that the literal will be coalesced. */
+ add_removed_literal (&relax_info->removed_list,
+ &rel->r_rel, &val_map->loc);
+ }
+ else
+ {
+ /* Relocations do not reach -- do not remove this literal. */
+ val_map->loc = rel->r_rel;
+ }
+ }
+ else
+ {
+ /* This is the first time we've seen this literal value. */
+ BFD_ASSERT (sec == r_reloc_get_section (&rel->r_rel));
+ add_value_map (values, &val, &rel->r_rel);
+ }
+ }
+
+error_return:
+ release_contents (sec, contents);
+ release_internal_relocs (sec, internal_relocs);
+ return ok;
+}
+
+
+/* Check if the original relocations (presumably on L32R instructions)
+ identified by reloc[0..N] can be changed to reference the literal
+ identified by r_rel. If r_rel is out of range for any of the
+ original relocations, then we don't want to coalesce the original
+ literal with the one at r_rel. We only check reloc[0..N], where the
+ offsets are all the same as for reloc[0] (i.e., they're all
+ referencing the same literal) and where N is also bounded by the
+ number of remaining entries in the "reloc" array. The "reloc" array
+ is sorted by target offset so we know all the entries for the same
+ literal will be contiguous. */
+
+static bfd_boolean
+relocations_reach (reloc, remaining_relocs, r_rel)
+ source_reloc *reloc;
+ int remaining_relocs;
+ const r_reloc *r_rel;
+{
+ bfd_vma from_offset, source_address, dest_address;
+ asection *sec;
+ int i;
+
+ if (!r_reloc_is_defined (r_rel))
+ return FALSE;
+
+ sec = r_reloc_get_section (r_rel);
+ from_offset = reloc[0].r_rel.target_offset;
+
+ for (i = 0; i < remaining_relocs; i++)
+ {
+ if (reloc[i].r_rel.target_offset != from_offset)
+ break;
+
+ /* Ignore relocations that have been removed. */
+ if (reloc[i].is_null)
+ continue;
+
+ /* The original and new output section for these must be the same
+ in order to coalesce. */
+ if (r_reloc_get_section (&reloc[i].r_rel)->output_section
+ != sec->output_section)
+ return FALSE;
+
+ /* A NULL operand means it is not a PC-relative relocation, so
+ the literal can be moved anywhere. */
+ if (reloc[i].opnd)
+ {
+ /* Otherwise, check to see that it fits. */
+ source_address = (reloc[i].source_sec->output_section->vma
+ + reloc[i].source_sec->output_offset
+ + reloc[i].r_rel.rela.r_offset);
+ dest_address = (sec->output_section->vma
+ + sec->output_offset
+ + r_rel->target_offset);
+
+ if (!pcrel_reloc_fits (reloc[i].opnd, source_address, dest_address))
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/* WARNING: linear search here. If the relocation are in order by
+ address, we can use a faster binary search. ALSO, we assume that
+ there is only 1 non-NONE relocation per address. */
+
+static Elf_Internal_Rela *
+get_irel_at_offset (sec, internal_relocs, offset)
+ asection *sec;
+ Elf_Internal_Rela *internal_relocs;
+ bfd_vma offset;
+{
+ unsigned i;
+ if (!internal_relocs)
+ return NULL;
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+ if (irel->r_offset == offset
+ && ELF32_R_TYPE (irel->r_info) != R_XTENSA_NONE)
+ return irel;
+ }
+ return NULL;
+}
+
+
+/* Second relaxation pass. */
+
+/* Modify all of the relocations to point to the right spot, and if this
+ is a relaxable section, delete the unwanted literals and fix the
+ cooked_size. */
+
+bfd_boolean
+relax_section (abfd, sec, link_info)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+{
+ Elf_Internal_Rela *internal_relocs;
+ xtensa_relax_info *relax_info;
+ bfd_byte *contents;
+ bfd_boolean ok = TRUE;
+ unsigned i;
+
+ relax_info = get_xtensa_relax_info (sec);
+ BFD_ASSERT (relax_info);
+
+ /* Handle property sections (e.g., literal tables) specially. */
+ if (xtensa_is_property_section (sec))
+ {
+ BFD_ASSERT (!relax_info->is_relaxable_literal_section);
+ return relax_property_section (abfd, sec, link_info);
+ }
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ if (internal_relocs)
+ {
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel;
+ xtensa_relax_info *target_relax_info;
+ bfd_vma source_offset;
+ r_reloc r_rel;
+ unsigned r_type;
+ asection *target_sec;
+
+ /* Locally change the source address.
+ Translate the target to the new target address.
+ If it points to this section and has been removed,
+ NULLify it.
+ Write it back. */
+
+ irel = &internal_relocs[i];
+ source_offset = irel->r_offset;
+
+ r_type = ELF32_R_TYPE (irel->r_info);
+ r_reloc_init (&r_rel, abfd, irel);
+
+ if (relax_info->is_relaxable_literal_section)
+ {
+ if (r_type != R_XTENSA_NONE
+ && find_removed_literal (&relax_info->removed_list,
+ irel->r_offset))
+ {
+ /* Remove this relocation. */
+ if (elf_hash_table (link_info)->dynamic_sections_created)
+ shrink_dynamic_reloc_sections (link_info, abfd, sec, irel);
+ irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ irel->r_offset = offset_with_removed_literals
+ (&relax_info->removed_list, irel->r_offset);
+ continue;
+ }
+ source_offset =
+ offset_with_removed_literals (&relax_info->removed_list,
+ irel->r_offset);
+ irel->r_offset = source_offset;
+ }
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_relax_info = get_xtensa_relax_info (target_sec);
+
+ if (target_relax_info
+ && target_relax_info->is_relaxable_literal_section)
+ {
+ r_reloc new_rel;
+ reloc_bfd_fix *fix;
+
+ translate_reloc (&r_rel, &new_rel);
+
+ /* FIXME: If the relocation still references a section in
+ the same input file, the relocation should be modified
+ directly instead of adding a "fix" record. */
+
+ fix = reloc_bfd_fix_init (sec, source_offset, r_type, 0,
+ r_reloc_get_section (&new_rel),
+ new_rel.target_offset);
+ add_fix (sec, fix);
+ }
+
+ pin_internal_relocs (sec, internal_relocs);
+ }
+ }
+
+ if (relax_info->is_relaxable_literal_section)
+ {
+ /* Walk through the contents and delete literals that are not needed
+ anymore. */
+
+ unsigned long size = sec->_cooked_size;
+ unsigned long removed = 0;
+
+ removed_literal *reloc = relax_info->removed_list.head;
+ for (; reloc; reloc = reloc->next)
+ {
+ unsigned long upper = sec->_raw_size;
+ bfd_vma start = reloc->from.target_offset + 4;
+ if (reloc->next)
+ upper = reloc->next->from.target_offset;
+ if (upper - start != 0)
+ {
+ BFD_ASSERT (start <= upper);
+ memmove (contents + start - removed - 4,
+ contents + start,
+ upper - start );
+ pin_contents (sec, contents);
+ }
+ removed += 4;
+ size -= 4;
+ }
+
+ /* Change the section size. */
+ sec->_cooked_size = size;
+ /* Also shrink _raw_size. (The code in relocate_section that
+ checks that relocations are within the section must use
+ _raw_size because of the way the stabs sections are relaxed;
+ shrinking _raw_size means that these checks will not be
+ unnecessarily lax.) */
+ sec->_raw_size = size;
+ }
+
+ error_return:
+ release_internal_relocs (sec, internal_relocs);
+ release_contents (sec, contents);
+ return ok;
+}
+
+
+/* Fix up a relocation to take account of removed literals. */
+
+static void
+translate_reloc (orig_rel, new_rel)
+ const r_reloc *orig_rel;
+ r_reloc *new_rel;
+{
+ asection *sec;
+ xtensa_relax_info *relax_info;
+ removed_literal *removed;
+ unsigned long new_offset;
+
+ *new_rel = *orig_rel;
+
+ if (!r_reloc_is_defined (orig_rel))
+ return;
+ sec = r_reloc_get_section (orig_rel);
+
+ relax_info = get_xtensa_relax_info (sec);
+ BFD_ASSERT (relax_info);
+
+ if (!relax_info->is_relaxable_literal_section)
+ return;
+
+ /* Check if the original relocation is against a literal being removed. */
+ removed = find_removed_literal (&relax_info->removed_list,
+ orig_rel->target_offset);
+ if (removed)
+ {
+ asection *new_sec;
+
+ /* The fact that there is still a relocation to this literal indicates
+ that the literal is being coalesced, not simply removed. */
+ BFD_ASSERT (removed->to.abfd != NULL);
+
+ /* This was moved to some other address (possibly in another section). */
+ *new_rel = removed->to;
+ new_sec = r_reloc_get_section (new_rel);
+ if (new_sec != sec)
+ {
+ sec = new_sec;
+ relax_info = get_xtensa_relax_info (sec);
+ if (!relax_info || !relax_info->is_relaxable_literal_section)
+ return;
+ }
+ }
+
+ /* ...and the target address may have been moved within its section. */
+ new_offset = offset_with_removed_literals (&relax_info->removed_list,
+ new_rel->target_offset);
+
+ /* Modify the offset and addend. */
+ new_rel->target_offset = new_offset;
+ new_rel->rela.r_addend += (new_offset - new_rel->target_offset);
+}
+
+
+/* For dynamic links, there may be a dynamic relocation for each
+ literal. The number of dynamic relocations must be computed in
+ size_dynamic_sections, which occurs before relaxation. When a
+ literal is removed, this function checks if there is a corresponding
+ dynamic relocation and shrinks the size of the appropriate dynamic
+ relocation section accordingly. At this point, the contents of the
+ dynamic relocation sections have not yet been filled in, so there's
+ nothing else that needs to be done. */
+
+static void
+shrink_dynamic_reloc_sections (info, abfd, input_section, rel)
+ struct bfd_link_info *info;
+ bfd *abfd;
+ asection *input_section;
+ Elf_Internal_Rela *rel;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ unsigned long r_symndx;
+ int r_type;
+ struct elf_link_hash_entry *h;
+ bfd_boolean dynamic_symbol;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+
+ r_type = ELF32_R_TYPE (rel->r_info);
+ r_symndx = ELF32_R_SYM (rel->r_info);
+
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ dynamic_symbol = xtensa_elf_dynamic_symbol_p (info, h);
+
+ if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (dynamic_symbol || info->shared))
+ {
+ bfd *dynobj;
+ const char *srel_name;
+ asection *srel;
+ bfd_boolean is_plt = FALSE;
+
+ dynobj = elf_hash_table (info)->dynobj;
+ BFD_ASSERT (dynobj != NULL);
+
+ if (dynamic_symbol && r_type == R_XTENSA_PLT)
+ {
+ srel_name = ".rela.plt";
+ is_plt = TRUE;
+ }
+ else
+ srel_name = ".rela.got";
+
+ /* Reduce size of the .rela.* section by one reloc. */
+ srel = bfd_get_section_by_name (dynobj, srel_name);
+ BFD_ASSERT (srel != NULL);
+ BFD_ASSERT (srel->_cooked_size >= sizeof (Elf32_External_Rela));
+ srel->_cooked_size -= sizeof (Elf32_External_Rela);
+
+ /* Also shrink _raw_size. (This seems wrong but other bfd code seems
+ to assume that linker-created sections will never be relaxed and
+ hence _raw_size must always equal _cooked_size.) */
+ srel->_raw_size = srel->_cooked_size;
+
+ if (is_plt)
+ {
+ asection *splt, *sgotplt, *srelgot;
+ int reloc_index, chunk;
+
+ /* Find the PLT reloc index of the entry being removed. This
+ is computed from the size of ".rela.plt". It is needed to
+ figure out which PLT chunk to resize. Usually "last index
+ = size - 1" since the index starts at zero, but in this
+ context, the size has just been decremented so there's no
+ need to subtract one. */
+ reloc_index = srel->_cooked_size / sizeof (Elf32_External_Rela);
+
+ chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
+ splt = elf_xtensa_get_plt_section (dynobj, chunk);
+ sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk);
+ BFD_ASSERT (splt != NULL && sgotplt != NULL);
+
+ /* Check if an entire PLT chunk has just been eliminated. */
+ if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0)
+ {
+ /* The two magic GOT entries for that chunk can go away. */
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (srelgot != NULL);
+ srelgot->reloc_count -= 2;
+ srelgot->_cooked_size -= 2 * sizeof (Elf32_External_Rela);
+ /* Shrink _raw_size (see comment above). */
+ srelgot->_raw_size = srelgot->_cooked_size;
+
+ sgotplt->_cooked_size -= 8;
+
+ /* There should be only one entry left (and it will be
+ removed below). */
+ BFD_ASSERT (sgotplt->_cooked_size == 4);
+ BFD_ASSERT (splt->_cooked_size == PLT_ENTRY_SIZE);
+ }
+
+ BFD_ASSERT (sgotplt->_cooked_size >= 4);
+ BFD_ASSERT (splt->_cooked_size >= PLT_ENTRY_SIZE);
+
+ sgotplt->_cooked_size -= 4;
+ splt->_cooked_size -= PLT_ENTRY_SIZE;
+
+ /* Shrink _raw_sizes (see comment above). */
+ sgotplt->_raw_size = sgotplt->_cooked_size;
+ splt->_raw_size = splt->_cooked_size;
+ }
+ }
+}
+
+
+/* This is similar to relax_section except that when a target is moved,
+ we shift addresses up. We also need to modify the size. This
+ algorithm does NOT allow for relocations into the middle of the
+ property sections. */
+
+static bfd_boolean
+relax_property_section (abfd, sec, link_info)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+{
+ Elf_Internal_Rela *internal_relocs;
+ bfd_byte *contents;
+ unsigned i, nexti;
+ bfd_boolean ok = TRUE;
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ if (internal_relocs)
+ {
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel;
+ xtensa_relax_info *target_relax_info;
+ r_reloc r_rel;
+ unsigned r_type;
+ asection *target_sec;
+
+ /* Locally change the source address.
+ Translate the target to the new target address.
+ If it points to this section and has been removed, MOVE IT.
+ Also, don't forget to modify the associated SIZE at
+ (offset + 4). */
+
+ irel = &internal_relocs[i];
+ r_type = ELF32_R_TYPE (irel->r_info);
+ if (r_type == R_XTENSA_NONE)
+ continue;
+
+ r_reloc_init (&r_rel, abfd, irel);
+
+ target_sec = r_reloc_get_section (&r_rel);
+ target_relax_info = get_xtensa_relax_info (target_sec);
+
+ if (target_relax_info
+ && target_relax_info->is_relaxable_literal_section)
+ {
+ /* Translate the relocation's destination. */
+ bfd_vma new_offset;
+ bfd_vma new_end_offset;
+ bfd_byte *size_p;
+ long old_size, new_size;
+
+ new_offset =
+ offset_with_removed_literals (&target_relax_info->removed_list,
+ r_rel.target_offset);
+
+ /* Assert that we are not out of bounds. */
+ size_p = &contents[irel->r_offset + 4];
+ old_size = bfd_get_32 (abfd, &contents[irel->r_offset + 4]);
+
+ new_end_offset =
+ offset_with_removed_literals (&target_relax_info->removed_list,
+ r_rel.target_offset + old_size);
+
+ new_size = new_end_offset - new_offset;
+ if (new_size != old_size)
+ {
+ bfd_put_32 (abfd, new_size, size_p);
+ pin_contents (sec, contents);
+ }
+
+ if (new_offset != r_rel.target_offset)
+ {
+ bfd_vma diff = new_offset - r_rel.target_offset;
+ irel->r_addend += diff;
+ pin_internal_relocs (sec, internal_relocs);
+ }
+ }
+ }
+ }
+
+ /* Combine adjacent property table entries. This is also done in
+ finish_dynamic_sections() but at that point it's too late to
+ reclaim the space in the output section, so we do this twice. */
+
+ if (internal_relocs)
+ {
+ Elf_Internal_Rela *last_irel = NULL;
+ int removed_bytes = 0;
+ bfd_vma offset, last_irel_offset;
+ bfd_vma section_size;
+
+ /* Walk over memory and irels at the same time.
+ This REQUIRES that the internal_relocs be sorted by offset. */
+ qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela),
+ internal_reloc_compare);
+ nexti = 0; /* Index into internal_relocs. */
+
+ pin_internal_relocs (sec, internal_relocs);
+ pin_contents (sec, contents);
+
+ last_irel_offset = (bfd_vma) -1;
+ section_size = (sec->_cooked_size ? sec->_cooked_size : sec->_raw_size);
+ BFD_ASSERT (section_size % 8 == 0);
+
+ for (offset = 0; offset < section_size; offset += 8)
+ {
+ Elf_Internal_Rela *irel, *next_irel;
+ bfd_vma bytes_to_remove, size, actual_offset;
+ bfd_boolean remove_this_irel;
+
+ irel = NULL;
+ next_irel = NULL;
+
+ /* Find the next two relocations (if there are that many left),
+ skipping over any R_XTENSA_NONE relocs. On entry, "nexti" is
+ the starting reloc index. After these two loops, "i"
+ is the index of the first non-NONE reloc past that starting
+ index, and "nexti" is the index for the next non-NONE reloc
+ after "i". */
+
+ for (i = nexti; i < sec->reloc_count; i++)
+ {
+ if (ELF32_R_TYPE (internal_relocs[i].r_info) != R_XTENSA_NONE)
+ {
+ irel = &internal_relocs[i];
+ break;
+ }
+ internal_relocs[i].r_offset -= removed_bytes;
+ }
+
+ for (nexti = i + 1; nexti < sec->reloc_count; nexti++)
+ {
+ if (ELF32_R_TYPE (internal_relocs[nexti].r_info)
+ != R_XTENSA_NONE)
+ {
+ next_irel = &internal_relocs[nexti];
+ break;
+ }
+ internal_relocs[nexti].r_offset -= removed_bytes;
+ }
+
+ remove_this_irel = FALSE;
+ bytes_to_remove = 0;
+ actual_offset = offset - removed_bytes;
+ size = bfd_get_32 (abfd, &contents[actual_offset + 4]);
+
+ /* Check that the irels are sorted by offset,
+ with only one per address. */
+ BFD_ASSERT (!irel || (int) irel->r_offset > (int) last_irel_offset);
+ BFD_ASSERT (!next_irel || next_irel->r_offset > irel->r_offset);
+
+ /* Make sure there isn't a reloc on the size field. */
+ if (irel && irel->r_offset == offset + 4)
+ {
+ irel->r_offset -= removed_bytes;
+ last_irel_offset = irel->r_offset;
+ }
+ else if (next_irel && next_irel->r_offset == offset + 4)
+ {
+ nexti += 1;
+ irel->r_offset -= removed_bytes;
+ next_irel->r_offset -= removed_bytes;
+ last_irel_offset = next_irel->r_offset;
+ }
+ else if (size == 0)
+ {
+ /* Always remove entries with zero size. */
+ bytes_to_remove = 8;
+ if (irel && irel->r_offset == offset)
+ {
+ remove_this_irel = TRUE;
+
+ irel->r_offset -= removed_bytes;
+ last_irel_offset = irel->r_offset;
+ }
+ }
+ else if (irel && irel->r_offset == offset)
+ {
+ if (ELF32_R_TYPE (irel->r_info) == R_XTENSA_32)
+ {
+ if (last_irel)
+ {
+ bfd_vma old_size =
+ bfd_get_32 (abfd, &contents[last_irel->r_offset + 4]);
+ bfd_vma old_address =
+ (last_irel->r_addend
+ + bfd_get_32 (abfd, &contents[last_irel->r_offset]));
+ bfd_vma new_address =
+ (irel->r_addend
+ + bfd_get_32 (abfd, &contents[actual_offset]));
+
+ if ((ELF32_R_SYM (irel->r_info) ==
+ ELF32_R_SYM (last_irel->r_info))
+ && (old_address + old_size == new_address))
+ {
+ /* fix the old size */
+ bfd_put_32 (abfd, old_size + size,
+ &contents[last_irel->r_offset + 4]);
+ bytes_to_remove = 8;
+ remove_this_irel = TRUE;
+ }
+ else
+ last_irel = irel;
+ }
+ else
+ last_irel = irel;
+ }
+
+ irel->r_offset -= removed_bytes;
+ last_irel_offset = irel->r_offset;
+ }
+
+ if (remove_this_irel)
+ {
+ irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE);
+ irel->r_offset -= bytes_to_remove;
+ }
+
+ if (bytes_to_remove != 0)
+ {
+ removed_bytes += bytes_to_remove;
+ if (offset + 8 < section_size)
+ memmove (&contents[actual_offset],
+ &contents[actual_offset+8],
+ section_size - offset - 8);
+ }
+ }
+
+ if (removed_bytes)
+ {
+ /* Clear the removed bytes. */
+ memset (&contents[section_size - removed_bytes], 0, removed_bytes);
+
+ sec->_cooked_size = section_size - removed_bytes;
+ /* Also shrink _raw_size. (The code in relocate_section that
+ checks that relocations are within the section must use
+ _raw_size because of the way the stabs sections are
+ relaxed; shrinking _raw_size means that these checks will
+ not be unnecessarily lax.) */
+ sec->_raw_size = sec->_cooked_size;
+ }
+ }
+
+ error_return:
+ release_internal_relocs (sec, internal_relocs);
+ release_contents (sec, contents);
+ return ok;
+}
+
+
+/* Third relaxation pass. */
+
+/* Change symbol values to account for removed literals. */
+
+bfd_boolean
+relax_section_symbols (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ xtensa_relax_info *relax_info;
+ unsigned int sec_shndx;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Sym *isymbuf;
+ unsigned i, num_syms, num_locals;
+
+ relax_info = get_xtensa_relax_info (sec);
+ BFD_ASSERT (relax_info);
+
+ if (!relax_info->is_relaxable_literal_section)
+ return TRUE;
+
+ sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ isymbuf = retrieve_local_syms (abfd);
+
+ num_syms = symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
+ num_locals = symtab_hdr->sh_info;
+
+ /* Adjust the local symbols defined in this section. */
+ for (i = 0; i < num_locals; i++)
+ {
+ Elf_Internal_Sym *isym = &isymbuf[i];
+
+ if (isym->st_shndx == sec_shndx)
+ {
+ bfd_vma new_address = offset_with_removed_literals
+ (&relax_info->removed_list, isym->st_value);
+ if (new_address != isym->st_value)
+ isym->st_value = new_address;
+ }
+ }
+
+ /* Now adjust the global symbols defined in this section. */
+ for (i = 0; i < (num_syms - num_locals); i++)
+ {
+ struct elf_link_hash_entry *sym_hash;
+
+ sym_hash = elf_sym_hashes (abfd)[i];
+
+ if (sym_hash->root.type == bfd_link_hash_warning)
+ sym_hash = (struct elf_link_hash_entry *) sym_hash->root.u.i.link;
+
+ if ((sym_hash->root.type == bfd_link_hash_defined
+ || sym_hash->root.type == bfd_link_hash_defweak)
+ && sym_hash->root.u.def.section == sec)
+ {
+ bfd_vma new_address = offset_with_removed_literals
+ (&relax_info->removed_list, sym_hash->root.u.def.value);
+ if (new_address != sym_hash->root.u.def.value)
+ sym_hash->root.u.def.value = new_address;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/* "Fix" handling functions, called while performing relocations. */
+
+static void
+do_fix_for_relocateable_link (rel, input_bfd, input_section)
+ Elf_Internal_Rela *rel;
+ bfd *input_bfd;
+ asection *input_section;
+{
+ r_reloc r_rel;
+ asection *sec, *old_sec;
+ bfd_vma old_offset;
+ int r_type = ELF32_R_TYPE (rel->r_info);
+ reloc_bfd_fix *fix_list;
+ reloc_bfd_fix *fix;
+
+ if (r_type == R_XTENSA_NONE)
+ return;
+
+ fix_list = (get_xtensa_relax_info (input_section))->fix_list;
+ if (fix_list == NULL)
+ return;
+
+ fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type);
+ if (fix == NULL)
+ return;
+
+ r_reloc_init (&r_rel, input_bfd, rel);
+ old_sec = r_reloc_get_section (&r_rel);
+ old_offset = r_reloc_get_target_offset (&r_rel);
+
+ if (old_sec == NULL || !r_reloc_is_defined (&r_rel))
+ {
+ BFD_ASSERT (r_type == R_XTENSA_ASM_EXPAND);
+ /* Leave it be. Resolution will happen in a later stage. */
+ }
+ else
+ {
+ sec = fix->target_sec;
+ rel->r_addend += ((sec->output_offset + fix->target_offset)
+ - (old_sec->output_offset + old_offset));
+ }
+}
+
+
+static void
+do_fix_for_final_link (rel, input_section, relocationp)
+ Elf_Internal_Rela *rel;
+ asection *input_section;
+ bfd_vma *relocationp;
+{
+ asection *sec;
+ int r_type = ELF32_R_TYPE (rel->r_info);
+ reloc_bfd_fix *fix_list;
+ reloc_bfd_fix *fix;
+
+ if (r_type == R_XTENSA_NONE)
+ return;
+
+ fix_list = (get_xtensa_relax_info (input_section))->fix_list;
+ if (fix_list == NULL)
+ return;
+
+ fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type);
+ if (fix == NULL)
+ return;
+
+ sec = fix->target_sec;
+ *relocationp = (sec->output_section->vma
+ + sec->output_offset
+ + fix->target_offset - rel->r_addend);
+}
+
+
+/* Miscellaneous utility functions.... */
+
+static asection *
+elf_xtensa_get_plt_section (dynobj, chunk)
+ bfd *dynobj;
+ int chunk;
+{
+ char plt_name[10];
+
+ if (chunk == 0)
+ return bfd_get_section_by_name (dynobj, ".plt");
+
+ sprintf (plt_name, ".plt.%u", chunk);
+ return bfd_get_section_by_name (dynobj, plt_name);
+}
+
+
+static asection *
+elf_xtensa_get_gotplt_section (dynobj, chunk)
+ bfd *dynobj;
+ int chunk;
+{
+ char got_name[14];
+
+ if (chunk == 0)
+ return bfd_get_section_by_name (dynobj, ".got.plt");
+
+ sprintf (got_name, ".got.plt.%u", chunk);
+ return bfd_get_section_by_name (dynobj, got_name);
+}
+
+
+/* Get the input section for a given symbol index.
+ If the symbol is:
+ . a section symbol, return the section;
+ . a common symbol, return the common section;
+ . an undefined symbol, return the undefined section;
+ . an indirect symbol, follow the links;
+ . an absolute value, return the absolute section. */
+
+static asection *
+get_elf_r_symndx_section (abfd, r_symndx)
+ bfd *abfd;
+ unsigned long r_symndx;
+{
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ asection *target_sec = NULL;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ Elf_Internal_Sym *isymbuf;
+ unsigned int section_index;
+
+ isymbuf = retrieve_local_syms (abfd);
+ section_index = isymbuf[r_symndx].st_shndx;
+
+ if (section_index == SHN_UNDEF)
+ target_sec = bfd_und_section_ptr;
+ else if (section_index > 0 && section_index < SHN_LORESERVE)
+ target_sec = bfd_section_from_elf_index (abfd, section_index);
+ else if (section_index == SHN_ABS)
+ target_sec = bfd_abs_section_ptr;
+ else if (section_index == SHN_COMMON)
+ target_sec = bfd_com_section_ptr;
+ else
+ /* Who knows? */
+ target_sec = NULL;
+ }
+ else
+ {
+ unsigned long indx = r_symndx - symtab_hdr->sh_info;
+ struct elf_link_hash_entry *h = elf_sym_hashes (abfd)[indx];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ target_sec = h->root.u.def.section;
+ break;
+ case bfd_link_hash_common:
+ target_sec = bfd_com_section_ptr;
+ break;
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ target_sec = bfd_und_section_ptr;
+ break;
+ default: /* New indirect warning. */
+ target_sec = bfd_und_section_ptr;
+ break;
+ }
+ }
+ return target_sec;
+}
+
+
+static struct elf_link_hash_entry *
+get_elf_r_symndx_hash_entry (abfd, r_symndx)
+ bfd *abfd;
+ unsigned long r_symndx;
+{
+ unsigned long indx;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ return NULL;
+
+ indx = r_symndx - symtab_hdr->sh_info;
+ h = elf_sym_hashes (abfd)[indx];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ return h;
+}
+
+
+/* Get the section-relative offset for a symbol number. */
+
+static bfd_vma
+get_elf_r_symndx_offset (abfd, r_symndx)
+ bfd *abfd;
+ unsigned long r_symndx;
+{
+ Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ bfd_vma offset = 0;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ Elf_Internal_Sym *isymbuf;
+ isymbuf = retrieve_local_syms (abfd);
+ offset = isymbuf[r_symndx].st_value;
+ }
+ else
+ {
+ unsigned long indx = r_symndx - symtab_hdr->sh_info;
+ struct elf_link_hash_entry *h =
+ elf_sym_hashes (abfd)[indx];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ offset = h->root.u.def.value;
+ }
+ return offset;
+}
+
+
+static bfd_boolean
+pcrel_reloc_fits (opnd, self_address, dest_address)
+ xtensa_operand opnd;
+ bfd_vma self_address;
+ bfd_vma dest_address;
+{
+ uint32 new_address =
+ xtensa_operand_do_reloc (opnd, dest_address, self_address);
+ return (xtensa_operand_encode (opnd, &new_address)
+ == xtensa_encode_result_ok);
+}
+
+
+static bfd_boolean
+xtensa_is_property_section (sec)
+ asection *sec;
+{
+ static int len = sizeof (".gnu.linkonce.t.") - 1;
+
+ return (strcmp (".xt.insn", sec->name) == 0
+ || strcmp (".xt.lit", sec->name) == 0
+ || strncmp (".gnu.linkonce.x.", sec->name, len) == 0
+ || strncmp (".gnu.linkonce.p.", sec->name, len) == 0);
+}
+
+
+static bfd_boolean
+is_literal_section (sec)
+ asection *sec;
+{
+ /* FIXME: the current definition of this leaves a lot to be desired.... */
+ if (sec == NULL || sec->name == NULL)
+ return FALSE;
+ return (strstr (sec->name, "literal") != NULL);
+}
+
+
+static int
+internal_reloc_compare (ap, bp)
+ const PTR ap;
+ const PTR bp;
+{
+ const Elf_Internal_Rela *a = (const Elf_Internal_Rela *) ap;
+ const Elf_Internal_Rela *b = (const Elf_Internal_Rela *) bp;
+
+ return (a->r_offset - b->r_offset);
+}
+
+
+static bfd_boolean
+get_is_linkonce_section (abfd, sec)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+{
+ flagword flags, link_once_flags;
+ bfd_boolean is_linkonce = FALSE;;
+
+ flags = bfd_get_section_flags (abfd, sec);
+ link_once_flags = (flags & SEC_LINK_ONCE);
+ if (link_once_flags != 0)
+ is_linkonce = TRUE;
+
+ /* In order for this to be useful to the assembler
+ before the linkonce flag is set we need to
+ check for the GNU extension name. */
+ if (!is_linkonce &&
+ strncmp (sec->name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ is_linkonce = TRUE;
+
+ return is_linkonce;
+}
+
+
+char *
+xtensa_get_property_section_name (abfd, sec, base_name)
+ bfd *abfd;
+ asection *sec;
+ const char * base_name;
+{
+ char *table_sec_name = NULL;
+ bfd_boolean is_linkonce;
+
+ is_linkonce = get_is_linkonce_section (abfd, sec);
+
+ if (!is_linkonce)
+ {
+ table_sec_name = strdup (base_name);
+ }
+ else
+ {
+ static size_t prefix_len = sizeof (".gnu.linkonce.t.") - 1;
+ size_t len = strlen (sec->name) + 1;
+ char repl_char = '\0';
+ const char *segname = sec->name;
+
+ if (strncmp (segname, ".gnu.linkonce.t.", prefix_len) == 0)
+ {
+ if (strcmp (base_name, ".xt.insn") == 0)
+ repl_char = 'x';
+ else if (strcmp (base_name, ".xt.lit") == 0)
+ repl_char = 'p';
+ }
+
+ if (repl_char != '\0')
+ {
+ char *name = (char *) bfd_malloc (len);
+ memcpy (name, sec->name, len);
+ name[prefix_len - 2] = repl_char;
+ table_sec_name = name;
+ }
+ else
+ {
+ size_t base_len = strlen (base_name) + 1;
+ char *name = (char *) bfd_malloc (len + base_len);
+ memcpy (name, sec->name, len - 1);
+ memcpy (name + len - 1, base_name, base_len);
+ table_sec_name = name;
+ }
+ }
+
+ return table_sec_name;
+}
+
+
+/* Other functions called directly by the linker. */
+
+bfd_boolean
+xtensa_callback_required_dependence (abfd, sec, link_info, callback, closure)
+ bfd *abfd;
+ asection *sec;
+ struct bfd_link_info *link_info;
+ deps_callback_t callback;
+ PTR closure;
+{
+ Elf_Internal_Rela *internal_relocs;
+ bfd_byte *contents;
+ unsigned i;
+ bfd_boolean ok = TRUE;
+
+ /* ".plt*" sections have no explicit relocations but they contain L32R
+ instructions that reference the corresponding ".got.plt*" sections. */
+ if ((sec->flags & SEC_LINKER_CREATED) != 0
+ && strncmp (sec->name, ".plt", 4) == 0)
+ {
+ asection *sgotplt;
+
+ /* Find the corresponding ".got.plt*" section. */
+ if (sec->name[4] == '\0')
+ sgotplt = bfd_get_section_by_name (sec->owner, ".got.plt");
+ else
+ {
+ char got_name[14];
+ int chunk = 0;
+
+ BFD_ASSERT (sec->name[4] == '.');
+ chunk = strtol (&sec->name[5], NULL, 10);
+
+ sprintf (got_name, ".got.plt.%u", chunk);
+ sgotplt = bfd_get_section_by_name (sec->owner, got_name);
+ }
+ BFD_ASSERT (sgotplt);
+
+ /* Assume worst-case offsets: L32R at the very end of the ".plt"
+ section referencing a literal at the very beginning of
+ ".got.plt". This is very close to the real dependence, anyway. */
+ (*callback) (sec, sec->_raw_size, sgotplt, 0, closure);
+ }
+
+ internal_relocs = retrieve_internal_relocs (abfd, sec,
+ link_info->keep_memory);
+ if (internal_relocs == NULL
+ || sec->reloc_count == 0)
+ return ok;
+
+ /* Cache the contents for the duration of this scan. */
+ contents = retrieve_contents (abfd, sec, link_info->keep_memory);
+ if (contents == NULL && sec->_raw_size != 0)
+ {
+ ok = FALSE;
+ goto error_return;
+ }
+
+ if (xtensa_default_isa == NULL)
+ xtensa_isa_init ();
+
+ for (i = 0; i < sec->reloc_count; i++)
+ {
+ Elf_Internal_Rela *irel = &internal_relocs[i];
+ if (is_l32r_relocation (sec, contents, irel))
+ {
+ r_reloc l32r_rel;
+ asection *target_sec;
+ bfd_vma target_offset;
+
+ r_reloc_init (&l32r_rel, abfd, irel);
+ target_sec = NULL;
+ target_offset = 0;
+ /* L32Rs must be local to the input file. */
+ if (r_reloc_is_defined (&l32r_rel))
+ {
+ target_sec = r_reloc_get_section (&l32r_rel);
+ target_offset = r_reloc_get_target_offset (&l32r_rel);
+ }
+ (*callback) (sec, irel->r_offset, target_sec, target_offset,
+ closure);
+ }
+ }
+
+ error_return:
+ release_internal_relocs (sec, internal_relocs);
+ release_contents (sec, contents);
+ return ok;
+}
+
+
+#ifndef ELF_ARCH
+#define TARGET_LITTLE_SYM bfd_elf32_xtensa_le_vec
+#define TARGET_LITTLE_NAME "elf32-xtensa-le"
+#define TARGET_BIG_SYM bfd_elf32_xtensa_be_vec
+#define TARGET_BIG_NAME "elf32-xtensa-be"
+#define ELF_ARCH bfd_arch_xtensa
+
+/* The new EM_XTENSA value will be recognized beginning in the Xtensa T1040
+ release. However, we still have to generate files with the EM_XTENSA_OLD
+ value so that pre-T1040 tools can read the files. As soon as we stop
+ caring about pre-T1040 tools, the following two values should be
+ swapped. At the same time, any other code that uses EM_XTENSA_OLD
+ (e.g., prep_headers() in elf.c) should be changed to use EM_XTENSA. */
+#define ELF_MACHINE_CODE EM_XTENSA_OLD
+#define ELF_MACHINE_ALT1 EM_XTENSA
+
+#if XCHAL_HAVE_MMU
+#define ELF_MAXPAGESIZE (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE)
+#else /* !XCHAL_HAVE_MMU */
+#define ELF_MAXPAGESIZE 1
+#endif /* !XCHAL_HAVE_MMU */
+#endif /* ELF_ARCH */
+
+#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
+#define elf_backend_plt_readonly 1
+#define elf_backend_got_header_size 4
+#define elf_backend_want_dynbss 0
+#define elf_backend_want_got_plt 1
+
+#define elf_info_to_howto elf_xtensa_info_to_howto_rela
+
+#define bfd_elf32_bfd_final_link bfd_elf32_bfd_final_link
+#define bfd_elf32_bfd_merge_private_bfd_data elf_xtensa_merge_private_bfd_data
+#define bfd_elf32_new_section_hook elf_xtensa_new_section_hook
+#define bfd_elf32_bfd_print_private_bfd_data elf_xtensa_print_private_bfd_data
+#define bfd_elf32_bfd_relax_section elf_xtensa_relax_section
+#define bfd_elf32_bfd_reloc_type_lookup elf_xtensa_reloc_type_lookup
+#define bfd_elf32_bfd_set_private_flags elf_xtensa_set_private_flags
+
+#define elf_backend_adjust_dynamic_symbol elf_xtensa_adjust_dynamic_symbol
+#define elf_backend_check_relocs elf_xtensa_check_relocs
+#define elf_backend_copy_indirect_symbol elf_xtensa_copy_indirect_symbol
+#define elf_backend_create_dynamic_sections elf_xtensa_create_dynamic_sections
+#define elf_backend_discard_info elf_xtensa_discard_info
+#define elf_backend_ignore_discarded_relocs elf_xtensa_ignore_discarded_relocs
+#define elf_backend_final_write_processing elf_xtensa_final_write_processing
+#define elf_backend_finish_dynamic_sections elf_xtensa_finish_dynamic_sections
+#define elf_backend_finish_dynamic_symbol elf_xtensa_finish_dynamic_symbol
+#define elf_backend_gc_mark_hook elf_xtensa_gc_mark_hook
+#define elf_backend_gc_sweep_hook elf_xtensa_gc_sweep_hook
+#define elf_backend_grok_prstatus elf_xtensa_grok_prstatus
+#define elf_backend_grok_psinfo elf_xtensa_grok_psinfo
+#define elf_backend_hide_symbol elf_xtensa_hide_symbol
+#define elf_backend_modify_segment_map elf_xtensa_modify_segment_map
+#define elf_backend_object_p elf_xtensa_object_p
+#define elf_backend_reloc_type_class elf_xtensa_reloc_type_class
+#define elf_backend_relocate_section elf_xtensa_relocate_section
+#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections
+
+#include "elf32-target.h"
diff --git a/bfd/elflink.h b/bfd/elflink.h
index c39120d..3535da5 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -1940,7 +1940,7 @@ elf_link_add_object_symbols (abfd, info)
might be needed here. */
if (isym->st_other != 0)
{
- unsigned char hvis, symvis, other;
+ unsigned char hvis, symvis, other, nvis;
/* Take the balance of OTHER from the definition. */
other = (definition ? isym->st_other : h->other);
@@ -1949,8 +1949,14 @@ elf_link_add_object_symbols (abfd, info)
/* Combine visibilities, using the most constraining one. */
hvis = ELF_ST_VISIBILITY (h->other);
symvis = ELF_ST_VISIBILITY (isym->st_other);
+ if (! hvis)
+ nvis = symvis;
+ else if (! symvis)
+ nvis = hvis;
+ else
+ nvis = hvis < symvis ? hvis : symvis;
- h->other = other | (hvis > symvis ? hvis : symvis);
+ h->other = other | nvis;
}
/* Set a flag in the hash table entry indicating the type of
@@ -4849,6 +4855,7 @@ elf_link_sort_relocs (abfd, info, psec)
}
}
+ free (sort);
*psec = reldyn;
return ret;
}
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index d46d78c..3c8ec9e 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -357,6 +357,10 @@ elfNN_ia64_reloc (abfd, reloc, sym, data, input_section,
reloc->address += input_section->output_offset;
return bfd_reloc_ok;
}
+
+ if (input_section->flags & SEC_DEBUGGING)
+ return bfd_reloc_continue;
+
*error_message = "Unsupported call to elfNN_ia64_reloc";
return bfd_reloc_notsupported;
}
@@ -1032,6 +1036,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
struct elfNN_ia64_allocate_data data;
data.info = link_info;
data.ofs = 0;
+ ia64_info->self_dtpmod_offset = (bfd_vma) -1;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
@@ -1787,19 +1792,24 @@ elfNN_ia64_hash_table_create (abfd)
{
struct elfNN_ia64_link_hash_table *ret;
- ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret));
+ ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
if (!ret)
return 0;
+
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
elfNN_ia64_new_elf_hash_entry))
{
- bfd_release (abfd, ret);
+ free (ret);
return 0;
}
if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd,
elfNN_ia64_new_loc_hash_entry))
- return 0;
+ {
+ free (ret);
+ return 0;
+ }
+
return &ret->root.root;
}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index c8c9870..fa165d9 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7716,55 +7716,58 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local)
h->forced_local = TRUE;
dynobj = elf_hash_table (info)->dynobj;
- got = mips_elf_got_section (dynobj, FALSE);
- g = mips_elf_section_data (got)->u.got_info;
-
- if (g->next)
+ if (dynobj != NULL)
{
- struct mips_got_entry e;
- struct mips_got_info *gg = g;
+ got = mips_elf_got_section (dynobj, FALSE);
+ g = mips_elf_section_data (got)->u.got_info;
- /* Since we're turning what used to be a global symbol into a
- local one, bump up the number of local entries of each GOT
- that had an entry for it. This will automatically decrease
- the number of global entries, since global_gotno is actually
- the upper limit of global entries. */
- e.abfd = dynobj;
- e.symndx = -1;
- e.d.h = h;
+ if (g->next)
+ {
+ struct mips_got_entry e;
+ struct mips_got_info *gg = g;
+
+ /* Since we're turning what used to be a global symbol into a
+ local one, bump up the number of local entries of each GOT
+ that had an entry for it. This will automatically decrease
+ the number of global entries, since global_gotno is actually
+ the upper limit of global entries. */
+ e.abfd = dynobj;
+ e.symndx = -1;
+ e.d.h = h;
- for (g = g->next; g != gg; g = g->next)
- if (htab_find (g->got_entries, &e))
- {
- BFD_ASSERT (g->global_gotno > 0);
- g->local_gotno++;
- g->global_gotno--;
- }
+ for (g = g->next; g != gg; g = g->next)
+ if (htab_find (g->got_entries, &e))
+ {
+ BFD_ASSERT (g->global_gotno > 0);
+ g->local_gotno++;
+ g->global_gotno--;
+ }
- /* If this was a global symbol forced into the primary GOT, we
- no longer need an entry for it. We can't release the entry
- at this point, but we must at least stop counting it as one
- of the symbols that required a forced got entry. */
- if (h->root.got.offset == 2)
+ /* If this was a global symbol forced into the primary GOT, we
+ no longer need an entry for it. We can't release the entry
+ at this point, but we must at least stop counting it as one
+ of the symbols that required a forced got entry. */
+ if (h->root.got.offset == 2)
+ {
+ BFD_ASSERT (gg->assigned_gotno > 0);
+ gg->assigned_gotno--;
+ }
+ }
+ else if (g->global_gotno == 0 && g->global_gotsym == NULL)
+ /* If we haven't got through GOT allocation yet, just bump up the
+ number of local entries, as this symbol won't be counted as
+ global. */
+ g->local_gotno++;
+ else if (h->root.got.offset == 1)
{
- BFD_ASSERT (gg->assigned_gotno > 0);
- gg->assigned_gotno--;
+ /* If we're past non-multi-GOT allocation and this symbol had
+ been marked for a global got entry, give it a local entry
+ instead. */
+ BFD_ASSERT (g->global_gotno > 0);
+ g->local_gotno++;
+ g->global_gotno--;
}
}
- else if (g->global_gotno == 0 && g->global_gotsym == NULL)
- /* If we haven't got through GOT allocation yet, just bump up the
- number of local entries, as this symbol won't be counted as
- global. */
- g->local_gotno++;
- else if (h->root.got.offset == 1)
- {
- /* If we're past non-multi-GOT allocation and this symbol had
- been marked for a global got entry, give it a local entry
- instead. */
- BFD_ASSERT (g->global_gotno > 0);
- g->local_gotno++;
- g->global_gotno--;
- }
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
}
diff --git a/bfd/format.c b/bfd/format.c
index 9af6efc..655ccd9 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -163,7 +163,11 @@ bfd_check_format_matches (abfd, format, matching)
if (!abfd->target_defaulted)
{
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
- return FALSE;
+ {
+ if (matching)
+ free ((PTR) matching_vector);
+ return FALSE;
+ }
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -214,7 +218,11 @@ bfd_check_format_matches (abfd, format, matching)
abfd->xvec = *target; /* Change BFD's target temporarily. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
- return FALSE;
+ {
+ if (matching)
+ free ((PTR) matching_vector);
+ return FALSE;
+ }
/* If _bfd_check_format neglects to set bfd_error, assume
bfd_error_wrong_format. We didn't used to even pay any
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index df2ba3e..9bbdebd 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1475,6 +1475,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_IQ2000_OFFSET_16",
"BFD_RELOC_IQ2000_OFFSET_21",
"BFD_RELOC_IQ2000_UHI16",
+ "BFD_RELOC_XTENSA_RTLD",
+ "BFD_RELOC_XTENSA_GLOB_DAT",
+ "BFD_RELOC_XTENSA_JMP_SLOT",
+ "BFD_RELOC_XTENSA_RELATIVE",
+ "BFD_RELOC_XTENSA_PLT",
+ "BFD_RELOC_XTENSA_OP0",
+ "BFD_RELOC_XTENSA_OP1",
+ "BFD_RELOC_XTENSA_OP2",
+ "BFD_RELOC_XTENSA_ASM_EXPAND",
+ "BFD_RELOC_XTENSA_ASM_SIMPLIFY",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
diff --git a/bfd/libpei.h b/bfd/libpei.h
index 7a5f9fe..72fa7b5 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -1,31 +1,29 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/*
-Most of this hacked by Steve Chamberlain,
+/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
-PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc.
-*/
+ PE/PEI rearrangement (and code added): Donn Terry
+ Softway Systems, Inc. */
/* Hey look, some documentation [and in a place you expect to find it]!
@@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry
FIXME: Please add more docs here so the next poor fool that has to hack
on this code has a chance of getting something accomplished without
- wasting too much time.
-*/
+ wasting too much time. */
#ifndef GET_FCN_LNNOPTR
#define GET_FCN_LNNOPTR(abfd, ext) \
@@ -333,3 +330,6 @@ unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
bfd_boolean _bfd_XX_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
+
+/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
+#define bfd_pe_executable_p(abfd) (strncmp ((abfd)->xvec->name, "pei-", 4) == 0)
diff --git a/bfd/linker.c b/bfd/linker.c
index 918f4f8..c0e3236 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1,23 +1,23 @@
/* linker.c -- BFD linker routines
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
@@ -2081,12 +2081,12 @@ _bfd_generic_final_link (abfd, info)
input_section,
relocs,
symbols);
+ free (relocs);
if (reloc_count < 0)
return FALSE;
BFD_ASSERT ((unsigned long) reloc_count
== input_section->reloc_count);
o->reloc_count += reloc_count;
- free (relocs);
}
}
if (o->reloc_count > 0)
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 81bd2c8..4771979 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -931,8 +931,13 @@ find_separate_debug_file (abfd, debug_file_directory)
basename = get_debug_link_info (abfd, & crc32);
- if (basename == NULL || strlen (basename) < 1)
+ if (basename == NULL)
return NULL;
+ if (strlen (basename) < 1)
+ {
+ free (basename);
+ return NULL;
+ }
dir = xstrdup (abfd->filename);
BFD_ASSERT (strlen (dir) != 0);
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 9ab72d0..ba1c219 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; the common executable parts.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
@@ -906,12 +906,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
sometimes). */
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
- ps = scnhdr_int->s_size;
- ss = 0;
+ if (bfd_pe_executable_p (abfd))
+ {
+ ps = scnhdr_int->s_size;
+ ss = 0;
+ }
+ else
+ {
+ ps = 0;
+ ss = scnhdr_int->s_size;
+ }
}
else
{
- ps = scnhdr_int->s_paddr;
+ if (bfd_pe_executable_p (abfd))
+ ps = scnhdr_int->s_paddr;
+ else
+ ps = 0;
+
ss = scnhdr_int->s_size;
}
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 2dff0ac..c5df62d 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1,31 +1,29 @@
/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Cygnus Solutions.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/*
-Most of this hacked by Steve Chamberlain,
+/* Most of this hacked by Steve Chamberlain,
sac@cygnus.com
-PE/PEI rearrangement (and code added): Donn Terry
- Softway Systems, Inc.
-*/
+ PE/PEI rearrangement (and code added): Donn Terry
+ Softway Systems, Inc. */
/* Hey look, some documentation [and in a place you expect to find it]!
@@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry
FIXME: Please add more docs here so the next poor fool that has to hack
on this code has a chance of getting something accomplished without
- wasting too much time.
-*/
+ wasting too much time. */
#include "libpei.h"
@@ -264,7 +261,11 @@ coff_swap_scnhdr_in (abfd, ext, in)
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
&& (scnhdr_int->s_paddr > 0))
{
- scnhdr_int->s_size = scnhdr_int->s_paddr;
+ /* Always set it for non pe-obj files, and don't overwrite it
+ if it's zero for object files. */
+ if (! bfd_pe_executable_p (abfd) || !scnhdr_int->s_size)
+ scnhdr_int->s_size = scnhdr_int->s_paddr;
+
/* This code used to set scnhdr_int->s_paddr to 0. However,
coff_set_alignment_hook stores s_paddr in virt_size, which
only works if it correctly holds the virtual size of the
diff --git a/bfd/reloc.c b/bfd/reloc.c
index f4a3321..aa2321f 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -3850,6 +3850,49 @@ ENUMX
ENUMDOC
IQ2000 Relocations.
+ENUM
+ BFD_RELOC_XTENSA_RTLD
+ENUMDOC
+ Special Xtensa relocation used only by PLT entries in ELF shared
+ objects to indicate that the runtime linker should set the value
+ to one of its own internal functions or data structures.
+ENUM
+ BFD_RELOC_XTENSA_GLOB_DAT
+ENUMX
+ BFD_RELOC_XTENSA_JMP_SLOT
+ENUMX
+ BFD_RELOC_XTENSA_RELATIVE
+ENUMDOC
+ Xtensa relocations for ELF shared objects.
+ENUM
+ BFD_RELOC_XTENSA_PLT
+ENUMDOC
+ Xtensa relocation used in ELF object files for symbols that may require
+ PLT entries. Otherwise, this is just a generic 32-bit relocation.
+ENUM
+ BFD_RELOC_XTENSA_OP0
+ENUMX
+ BFD_RELOC_XTENSA_OP1
+ENUMX
+ BFD_RELOC_XTENSA_OP2
+ENUMDOC
+ Generic Xtensa relocations. Only the operand number is encoded
+ in the relocation. The details are determined by extracting the
+ instruction opcode.
+ENUM
+ BFD_RELOC_XTENSA_ASM_EXPAND
+ENUMDOC
+ Xtensa relocation to mark that the assembler expanded the
+ instructions from an original target. The expansion size is
+ encoded in the reloc size.
+ENUM
+ BFD_RELOC_XTENSA_ASM_SIMPLIFY
+ENUMDOC
+ Xtensa relocation to mark that the linker should simplify
+ assembler-expanded instructions. This is commonly used
+ internally by the linker after analysis of a
+ BFD_RELOC_XTENSA_ASM_EXPAND.
+
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT
diff --git a/bfd/simple.c b/bfd/simple.c
index 88f1337..a91d118 100644
--- a/bfd/simple.c
+++ b/bfd/simple.c
@@ -1,5 +1,5 @@
/* simple.c -- BFD simple client routines
- Copyright 2002
+ Copyright 2002, 2003
Free Software Foundation, Inc.
Contributed by MontaVista Software, Inc.
@@ -42,8 +42,14 @@ static bfd_boolean simple_dummy_reloc_dangerous
static bfd_boolean simple_dummy_unattached_reloc
PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
+static void simple_save_output_info
+ PARAMS ((bfd *, asection *, PTR));
+
+static void simple_restore_output_info
+ PARAMS ((bfd *, asection *, PTR));
+
bfd_byte * bfd_simple_get_relocated_section_contents
- PARAMS ((bfd *, asection *, bfd_byte *));
+ PARAMS ((bfd *, asection *, bfd_byte *, asymbol **));
static bfd_boolean
simple_dummy_warning (link_info, warning, symbol, abfd, section, address)
@@ -105,17 +111,48 @@ simple_dummy_unattached_reloc (link_info, name, abfd, section, address)
return TRUE;
}
+struct saved_output_info
+{
+ bfd_vma offset;
+ asection *section;
+};
+
+static void
+simple_save_output_info (abfd, section, ptr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *section;
+ PTR ptr;
+{
+ struct saved_output_info *output_info = (struct saved_output_info *) ptr;
+ output_info[section->index].offset = section->output_offset;
+ output_info[section->index].section = section->output_section;
+ section->output_offset = 0;
+ section->output_section = section;
+}
+
+static void
+simple_restore_output_info (abfd, section, ptr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *section;
+ PTR ptr;
+{
+ struct saved_output_info *output_info = (struct saved_output_info *) ptr;
+ section->output_offset = output_info[section->index].offset;
+ section->output_section = output_info[section->index].section;
+}
+
/*
FUNCTION
bfd_simple_relocate_secton
SYNOPSIS
- bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf);
+ bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
DESCRIPTION
- Returns the relocated contents of section @var{sec}. Only symbols
- from @var{abfd} and the output offsets assigned to sections in
- @var{abfd} are used. The result will be stored at @var{outbuf}
+ Returns the relocated contents of section @var{sec}. The symbols in
+ @var{symbol_table} will be used, or the symbols from @var{abfd} if
+ @var{symbol_table} is NULL. The output offsets for all sections will
+ be temporarily reset to 0. The result will be stored at @var{outbuf}
or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}.
Generally all sections in @var{abfd} should have their
@@ -126,17 +163,18 @@ DESCRIPTION
*/
bfd_byte *
-bfd_simple_get_relocated_section_contents (abfd, sec, outbuf)
+bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table)
bfd *abfd;
asection *sec;
bfd_byte *outbuf;
+ asymbol **symbol_table;
{
struct bfd_link_info link_info;
struct bfd_link_order link_order;
struct bfd_link_callbacks callbacks;
bfd_byte *contents, *data;
- int storage_needed, number_of_symbols;
- asymbol **symbol_table;
+ int storage_needed;
+ PTR saved_offsets;
if (! (sec->flags & SEC_RELOC))
{
@@ -183,11 +221,36 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf)
return NULL;
outbuf = data;
}
- bfd_link_add_symbols (abfd, &link_info);
- storage_needed = bfd_get_symtab_upper_bound (abfd);
- symbol_table = (asymbol **) bfd_malloc (storage_needed);
- number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+ /* The sections in ABFD may already have output sections and offsets set.
+ Because this function is primarily for debug sections, and GCC uses the
+ knowledge that debug sections will generally have VMA 0 when emiting
+ relocations between DWARF-2 sections (which are supposed to be
+ section-relative offsets anyway), we need to reset the output offsets
+ to zero. We also need to arrange for section->output_section->vma plus
+ section->output_offset to equal section->vma, which we do by setting
+ section->output_section to point back to section. Save the original
+ output offset and output section to restore later. */
+ saved_offsets = malloc (sizeof (struct saved_output_info)
+ * abfd->section_count);
+ if (saved_offsets == NULL)
+ {
+ if (data)
+ free (data);
+ return NULL;
+ }
+ bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets);
+
+ if (symbol_table == NULL)
+ {
+ bfd_link_add_symbols (abfd, &link_info);
+
+ storage_needed = bfd_get_symtab_upper_bound (abfd);
+ symbol_table = (asymbol **) bfd_malloc (storage_needed);
+ bfd_canonicalize_symtab (abfd, symbol_table);
+ }
+ else
+ storage_needed = 0;
contents = bfd_get_relocated_section_contents (abfd,
&link_info,
@@ -198,6 +261,12 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf)
if (contents == NULL && data != NULL)
free (data);
+ if (storage_needed != 0)
+ free (symbol_table);
+
+ bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets);
+ free (saved_offsets);
+
/* Foul hack to prevent bfd_section_size aborts. This flag only controls
that macro (and the related size macros), selecting between _raw_size
and _cooked_size. Debug sections won't change size while we're only
diff --git a/bfd/targets.c b/bfd/targets.c
index 2211e12..5ccae2a 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -579,6 +579,8 @@ extern const bfd_target bfd_elf32_us_cris_vec;
extern const bfd_target bfd_elf32_v850_vec;
extern const bfd_target bfd_elf32_vax_vec;
extern const bfd_target bfd_elf32_xstormy16_vec;
+extern const bfd_target bfd_elf32_xtensa_be_vec;
+extern const bfd_target bfd_elf32_xtensa_le_vec;
extern const bfd_target bfd_elf64_alpha_freebsd_vec;
extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
@@ -871,6 +873,8 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf32_v850_vec,
&bfd_elf32_vax_vec,
&bfd_elf32_xstormy16_vec,
+ &bfd_elf32_xtensa_be_vec,
+ &bfd_elf32_xtensa_le_vec,
#ifdef BFD64
&bfd_elf64_alpha_freebsd_vec,
&bfd_elf64_alpha_vec,
diff --git a/bfd/version.h b/bfd/version.h
index 6d6a9a8..bd19d02 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030326
+#define BFD_VERSION_DATE 20030403
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_string@
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
new file mode 100644
index 0000000..ffbef53
--- /dev/null
+++ b/bfd/xtensa-isa.c
@@ -0,0 +1,593 @@
+/* Configurable Xtensa ISA support.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+
+#include "xtensa-isa.h"
+#include "xtensa-isa-internal.h"
+
+xtensa_isa xtensa_default_isa = NULL;
+
+static int
+opname_lookup_compare (const void *v1, const void *v2)
+{
+ opname_lookup_entry *e1 = (opname_lookup_entry *)v1;
+ opname_lookup_entry *e2 = (opname_lookup_entry *)v2;
+
+ return strcmp (e1->key, e2->key);
+}
+
+
+xtensa_isa
+xtensa_isa_init (void)
+{
+ xtensa_isa isa;
+ int mod;
+
+ isa = xtensa_load_isa (0);
+ if (isa == 0)
+ {
+ fprintf (stderr, "Failed to initialize Xtensa base ISA module\n");
+ return NULL;
+ }
+
+ for (mod = 1; xtensa_isa_modules[mod].get_num_opcodes_fn; mod++)
+ {
+ if (!xtensa_extend_isa (isa, mod))
+ {
+ fprintf (stderr, "Failed to initialize Xtensa TIE ISA module\n");
+ return NULL;
+ }
+ }
+
+ return isa;
+}
+
+/* ISA information. */
+
+static int
+xtensa_check_isa_config (xtensa_isa_internal *isa,
+ struct config_struct *config_table)
+{
+ int i, j;
+
+ if (!config_table)
+ {
+ fprintf (stderr, "Error: Empty configuration table in ISA DLL\n");
+ return 0;
+ }
+
+ /* For the first module, save a pointer to the table and record the
+ specified endianness and availability of the density option. */
+
+ if (isa->num_modules == 0)
+ {
+ int found_memory_order = 0;
+
+ isa->config = config_table;
+ isa->has_density = 1; /* Default to have density option. */
+
+ for (i = 0; config_table[i].param_name; i++)
+ {
+ if (!strcmp (config_table[i].param_name, "IsaMemoryOrder"))
+ {
+ isa->is_big_endian =
+ (strcmp (config_table[i].param_value, "BigEndian") == 0);
+ found_memory_order = 1;
+ }
+ if (!strcmp (config_table[i].param_name, "IsaUseDensityInstruction"))
+ {
+ isa->has_density = atoi (config_table[i].param_value);
+ }
+ }
+ if (!found_memory_order)
+ {
+ fprintf (stderr, "Error: \"IsaMemoryOrder\" missing from "
+ "configuration table in ISA DLL\n");
+ return 0;
+ }
+
+ return 1;
+ }
+
+ /* For subsequent modules, check that the parameters match. Note: This
+ code is sufficient to handle the current model where there are never
+ more than 2 modules; we might at some point want to handle cases where
+ module N > 0 specifies some parameters not included in the base table,
+ and we would then add those to isa->config so that subsequent modules
+ would check against them. */
+
+ for (i = 0; config_table[i].param_name; i++)
+ {
+ for (j = 0; isa->config[j].param_name; j++)
+ {
+ if (!strcmp (config_table[i].param_name, isa->config[j].param_name))
+ {
+ int mismatch;
+ if (!strcmp (config_table[i].param_name, "IsaCoprocessorCount"))
+ {
+ /* Only require the coprocessor count to be <= the base. */
+ int tiecnt = atoi (config_table[i].param_value);
+ int basecnt = atoi (isa->config[j].param_value);
+ mismatch = (tiecnt > basecnt);
+ }
+ else
+ mismatch = strcmp (config_table[i].param_value,
+ isa->config[j].param_value);
+ if (mismatch)
+ {
+#define MISMATCH_MESSAGE \
+"Error: Configuration mismatch in the \"%s\" parameter:\n\
+the configuration used when the TIE file was compiled had a value of\n\
+\"%s\", while the current configuration has a value of\n\
+\"%s\". Please rerun the TIE compiler with a matching\n\
+configuration.\n"
+ fprintf (stderr, MISMATCH_MESSAGE,
+ config_table[i].param_name,
+ config_table[i].param_value,
+ isa->config[j].param_value);
+ return 0;
+ }
+ break;
+ }
+ }
+ }
+
+ return 1;
+}
+
+
+static int
+xtensa_add_isa (xtensa_isa_internal *isa, libisa_module_specifier libisa)
+{
+ const int (*get_num_opcodes_fn) (void);
+ struct config_struct *(*get_config_table_fn) (void);
+ xtensa_opcode_internal **(*get_opcodes_fn) (void);
+ int (*decode_insn_fn) (const xtensa_insnbuf);
+ xtensa_opcode_internal **opcodes;
+ int opc, insn_size, prev_num_opcodes, new_num_opcodes, this_module;
+
+ get_num_opcodes_fn = xtensa_isa_modules[libisa].get_num_opcodes_fn;
+ get_opcodes_fn = xtensa_isa_modules[libisa].get_opcodes_fn;
+ decode_insn_fn = xtensa_isa_modules[libisa].decode_insn_fn;
+ get_config_table_fn = xtensa_isa_modules[libisa].get_config_table_fn;
+
+ if (!get_num_opcodes_fn || !get_opcodes_fn || !decode_insn_fn
+ || (!get_config_table_fn && isa->num_modules == 0))
+ return 0;
+
+ if (get_config_table_fn
+ && !xtensa_check_isa_config (isa, get_config_table_fn ()))
+ return 0;
+
+ prev_num_opcodes = isa->num_opcodes;
+ new_num_opcodes = (*get_num_opcodes_fn) ();
+
+ isa->num_opcodes += new_num_opcodes;
+ isa->opcode_table = (xtensa_opcode_internal **)
+ realloc (isa->opcode_table, isa->num_opcodes *
+ sizeof (xtensa_opcode_internal *));
+ isa->opname_lookup_table = (opname_lookup_entry *)
+ realloc (isa->opname_lookup_table, isa->num_opcodes *
+ sizeof (opname_lookup_entry));
+
+ opcodes = (*get_opcodes_fn) ();
+
+ insn_size = isa->insn_size;
+ for (opc = 0; opc < new_num_opcodes; opc++)
+ {
+ xtensa_opcode_internal *intopc = opcodes[opc];
+ int newopc = prev_num_opcodes + opc;
+ isa->opcode_table[newopc] = intopc;
+ isa->opname_lookup_table[newopc].key = intopc->name;
+ isa->opname_lookup_table[newopc].opcode = newopc;
+ if (intopc->length > insn_size)
+ insn_size = intopc->length;
+ }
+
+ isa->insn_size = insn_size;
+ isa->insnbuf_size = ((isa->insn_size + sizeof (xtensa_insnbuf_word) - 1) /
+ sizeof (xtensa_insnbuf_word));
+
+ qsort (isa->opname_lookup_table, isa->num_opcodes,
+ sizeof (opname_lookup_entry), opname_lookup_compare);
+
+ /* Check for duplicate opcode names. */
+ for (opc = 1; opc < isa->num_opcodes; opc++)
+ {
+ if (!opname_lookup_compare (&isa->opname_lookup_table[opc-1],
+ &isa->opname_lookup_table[opc]))
+ {
+ fprintf (stderr, "Error: Duplicate TIE opcode \"%s\"\n",
+ isa->opname_lookup_table[opc].key);
+ return 0;
+ }
+ }
+
+ this_module = isa->num_modules;
+ isa->num_modules += 1;
+
+ isa->module_opcode_base = (int *) realloc (isa->module_opcode_base,
+ isa->num_modules * sizeof (int));
+ isa->module_decode_fn = (xtensa_insn_decode_fn *)
+ realloc (isa->module_decode_fn, isa->num_modules *
+ sizeof (xtensa_insn_decode_fn));
+
+ isa->module_opcode_base[this_module] = prev_num_opcodes;
+ isa->module_decode_fn[this_module] = decode_insn_fn;
+
+ xtensa_default_isa = isa;
+
+ return 1; /* Library was successfully added. */
+}
+
+
+xtensa_isa
+xtensa_load_isa (libisa_module_specifier libisa)
+{
+ xtensa_isa_internal *isa;
+
+ isa = (xtensa_isa_internal *) malloc (sizeof (xtensa_isa_internal));
+ memset (isa, 0, sizeof (xtensa_isa_internal));
+ if (!xtensa_add_isa (isa, libisa))
+ {
+ xtensa_isa_free (isa);
+ return NULL;
+ }
+ return (xtensa_isa) isa;
+}
+
+
+int
+xtensa_extend_isa (xtensa_isa isa, libisa_module_specifier libisa)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return xtensa_add_isa (intisa, libisa);
+}
+
+
+void
+xtensa_isa_free (xtensa_isa isa)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ if (intisa->opcode_table)
+ free (intisa->opcode_table);
+ if (intisa->opname_lookup_table)
+ free (intisa->opname_lookup_table);
+ if (intisa->module_opcode_base)
+ free (intisa->module_opcode_base);
+ if (intisa->module_decode_fn)
+ free (intisa->module_decode_fn);
+ free (intisa);
+}
+
+
+int
+xtensa_insn_maxlength (xtensa_isa isa)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return intisa->insn_size;
+}
+
+
+int
+xtensa_insnbuf_size (xtensa_isa isa)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *)isa;
+ return intisa->insnbuf_size;
+}
+
+
+int
+xtensa_num_opcodes (xtensa_isa isa)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return intisa->num_opcodes;
+}
+
+
+xtensa_opcode
+xtensa_opcode_lookup (xtensa_isa isa, const char *opname)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ opname_lookup_entry entry, *result;
+
+ entry.key = opname;
+ result = bsearch (&entry, intisa->opname_lookup_table, intisa->num_opcodes,
+ sizeof (opname_lookup_entry), opname_lookup_compare);
+ if (!result) return XTENSA_UNDEFINED;
+ return result->opcode;
+}
+
+
+xtensa_opcode
+xtensa_decode_insn (xtensa_isa isa, const xtensa_insnbuf insn)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ int n, opc;
+ for (n = 0; n < intisa->num_modules; n++) {
+ opc = (intisa->module_decode_fn[n]) (insn);
+ if (opc != XTENSA_UNDEFINED)
+ return intisa->module_opcode_base[n] + opc;
+ }
+ return XTENSA_UNDEFINED;
+}
+
+
+/* Opcode information. */
+
+void
+xtensa_encode_insn (xtensa_isa isa, xtensa_opcode opc, xtensa_insnbuf insn)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ xtensa_insnbuf template = intisa->opcode_table[opc]->template();
+ int len = intisa->opcode_table[opc]->length;
+ int n;
+
+ /* Convert length to 32-bit words. */
+ len = (len + 3) / 4;
+
+ /* Copy the template. */
+ for (n = 0; n < len; n++)
+ insn[n] = template[n];
+
+ /* Fill any unused buffer space with zeros. */
+ for ( ; n < intisa->insnbuf_size; n++)
+ insn[n] = 0;
+}
+
+
+const char *
+xtensa_opcode_name (xtensa_isa isa, xtensa_opcode opc)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return intisa->opcode_table[opc]->name;
+}
+
+
+int
+xtensa_insn_length (xtensa_isa isa, xtensa_opcode opc)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return intisa->opcode_table[opc]->length;
+}
+
+
+int
+xtensa_insn_length_from_first_byte (xtensa_isa isa, char first_byte)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ int is_density = (first_byte & (intisa->is_big_endian ? 0x80 : 0x08)) != 0;
+ return (intisa->has_density && is_density ? 2 : 3);
+}
+
+
+int
+xtensa_num_operands (xtensa_isa isa, xtensa_opcode opc)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ return intisa->opcode_table[opc]->iclass->num_operands;
+}
+
+
+xtensa_operand
+xtensa_get_operand (xtensa_isa isa, xtensa_opcode opc, int opnd)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ xtensa_iclass_internal *iclass = intisa->opcode_table[opc]->iclass;
+ if (opnd >= iclass->num_operands)
+ return NULL;
+ return (xtensa_operand) iclass->operands[opnd];
+}
+
+
+/* Operand information. */
+
+char *
+xtensa_operand_kind (xtensa_operand opnd)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return intop->operand_kind;
+}
+
+
+char
+xtensa_operand_inout (xtensa_operand opnd)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return intop->inout;
+}
+
+
+uint32
+xtensa_operand_get_field (xtensa_operand opnd, const xtensa_insnbuf insn)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return (*intop->get_field) (insn);
+}
+
+
+void
+xtensa_operand_set_field (xtensa_operand opnd, xtensa_insnbuf insn, uint32 val)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return (*intop->set_field) (insn, val);
+}
+
+
+xtensa_encode_result
+xtensa_operand_encode (xtensa_operand opnd, uint32 *valp)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return (*intop->encode) (valp);
+}
+
+
+uint32
+xtensa_operand_decode (xtensa_operand opnd, uint32 val)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return (*intop->decode) (val);
+}
+
+
+int
+xtensa_operand_isPCRelative (xtensa_operand opnd)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ return intop->isPCRelative;
+}
+
+
+uint32
+xtensa_operand_do_reloc (xtensa_operand opnd, uint32 addr, uint32 pc)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ if (!intop->isPCRelative)
+ return addr;
+ return (*intop->do_reloc) (addr, pc);
+}
+
+
+uint32
+xtensa_operand_undo_reloc (xtensa_operand opnd, uint32 offset, uint32 pc)
+{
+ xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd;
+ if (!intop->isPCRelative)
+ return offset;
+ return (*intop->undo_reloc) (offset, pc);
+}
+
+
+/* Instruction buffers. */
+
+xtensa_insnbuf
+xtensa_insnbuf_alloc (xtensa_isa isa)
+{
+ return (xtensa_insnbuf) malloc (xtensa_insnbuf_size (isa) *
+ sizeof (xtensa_insnbuf_word));
+}
+
+
+void
+xtensa_insnbuf_free (xtensa_insnbuf buf)
+{
+ free( buf );
+}
+
+
+/* Given <byte_index>, the index of a byte in a xtensa_insnbuf, our
+ internal representation of a xtensa instruction word, return the index of
+ its word and the bit index of its low order byte in the xtensa_insnbuf. */
+
+static inline int
+byte_to_word_index (int byte_index)
+{
+ return byte_index / sizeof (xtensa_insnbuf_word);
+}
+
+
+static inline int
+byte_to_bit_index (int byte_index)
+{
+ return (byte_index & 0x3) * 8;
+}
+
+
+/* Copy an instruction in the 32 bit words pointed at by <insn> to characters
+ pointed at by <cp>. This is more complicated than you might think because
+ we want 16 bit instructions in bytes 2,3 for big endian. This function
+ allows us to specify which byte in <insn> to start with and which way to
+ increment, allowing trivial implementation for both big and little endian.
+ And it seems to make pretty good code for both. */
+
+void
+xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ int insn_size = xtensa_insn_maxlength (intisa);
+ int fence_post, start, increment, i, byte_count;
+ xtensa_opcode opc;
+
+ if (intisa->is_big_endian)
+ {
+ start = insn_size - 1;
+ increment = -1;
+ }
+ else
+ {
+ start = 0;
+ increment = 1;
+ }
+
+ /* Find the opcode; do nothing if the buffer does not contain a valid
+ instruction since we need to know how many bytes to copy. */
+ opc = xtensa_decode_insn (isa, insn);
+ if (opc == XTENSA_UNDEFINED)
+ return;
+
+ byte_count = xtensa_insn_length (isa, opc);
+ fence_post = start + (byte_count * increment);
+
+ for (i = start; i != fence_post; i += increment, ++cp)
+ {
+ int word_inx = byte_to_word_index (i);
+ int bit_inx = byte_to_bit_index (i);
+
+ *cp = (insn[word_inx] >> bit_inx) & 0xff;
+ }
+}
+
+/* Inward conversion from byte stream to xtensa_insnbuf. See
+ xtensa_insnbuf_to_chars for a discussion of why this is
+ complicated by endianness. */
+
+void
+xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, const char* cp)
+{
+ xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
+ int insn_size = xtensa_insn_maxlength (intisa);
+ int fence_post, start, increment, i;
+
+ if (intisa->is_big_endian)
+ {
+ start = insn_size - 1;
+ increment = -1;
+ }
+ else
+ {
+ start = 0;
+ increment = 1;
+ }
+
+ fence_post = start + (insn_size * increment);
+ memset (insn, 0, xtensa_insnbuf_size (isa) * sizeof (xtensa_insnbuf_word));
+
+ for ( i = start; i != fence_post; i += increment, ++cp )
+ {
+ int word_inx = byte_to_word_index (i);
+ int bit_inx = byte_to_bit_index (i);
+
+ insn[word_inx] |= (*cp & 0xff) << bit_inx;
+ }
+}
+
diff --git a/bfd/xtensa-modules.c b/bfd/xtensa-modules.c
new file mode 100644
index 0000000..d023b52
--- /dev/null
+++ b/bfd/xtensa-modules.c
@@ -0,0 +1,6088 @@
+/* Xtensa configuration-specific ISA information.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include <xtensa-isa.h>
+#include "xtensa-isa-internal.h"
+#include "ansidecl.h"
+
+#define BPW 32
+#define WINDEX(_n) ((_n) / BPW)
+#define BINDEX(_n) ((_n) %% BPW)
+
+static uint32 tie_do_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED;
+static uint32 tie_undo_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED;
+
+static uint32
+tie_do_reloc_l (uint32 addr, uint32 pc)
+{
+ return (addr - pc);
+}
+
+static uint32
+tie_undo_reloc_l (uint32 offset, uint32 pc)
+{
+ return (pc + offset);
+}
+
+xtensa_opcode_internal** get_opcodes (void);
+const int get_num_opcodes (void);
+int decode_insn (const xtensa_insnbuf);
+int interface_version (void);
+
+uint32 get_bbi_field (const xtensa_insnbuf);
+void set_bbi_field (xtensa_insnbuf, uint32);
+uint32 get_bbi4_field (const xtensa_insnbuf);
+void set_bbi4_field (xtensa_insnbuf, uint32);
+uint32 get_i_field (const xtensa_insnbuf);
+void set_i_field (xtensa_insnbuf, uint32);
+uint32 get_imm12_field (const xtensa_insnbuf);
+void set_imm12_field (xtensa_insnbuf, uint32);
+uint32 get_imm12b_field (const xtensa_insnbuf);
+void set_imm12b_field (xtensa_insnbuf, uint32);
+uint32 get_imm16_field (const xtensa_insnbuf);
+void set_imm16_field (xtensa_insnbuf, uint32);
+uint32 get_imm4_field (const xtensa_insnbuf);
+void set_imm4_field (xtensa_insnbuf, uint32);
+uint32 get_imm6_field (const xtensa_insnbuf);
+void set_imm6_field (xtensa_insnbuf, uint32);
+uint32 get_imm6hi_field (const xtensa_insnbuf);
+void set_imm6hi_field (xtensa_insnbuf, uint32);
+uint32 get_imm6lo_field (const xtensa_insnbuf);
+void set_imm6lo_field (xtensa_insnbuf, uint32);
+uint32 get_imm7_field (const xtensa_insnbuf);
+void set_imm7_field (xtensa_insnbuf, uint32);
+uint32 get_imm7hi_field (const xtensa_insnbuf);
+void set_imm7hi_field (xtensa_insnbuf, uint32);
+uint32 get_imm7lo_field (const xtensa_insnbuf);
+void set_imm7lo_field (xtensa_insnbuf, uint32);
+uint32 get_imm8_field (const xtensa_insnbuf);
+void set_imm8_field (xtensa_insnbuf, uint32);
+uint32 get_m_field (const xtensa_insnbuf);
+void set_m_field (xtensa_insnbuf, uint32);
+uint32 get_mn_field (const xtensa_insnbuf);
+void set_mn_field (xtensa_insnbuf, uint32);
+uint32 get_n_field (const xtensa_insnbuf);
+void set_n_field (xtensa_insnbuf, uint32);
+uint32 get_none_field (const xtensa_insnbuf);
+void set_none_field (xtensa_insnbuf, uint32);
+uint32 get_offset_field (const xtensa_insnbuf);
+void set_offset_field (xtensa_insnbuf, uint32);
+uint32 get_op0_field (const xtensa_insnbuf);
+void set_op0_field (xtensa_insnbuf, uint32);
+uint32 get_op1_field (const xtensa_insnbuf);
+void set_op1_field (xtensa_insnbuf, uint32);
+uint32 get_op2_field (const xtensa_insnbuf);
+void set_op2_field (xtensa_insnbuf, uint32);
+uint32 get_r_field (const xtensa_insnbuf);
+void set_r_field (xtensa_insnbuf, uint32);
+uint32 get_s_field (const xtensa_insnbuf);
+void set_s_field (xtensa_insnbuf, uint32);
+uint32 get_sa4_field (const xtensa_insnbuf);
+void set_sa4_field (xtensa_insnbuf, uint32);
+uint32 get_sae_field (const xtensa_insnbuf);
+void set_sae_field (xtensa_insnbuf, uint32);
+uint32 get_sae4_field (const xtensa_insnbuf);
+void set_sae4_field (xtensa_insnbuf, uint32);
+uint32 get_sal_field (const xtensa_insnbuf);
+void set_sal_field (xtensa_insnbuf, uint32);
+uint32 get_sar_field (const xtensa_insnbuf);
+void set_sar_field (xtensa_insnbuf, uint32);
+uint32 get_sas_field (const xtensa_insnbuf);
+void set_sas_field (xtensa_insnbuf, uint32);
+uint32 get_sas4_field (const xtensa_insnbuf);
+void set_sas4_field (xtensa_insnbuf, uint32);
+uint32 get_sr_field (const xtensa_insnbuf);
+void set_sr_field (xtensa_insnbuf, uint32);
+uint32 get_t_field (const xtensa_insnbuf);
+void set_t_field (xtensa_insnbuf, uint32);
+uint32 get_thi3_field (const xtensa_insnbuf);
+void set_thi3_field (xtensa_insnbuf, uint32);
+uint32 get_z_field (const xtensa_insnbuf);
+void set_z_field (xtensa_insnbuf, uint32);
+
+
+uint32
+get_bbi_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf0000) >> 16) |
+ ((insn[0] & 0x100) >> 4);
+}
+
+void
+set_bbi_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
+ insn[0] = (insn[0] & 0xfffffeff) | ((val << 4) & 0x100);
+}
+
+uint32
+get_bbi4_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x100) >> 8);
+}
+
+void
+set_bbi4_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffffeff) | ((val << 8) & 0x100);
+}
+
+uint32
+get_i_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x80000) >> 19);
+}
+
+void
+set_i_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff7ffff) | ((val << 19) & 0x80000);
+}
+
+uint32
+get_imm12_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xfff));
+}
+
+void
+set_imm12_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff000) | (val & 0xfff);
+}
+
+uint32
+get_imm12b_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xff)) |
+ ((insn[0] & 0xf000) >> 4);
+}
+
+void
+set_imm12b_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffffff00) | (val & 0xff);
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 4) & 0xf000);
+}
+
+uint32
+get_imm16_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xffff));
+}
+
+void
+set_imm16_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffff0000) | (val & 0xffff);
+}
+
+uint32
+get_imm4_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8);
+}
+
+void
+set_imm4_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+}
+
+uint32
+get_imm6_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8) |
+ ((insn[0] & 0x30000) >> 12);
+}
+
+void
+set_imm6_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+ insn[0] = (insn[0] & 0xfffcffff) | ((val << 12) & 0x30000);
+}
+
+uint32
+get_imm6hi_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x30000) >> 16);
+}
+
+void
+set_imm6hi_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
+}
+
+uint32
+get_imm6lo_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8);
+}
+
+void
+set_imm6lo_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+}
+
+uint32
+get_imm7_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8) |
+ ((insn[0] & 0x70000) >> 12);
+}
+
+void
+set_imm7_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+ insn[0] = (insn[0] & 0xfff8ffff) | ((val << 12) & 0x70000);
+}
+
+uint32
+get_imm7hi_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x70000) >> 16);
+}
+
+void
+set_imm7hi_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff8ffff) | ((val << 16) & 0x70000);
+}
+
+uint32
+get_imm7lo_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8);
+}
+
+void
+set_imm7lo_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+}
+
+uint32
+get_imm8_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xff));
+}
+
+void
+set_imm8_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffffff00) | (val & 0xff);
+}
+
+uint32
+get_m_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x30000) >> 16);
+}
+
+void
+set_m_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
+}
+
+uint32
+get_mn_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x30000) >> 16) |
+ ((insn[0] & 0xc0000) >> 16);
+}
+
+void
+set_mn_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000);
+ insn[0] = (insn[0] & 0xfff3ffff) | ((val << 16) & 0xc0000);
+}
+
+uint32
+get_n_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xc0000) >> 18);
+}
+
+void
+set_n_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff3ffff) | ((val << 18) & 0xc0000);
+}
+
+uint32
+get_none_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x0));
+}
+
+void
+set_none_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffffffff) | (val & 0x0);
+}
+
+uint32
+get_offset_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x3ffff));
+}
+
+void
+set_offset_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffc0000) | (val & 0x3ffff);
+}
+
+uint32
+get_op0_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00000) >> 20);
+}
+
+void
+set_op0_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xff0fffff) | ((val << 20) & 0xf00000);
+}
+
+uint32
+get_op1_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf0) >> 4);
+}
+
+void
+set_op1_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffffff0f) | ((val << 4) & 0xf0);
+}
+
+uint32
+get_op2_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf));
+}
+
+void
+set_op2_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffffff0) | (val & 0xf);
+}
+
+uint32
+get_r_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8);
+}
+
+void
+set_r_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+}
+
+uint32
+get_s_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf000) >> 12);
+}
+
+void
+set_s_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+}
+
+uint32
+get_sa4_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x1));
+}
+
+void
+set_sa4_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffffffe) | (val & 0x1);
+}
+
+uint32
+get_sae_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf000) >> 12) |
+ ((insn[0] & 0x10));
+}
+
+void
+set_sae_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+ insn[0] = (insn[0] & 0xffffffef) | (val & 0x10);
+}
+
+uint32
+get_sae4_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x10) >> 4);
+}
+
+void
+set_sae4_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffffffef) | ((val << 4) & 0x10);
+}
+
+uint32
+get_sal_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf0000) >> 16) |
+ ((insn[0] & 0x1) << 4);
+}
+
+void
+set_sal_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
+ insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1);
+}
+
+uint32
+get_sar_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf000) >> 12) |
+ ((insn[0] & 0x1) << 4);
+}
+
+void
+set_sar_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+ insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1);
+}
+
+uint32
+get_sas_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf000) >> 12) |
+ ((insn[0] & 0x10000) >> 12);
+}
+
+void
+set_sas_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000);
+ insn[0] = (insn[0] & 0xfffeffff) | ((val << 12) & 0x10000);
+}
+
+uint32
+get_sas4_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x10000) >> 16);
+}
+
+void
+set_sas4_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffeffff) | ((val << 16) & 0x10000);
+}
+
+uint32
+get_sr_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf00) >> 8) |
+ ((insn[0] & 0xf000) >> 8);
+}
+
+void
+set_sr_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00);
+ insn[0] = (insn[0] & 0xffff0fff) | ((val << 8) & 0xf000);
+}
+
+uint32
+get_t_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xf0000) >> 16);
+}
+
+void
+set_t_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000);
+}
+
+uint32
+get_thi3_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0xe0000) >> 17);
+}
+
+void
+set_thi3_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfff1ffff) | ((val << 17) & 0xe0000);
+}
+
+uint32
+get_z_field (const xtensa_insnbuf insn)
+{
+ return ((insn[0] & 0x40000) >> 18);
+}
+
+void
+set_z_field (xtensa_insnbuf insn, uint32 val)
+{
+ insn[0] = (insn[0] & 0xfffbffff) | ((val << 18) & 0x40000);
+}
+
+uint32 decode_b4constu (uint32);
+xtensa_encode_result encode_b4constu (uint32 *);
+uint32 decode_simm8x256 (uint32);
+xtensa_encode_result encode_simm8x256 (uint32 *);
+uint32 decode_soffset (uint32);
+xtensa_encode_result encode_soffset (uint32 *);
+uint32 decode_imm4 (uint32);
+xtensa_encode_result encode_imm4 (uint32 *);
+uint32 decode_op0 (uint32);
+xtensa_encode_result encode_op0 (uint32 *);
+uint32 decode_op1 (uint32);
+xtensa_encode_result encode_op1 (uint32 *);
+uint32 decode_imm6 (uint32);
+xtensa_encode_result encode_imm6 (uint32 *);
+uint32 decode_op2 (uint32);
+xtensa_encode_result encode_op2 (uint32 *);
+uint32 decode_imm7 (uint32);
+xtensa_encode_result encode_imm7 (uint32 *);
+uint32 decode_simm4 (uint32);
+xtensa_encode_result encode_simm4 (uint32 *);
+uint32 decode_ai4const (uint32);
+xtensa_encode_result encode_ai4const (uint32 *);
+uint32 decode_imm8 (uint32);
+xtensa_encode_result encode_imm8 (uint32 *);
+uint32 decode_sae (uint32);
+xtensa_encode_result encode_sae (uint32 *);
+uint32 decode_imm7lo (uint32);
+xtensa_encode_result encode_imm7lo (uint32 *);
+uint32 decode_simm7 (uint32);
+xtensa_encode_result encode_simm7 (uint32 *);
+uint32 decode_simm8 (uint32);
+xtensa_encode_result encode_simm8 (uint32 *);
+uint32 decode_uimm12x8 (uint32);
+xtensa_encode_result encode_uimm12x8 (uint32 *);
+uint32 decode_sal (uint32);
+xtensa_encode_result encode_sal (uint32 *);
+uint32 decode_uimm6 (uint32);
+xtensa_encode_result encode_uimm6 (uint32 *);
+uint32 decode_sas4 (uint32);
+xtensa_encode_result encode_sas4 (uint32 *);
+uint32 decode_uimm8 (uint32);
+xtensa_encode_result encode_uimm8 (uint32 *);
+uint32 decode_uimm16x4 (uint32);
+xtensa_encode_result encode_uimm16x4 (uint32 *);
+uint32 decode_sar (uint32);
+xtensa_encode_result encode_sar (uint32 *);
+uint32 decode_sa4 (uint32);
+xtensa_encode_result encode_sa4 (uint32 *);
+uint32 decode_sas (uint32);
+xtensa_encode_result encode_sas (uint32 *);
+uint32 decode_imm6hi (uint32);
+xtensa_encode_result encode_imm6hi (uint32 *);
+uint32 decode_bbi (uint32);
+xtensa_encode_result encode_bbi (uint32 *);
+uint32 decode_uimm8x2 (uint32);
+xtensa_encode_result encode_uimm8x2 (uint32 *);
+uint32 decode_uimm8x4 (uint32);
+xtensa_encode_result encode_uimm8x4 (uint32 *);
+uint32 decode_msalp32 (uint32);
+xtensa_encode_result encode_msalp32 (uint32 *);
+uint32 decode_bbi4 (uint32);
+xtensa_encode_result encode_bbi4 (uint32 *);
+uint32 decode_op2p1 (uint32);
+xtensa_encode_result encode_op2p1 (uint32 *);
+uint32 decode_soffsetx4 (uint32);
+xtensa_encode_result encode_soffsetx4 (uint32 *);
+uint32 decode_imm6lo (uint32);
+xtensa_encode_result encode_imm6lo (uint32 *);
+uint32 decode_imm12 (uint32);
+xtensa_encode_result encode_imm12 (uint32 *);
+uint32 decode_b4const (uint32);
+xtensa_encode_result encode_b4const (uint32 *);
+uint32 decode_i (uint32);
+xtensa_encode_result encode_i (uint32 *);
+uint32 decode_imm16 (uint32);
+xtensa_encode_result encode_imm16 (uint32 *);
+uint32 decode_mn (uint32);
+xtensa_encode_result encode_mn (uint32 *);
+uint32 decode_m (uint32);
+xtensa_encode_result encode_m (uint32 *);
+uint32 decode_n (uint32);
+xtensa_encode_result encode_n (uint32 *);
+uint32 decode_none (uint32);
+xtensa_encode_result encode_none (uint32 *);
+uint32 decode_imm12b (uint32);
+xtensa_encode_result encode_imm12b (uint32 *);
+uint32 decode_r (uint32);
+xtensa_encode_result encode_r (uint32 *);
+uint32 decode_s (uint32);
+xtensa_encode_result encode_s (uint32 *);
+uint32 decode_t (uint32);
+xtensa_encode_result encode_t (uint32 *);
+uint32 decode_thi3 (uint32);
+xtensa_encode_result encode_thi3 (uint32 *);
+uint32 decode_sae4 (uint32);
+xtensa_encode_result encode_sae4 (uint32 *);
+uint32 decode_offset (uint32);
+xtensa_encode_result encode_offset (uint32 *);
+uint32 decode_imm7hi (uint32);
+xtensa_encode_result encode_imm7hi (uint32 *);
+uint32 decode_uimm4x16 (uint32);
+xtensa_encode_result encode_uimm4x16 (uint32 *);
+uint32 decode_simm12b (uint32);
+xtensa_encode_result encode_simm12b (uint32 *);
+uint32 decode_lsi4x4 (uint32);
+xtensa_encode_result encode_lsi4x4 (uint32 *);
+uint32 decode_z (uint32);
+xtensa_encode_result encode_z (uint32 *);
+uint32 decode_simm12 (uint32);
+xtensa_encode_result encode_simm12 (uint32 *);
+uint32 decode_sr (uint32);
+xtensa_encode_result encode_sr (uint32 *);
+uint32 decode_nimm4x2 (uint32);
+xtensa_encode_result encode_nimm4x2 (uint32 *);
+
+
+static const uint32 b4constu_table[] = {
+ 32768,
+ 65536,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 10,
+ 12,
+ 16,
+ 32,
+ 64,
+ 128,
+ 256
+};
+
+uint32
+decode_b4constu (uint32 val)
+{
+ val = b4constu_table[val];
+ return val;
+}
+
+xtensa_encode_result
+encode_b4constu (uint32 *valp)
+{
+ uint32 val = *valp;
+ unsigned i;
+ for (i = 0; i < (1 << 4); i += 1)
+ if (b4constu_table[i] == val) goto found;
+ return xtensa_encode_result_not_in_table;
+ found:
+ val = i;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm8x256 (uint32 val)
+{
+ val = (val ^ 0x80) - 0x80;
+ val <<= 8;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm8x256 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 8) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 8;
+ if (((val + (1 << 7)) >> 8) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_soffset (uint32 val)
+{
+ val = (val ^ 0x20000) - 0x20000;
+ return val;
+}
+
+xtensa_encode_result
+encode_soffset (uint32 *valp)
+{
+ uint32 val = *valp;
+ if (((val + (1 << 17)) >> 18) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm4 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op0 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_op0 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op1 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_op1 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm6 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 6) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_op2 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_op2 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm7 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 7) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm4 (uint32 val)
+{
+ val = (val ^ 0x8) - 0x8;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if (((val + (1 << 3)) >> 4) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+static const uint32 ai4const_table[] = {
+ -1,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15
+};
+
+uint32
+decode_ai4const (uint32 val)
+{
+ val = ai4const_table[val];
+ return val;
+}
+
+xtensa_encode_result
+encode_ai4const (uint32 *valp)
+{
+ uint32 val = *valp;
+ unsigned i;
+ for (i = 0; i < (1 << 4); i += 1)
+ if (ai4const_table[i] == val) goto found;
+ return xtensa_encode_result_not_in_table;
+ found:
+ val = i;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm8 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm8 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 8) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sae (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sae (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 5) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7lo (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm7lo (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm7 (uint32 val)
+{
+ if (val > 95)
+ val |= -32;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm7 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((signed int) val < -32)
+ return xtensa_encode_result_too_low;
+ if ((signed int) val > 95)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm8 (uint32 val)
+{
+ val = (val ^ 0x80) - 0x80;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm8 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if (((val + (1 << 7)) >> 8) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm12x8 (uint32 val)
+{
+ val <<= 3;
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm12x8 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 3) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 3;
+ if ((val >> 12) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sal (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sal (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 5) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm6 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm6 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 6) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sas4 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sas4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm8 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 8) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm16x4 (uint32 val)
+{
+ val |= -1 << 16;
+ val <<= 2;
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm16x4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 2) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 2;
+ if ((signed int) val >> 16 != -1)
+ {
+ if ((signed int) val >= 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sar (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sar (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 5) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sa4 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sa4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sas (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sas (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 5) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6hi (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm6hi (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 2) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_bbi (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_bbi (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 5) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8x2 (uint32 val)
+{
+ val <<= 1;
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm8x2 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 1) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 1;
+ if ((val >> 8) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm8x4 (uint32 val)
+{
+ val <<= 2;
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm8x4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 2) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 2;
+ if ((val >> 8) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+static const uint32 mip32const_table[] = {
+ 32,
+ 31,
+ 30,
+ 29,
+ 28,
+ 27,
+ 26,
+ 25,
+ 24,
+ 23,
+ 22,
+ 21,
+ 20,
+ 19,
+ 18,
+ 17,
+ 16,
+ 15,
+ 14,
+ 13,
+ 12,
+ 11,
+ 10,
+ 9,
+ 8,
+ 7,
+ 6,
+ 5,
+ 4,
+ 3,
+ 2,
+ 1
+};
+
+uint32
+decode_msalp32 (uint32 val)
+{
+ val = mip32const_table[val];
+ return val;
+}
+
+xtensa_encode_result
+encode_msalp32 (uint32 *valp)
+{
+ uint32 val = *valp;
+ unsigned i;
+ for (i = 0; i < (1 << 5); i += 1)
+ if (mip32const_table[i] == val) goto found;
+ return xtensa_encode_result_not_in_table;
+ found:
+ val = i;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_bbi4 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_bbi4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+static const uint32 i4p1const_table[] = {
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16
+};
+
+uint32
+decode_op2p1 (uint32 val)
+{
+ val = i4p1const_table[val];
+ return val;
+}
+
+xtensa_encode_result
+encode_op2p1 (uint32 *valp)
+{
+ uint32 val = *valp;
+ unsigned i;
+ for (i = 0; i < (1 << 4); i += 1)
+ if (i4p1const_table[i] == val) goto found;
+ return xtensa_encode_result_not_in_table;
+ found:
+ val = i;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_soffsetx4 (uint32 val)
+{
+ val = (val ^ 0x20000) - 0x20000;
+ val <<= 2;
+ return val;
+}
+
+xtensa_encode_result
+encode_soffsetx4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 2) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 2;
+ if (((val + (1 << 17)) >> 18) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm6lo (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm6lo (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm12 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm12 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 12) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+static const uint32 b4const_table[] = {
+ -1,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 10,
+ 12,
+ 16,
+ 32,
+ 64,
+ 128,
+ 256
+};
+
+uint32
+decode_b4const (uint32 val)
+{
+ val = b4const_table[val];
+ return val;
+}
+
+xtensa_encode_result
+encode_b4const (uint32 *valp)
+{
+ uint32 val = *valp;
+ unsigned i;
+ for (i = 0; i < (1 << 4); i += 1)
+ if (b4const_table[i] == val) goto found;
+ return xtensa_encode_result_not_in_table;
+ found:
+ val = i;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_i (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_i (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm16 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm16 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 16) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_mn (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_mn (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_m (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_m (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 2) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_n (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_n (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 2) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_none (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_none (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 0) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm12b (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm12b (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 12) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_r (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_r (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_s (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_s (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_t (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_t (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_thi3 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_thi3 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 3) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sae4 (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sae4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_offset (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_offset (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 18) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_imm7hi (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_imm7hi (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 3) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_uimm4x16 (uint32 val)
+{
+ val <<= 4;
+ return val;
+}
+
+xtensa_encode_result
+encode_uimm4x16 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 4) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 4;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm12b (uint32 val)
+{
+ val = (val ^ 0x800) - 0x800;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm12b (uint32 *valp)
+{
+ uint32 val = *valp;
+ if (((val + (1 << 11)) >> 12) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_lsi4x4 (uint32 val)
+{
+ val <<= 2;
+ return val;
+}
+
+xtensa_encode_result
+encode_lsi4x4 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 2) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 2;
+ if ((val >> 4) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_z (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_z (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 1) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_simm12 (uint32 val)
+{
+ val = (val ^ 0x800) - 0x800;
+ return val;
+}
+
+xtensa_encode_result
+encode_simm12 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if (((val + (1 << 11)) >> 12) != 0)
+ {
+ if ((signed int) val > 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_sr (uint32 val)
+{
+ return val;
+}
+
+xtensa_encode_result
+encode_sr (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val >> 8) != 0)
+ return xtensa_encode_result_too_high;
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+uint32
+decode_nimm4x2 (uint32 val)
+{
+ val |= -1 << 4;
+ val <<= 2;
+ return val;
+}
+
+xtensa_encode_result
+encode_nimm4x2 (uint32 *valp)
+{
+ uint32 val = *valp;
+ if ((val & ((1 << 2) - 1)) != 0)
+ return xtensa_encode_result_align;
+ val = (signed int) val >> 2;
+ if ((signed int) val >> 4 != -1)
+ {
+ if ((signed int) val >= 0)
+ return xtensa_encode_result_too_high;
+ else
+ return xtensa_encode_result_too_low;
+ }
+ *valp = val;
+ return xtensa_encode_result_ok;
+}
+
+
+
+uint32 do_reloc_l (uint32, uint32);
+uint32 undo_reloc_l (uint32, uint32);
+uint32 do_reloc_L (uint32, uint32);
+uint32 undo_reloc_L (uint32, uint32);
+uint32 do_reloc_r (uint32, uint32);
+uint32 undo_reloc_r (uint32, uint32);
+
+
+uint32
+do_reloc_l (uint32 addr, uint32 pc)
+{
+ return addr - pc - 4;
+}
+
+uint32
+undo_reloc_l (uint32 offset, uint32 pc)
+{
+ return pc + offset + 4;
+}
+
+uint32
+do_reloc_L (uint32 addr, uint32 pc)
+{
+ return addr - (pc & -4) - 4;
+}
+
+uint32
+undo_reloc_L (uint32 offset, uint32 pc)
+{
+ return (pc & -4) + offset + 4;
+}
+
+uint32
+do_reloc_r (uint32 addr, uint32 pc)
+{
+ return addr - ((pc+3) & -4);
+}
+
+uint32
+undo_reloc_r (uint32 offset, uint32 pc)
+{
+ return ((pc+3) & -4) + offset;
+}
+
+static xtensa_operand_internal iib4const_operand = {
+ "i",
+ '<',
+ 0,
+ get_r_field,
+ set_r_field,
+ encode_b4const,
+ decode_b4const,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iiuimm8_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm8_field,
+ set_imm8_field,
+ encode_uimm8,
+ decode_uimm8,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal lisoffsetx4_operand = {
+ "L",
+ '<',
+ 1,
+ get_offset_field,
+ set_offset_field,
+ encode_soffsetx4,
+ decode_soffsetx4,
+ do_reloc_L,
+ undo_reloc_L,
+};
+
+static xtensa_operand_internal iisimm8x256_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm8_field,
+ set_imm8_field,
+ encode_simm8x256,
+ decode_simm8x256,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal lisimm12_operand = {
+ "l",
+ '<',
+ 1,
+ get_imm12_field,
+ set_imm12_field,
+ encode_simm12,
+ decode_simm12,
+ do_reloc_l,
+ undo_reloc_l,
+};
+
+static xtensa_operand_internal iiop2p1_operand = {
+ "i",
+ '<',
+ 0,
+ get_op2_field,
+ set_op2_field,
+ encode_op2p1,
+ decode_op2p1,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisae_operand = {
+ "i",
+ '<',
+ 0,
+ get_sae_field,
+ set_sae_field,
+ encode_sae,
+ decode_sae,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iis_operand = {
+ "i",
+ '<',
+ 0,
+ get_s_field,
+ set_s_field,
+ encode_s,
+ decode_s,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iit_operand = {
+ "i",
+ '<',
+ 0,
+ get_t_field,
+ set_t_field,
+ encode_t,
+ decode_t,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisimm12b_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm12b_field,
+ set_imm12b_field,
+ encode_simm12b,
+ decode_simm12b,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iinimm4x2_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm4_field,
+ set_imm4_field,
+ encode_nimm4x2,
+ decode_nimm4x2,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iiuimm4x16_operand = {
+ "i",
+ '<',
+ 0,
+ get_op2_field,
+ set_op2_field,
+ encode_uimm4x16,
+ decode_uimm4x16,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal abs_operand = {
+ "a",
+ '=',
+ 0,
+ get_s_field,
+ set_s_field,
+ encode_s,
+ decode_s,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisar_operand = {
+ "i",
+ '<',
+ 0,
+ get_sar_field,
+ set_sar_field,
+ encode_sar,
+ decode_sar,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal abt_operand = {
+ "a",
+ '=',
+ 0,
+ get_t_field,
+ set_t_field,
+ encode_t,
+ decode_t,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisas_operand = {
+ "i",
+ '<',
+ 0,
+ get_sas_field,
+ set_sas_field,
+ encode_sas,
+ decode_sas,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal amr_operand = {
+ "a",
+ '=',
+ 0,
+ get_r_field,
+ set_r_field,
+ encode_r,
+ decode_r,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iib4constu_operand = {
+ "i",
+ '<',
+ 0,
+ get_r_field,
+ set_r_field,
+ encode_b4constu,
+ decode_b4constu,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisr_operand = {
+ "i",
+ '<',
+ 0,
+ get_sr_field,
+ set_sr_field,
+ encode_sr,
+ decode_sr,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iibbi_operand = {
+ "i",
+ '<',
+ 0,
+ get_bbi_field,
+ set_bbi_field,
+ encode_bbi,
+ decode_bbi,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iiai4const_operand = {
+ "i",
+ '<',
+ 0,
+ get_t_field,
+ set_t_field,
+ encode_ai4const,
+ decode_ai4const,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iiuimm12x8_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm12_field,
+ set_imm12_field,
+ encode_uimm12x8,
+ decode_uimm12x8,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal riuimm16x4_operand = {
+ "r",
+ '<',
+ 1,
+ get_imm16_field,
+ set_imm16_field,
+ encode_uimm16x4,
+ decode_uimm16x4,
+ do_reloc_r,
+ undo_reloc_r,
+};
+
+static xtensa_operand_internal lisimm8_operand = {
+ "l",
+ '<',
+ 1,
+ get_imm8_field,
+ set_imm8_field,
+ encode_simm8,
+ decode_simm8,
+ do_reloc_l,
+ undo_reloc_l,
+};
+
+static xtensa_operand_internal iilsi4x4_operand = {
+ "i",
+ '<',
+ 0,
+ get_r_field,
+ set_r_field,
+ encode_lsi4x4,
+ decode_lsi4x4,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iiuimm8x2_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm8_field,
+ set_imm8_field,
+ encode_uimm8x2,
+ decode_uimm8x2,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisimm4_operand = {
+ "i",
+ '<',
+ 0,
+ get_mn_field,
+ set_mn_field,
+ encode_simm4,
+ decode_simm4,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iimsalp32_operand = {
+ "i",
+ '<',
+ 0,
+ get_sal_field,
+ set_sal_field,
+ encode_msalp32,
+ decode_msalp32,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal liuimm6_operand = {
+ "l",
+ '<',
+ 1,
+ get_imm6_field,
+ set_imm6_field,
+ encode_uimm6,
+ decode_uimm6,
+ do_reloc_l,
+ undo_reloc_l,
+};
+
+static xtensa_operand_internal iiuimm8x4_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm8_field,
+ set_imm8_field,
+ encode_uimm8x4,
+ decode_uimm8x4,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal lisoffset_operand = {
+ "l",
+ '<',
+ 1,
+ get_offset_field,
+ set_offset_field,
+ encode_soffset,
+ decode_soffset,
+ do_reloc_l,
+ undo_reloc_l,
+};
+
+static xtensa_operand_internal iisimm7_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm7_field,
+ set_imm7_field,
+ encode_simm7,
+ decode_simm7,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal ais_operand = {
+ "a",
+ '<',
+ 0,
+ get_s_field,
+ set_s_field,
+ encode_s,
+ decode_s,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal liuimm8_operand = {
+ "l",
+ '<',
+ 1,
+ get_imm8_field,
+ set_imm8_field,
+ encode_uimm8,
+ decode_uimm8,
+ do_reloc_l,
+ undo_reloc_l,
+};
+
+static xtensa_operand_internal ait_operand = {
+ "a",
+ '<',
+ 0,
+ get_t_field,
+ set_t_field,
+ encode_t,
+ decode_t,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal iisimm8_operand = {
+ "i",
+ '<',
+ 0,
+ get_imm8_field,
+ set_imm8_field,
+ encode_simm8,
+ decode_simm8,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal aor_operand = {
+ "a",
+ '>',
+ 0,
+ get_r_field,
+ set_r_field,
+ encode_r,
+ decode_r,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal aos_operand = {
+ "a",
+ '>',
+ 0,
+ get_s_field,
+ set_s_field,
+ encode_s,
+ decode_s,
+ 0,
+ 0
+};
+
+static xtensa_operand_internal aot_operand = {
+ "a",
+ '>',
+ 0,
+ get_t_field,
+ set_t_field,
+ encode_t,
+ decode_t,
+ 0,
+ 0
+};
+
+static xtensa_iclass_internal nopn_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *movi_operand_list[] = {
+ &aot_operand,
+ &iisimm12b_operand
+};
+
+static xtensa_iclass_internal movi_iclass = {
+ 2,
+ &movi_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8u_operand_list[] = {
+ &ais_operand,
+ &iib4constu_operand,
+ &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8u_iclass = {
+ 3,
+ &bsi8u_operand_list[0]
+};
+
+static xtensa_operand_internal *itlb_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal itlb_iclass = {
+ 1,
+ &itlb_operand_list[0]
+};
+
+static xtensa_operand_internal *shiftst_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal shiftst_iclass = {
+ 3,
+ &shiftst_operand_list[0]
+};
+
+static xtensa_operand_internal *l32r_operand_list[] = {
+ &aot_operand,
+ &riuimm16x4_operand
+};
+
+static xtensa_iclass_internal l32r_iclass = {
+ 2,
+ &l32r_operand_list[0]
+};
+
+static xtensa_iclass_internal rfe_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *wait_operand_list[] = {
+ &iis_operand
+};
+
+static xtensa_iclass_internal wait_iclass = {
+ 1,
+ &wait_operand_list[0]
+};
+
+static xtensa_operand_internal *rfi_operand_list[] = {
+ &iis_operand
+};
+
+static xtensa_iclass_internal rfi_iclass = {
+ 1,
+ &rfi_operand_list[0]
+};
+
+static xtensa_operand_internal *movz_operand_list[] = {
+ &amr_operand,
+ &ais_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal movz_iclass = {
+ 3,
+ &movz_operand_list[0]
+};
+
+static xtensa_operand_internal *callx_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal callx_iclass = {
+ 1,
+ &callx_operand_list[0]
+};
+
+static xtensa_operand_internal *mov_n_operand_list[] = {
+ &aot_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal mov_n_iclass = {
+ 2,
+ &mov_n_operand_list[0]
+};
+
+static xtensa_operand_internal *loadi4_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iilsi4x4_operand
+};
+
+static xtensa_iclass_internal loadi4_iclass = {
+ 3,
+ &loadi4_operand_list[0]
+};
+
+static xtensa_operand_internal *exti_operand_list[] = {
+ &aor_operand,
+ &ait_operand,
+ &iisae_operand,
+ &iiop2p1_operand
+};
+
+static xtensa_iclass_internal exti_iclass = {
+ 4,
+ &exti_operand_list[0]
+};
+
+static xtensa_operand_internal *break_operand_list[] = {
+ &iis_operand,
+ &iit_operand
+};
+
+static xtensa_iclass_internal break_iclass = {
+ 2,
+ &break_operand_list[0]
+};
+
+static xtensa_operand_internal *slli_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &iimsalp32_operand
+};
+
+static xtensa_iclass_internal slli_iclass = {
+ 3,
+ &slli_operand_list[0]
+};
+
+static xtensa_operand_internal *s16i_operand_list[] = {
+ &ait_operand,
+ &ais_operand,
+ &iiuimm8x2_operand
+};
+
+static xtensa_iclass_internal s16i_iclass = {
+ 3,
+ &s16i_operand_list[0]
+};
+
+static xtensa_operand_internal *call_operand_list[] = {
+ &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call_iclass = {
+ 1,
+ &call_operand_list[0]
+};
+
+static xtensa_operand_internal *shifts_operand_list[] = {
+ &aor_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal shifts_iclass = {
+ 2,
+ &shifts_operand_list[0]
+};
+
+static xtensa_operand_internal *shiftt_operand_list[] = {
+ &aor_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal shiftt_iclass = {
+ 2,
+ &shiftt_operand_list[0]
+};
+
+static xtensa_operand_internal *rotw_operand_list[] = {
+ &iisimm4_operand
+};
+
+static xtensa_iclass_internal rotw_iclass = {
+ 1,
+ &rotw_operand_list[0]
+};
+
+static xtensa_operand_internal *addsub_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal addsub_iclass = {
+ 3,
+ &addsub_operand_list[0]
+};
+
+static xtensa_operand_internal *l8i_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iiuimm8_operand
+};
+
+static xtensa_iclass_internal l8i_iclass = {
+ 3,
+ &l8i_operand_list[0]
+};
+
+static xtensa_operand_internal *sari_operand_list[] = {
+ &iisas_operand
+};
+
+static xtensa_iclass_internal sari_iclass = {
+ 1,
+ &sari_operand_list[0]
+};
+
+static xtensa_operand_internal *xsr_operand_list[] = {
+ &abt_operand,
+ &iisr_operand
+};
+
+static xtensa_iclass_internal xsr_iclass = {
+ 2,
+ &xsr_operand_list[0]
+};
+
+static xtensa_operand_internal *rsil_operand_list[] = {
+ &aot_operand,
+ &iis_operand
+};
+
+static xtensa_iclass_internal rsil_iclass = {
+ 2,
+ &rsil_operand_list[0]
+};
+
+static xtensa_operand_internal *bst8_operand_list[] = {
+ &ais_operand,
+ &ait_operand,
+ &lisimm8_operand
+};
+
+static xtensa_iclass_internal bst8_iclass = {
+ 3,
+ &bst8_operand_list[0]
+};
+
+static xtensa_operand_internal *addi_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iisimm8_operand
+};
+
+static xtensa_iclass_internal addi_iclass = {
+ 3,
+ &addi_operand_list[0]
+};
+
+static xtensa_operand_internal *callx12_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal callx12_iclass = {
+ 1,
+ &callx12_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8_operand_list[] = {
+ &ais_operand,
+ &iib4const_operand,
+ &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8_iclass = {
+ 3,
+ &bsi8_operand_list[0]
+};
+
+static xtensa_operand_internal *jumpx_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal jumpx_iclass = {
+ 1,
+ &jumpx_operand_list[0]
+};
+
+static xtensa_iclass_internal retn_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *nsa_operand_list[] = {
+ &aot_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal nsa_iclass = {
+ 2,
+ &nsa_operand_list[0]
+};
+
+static xtensa_operand_internal *storei4_operand_list[] = {
+ &ait_operand,
+ &ais_operand,
+ &iilsi4x4_operand
+};
+
+static xtensa_iclass_internal storei4_iclass = {
+ 3,
+ &storei4_operand_list[0]
+};
+
+static xtensa_operand_internal *wtlb_operand_list[] = {
+ &ait_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal wtlb_iclass = {
+ 2,
+ &wtlb_operand_list[0]
+};
+
+static xtensa_operand_internal *dce_operand_list[] = {
+ &ais_operand,
+ &iiuimm4x16_operand
+};
+
+static xtensa_iclass_internal dce_iclass = {
+ 2,
+ &dce_operand_list[0]
+};
+
+static xtensa_operand_internal *l16i_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iiuimm8x2_operand
+};
+
+static xtensa_iclass_internal l16i_iclass = {
+ 3,
+ &l16i_operand_list[0]
+};
+
+static xtensa_operand_internal *callx4_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal callx4_iclass = {
+ 1,
+ &callx4_operand_list[0]
+};
+
+static xtensa_operand_internal *callx8_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal callx8_iclass = {
+ 1,
+ &callx8_operand_list[0]
+};
+
+static xtensa_operand_internal *movsp_operand_list[] = {
+ &aot_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal movsp_iclass = {
+ 2,
+ &movsp_operand_list[0]
+};
+
+static xtensa_operand_internal *wsr_operand_list[] = {
+ &ait_operand,
+ &iisr_operand
+};
+
+static xtensa_iclass_internal wsr_iclass = {
+ 2,
+ &wsr_operand_list[0]
+};
+
+static xtensa_operand_internal *call12_operand_list[] = {
+ &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call12_iclass = {
+ 1,
+ &call12_operand_list[0]
+};
+
+static xtensa_operand_internal *call4_operand_list[] = {
+ &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call4_iclass = {
+ 1,
+ &call4_operand_list[0]
+};
+
+static xtensa_operand_internal *addmi_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iisimm8x256_operand
+};
+
+static xtensa_iclass_internal addmi_iclass = {
+ 3,
+ &addmi_operand_list[0]
+};
+
+static xtensa_operand_internal *bit_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal bit_iclass = {
+ 3,
+ &bit_operand_list[0]
+};
+
+static xtensa_operand_internal *call8_operand_list[] = {
+ &lisoffsetx4_operand
+};
+
+static xtensa_iclass_internal call8_iclass = {
+ 1,
+ &call8_operand_list[0]
+};
+
+static xtensa_iclass_internal itlba_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *break_n_operand_list[] = {
+ &iis_operand
+};
+
+static xtensa_iclass_internal break_n_iclass = {
+ 1,
+ &break_n_operand_list[0]
+};
+
+static xtensa_operand_internal *sar_operand_list[] = {
+ &ais_operand
+};
+
+static xtensa_iclass_internal sar_iclass = {
+ 1,
+ &sar_operand_list[0]
+};
+
+static xtensa_operand_internal *s32e_operand_list[] = {
+ &ait_operand,
+ &ais_operand,
+ &iinimm4x2_operand
+};
+
+static xtensa_iclass_internal s32e_iclass = {
+ 3,
+ &s32e_operand_list[0]
+};
+
+static xtensa_operand_internal *bz6_operand_list[] = {
+ &ais_operand,
+ &liuimm6_operand
+};
+
+static xtensa_iclass_internal bz6_iclass = {
+ 2,
+ &bz6_operand_list[0]
+};
+
+static xtensa_operand_internal *loop_operand_list[] = {
+ &ais_operand,
+ &liuimm8_operand
+};
+
+static xtensa_iclass_internal loop_iclass = {
+ 2,
+ &loop_operand_list[0]
+};
+
+static xtensa_operand_internal *rsr_operand_list[] = {
+ &aot_operand,
+ &iisr_operand
+};
+
+static xtensa_iclass_internal rsr_iclass = {
+ 2,
+ &rsr_operand_list[0]
+};
+
+static xtensa_operand_internal *icache_operand_list[] = {
+ &ais_operand,
+ &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal icache_iclass = {
+ 2,
+ &icache_operand_list[0]
+};
+
+static xtensa_operand_internal *s8i_operand_list[] = {
+ &ait_operand,
+ &ais_operand,
+ &iiuimm8_operand
+};
+
+static xtensa_iclass_internal s8i_iclass = {
+ 3,
+ &s8i_operand_list[0]
+};
+
+static xtensa_iclass_internal return_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *dcache_operand_list[] = {
+ &ais_operand,
+ &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal dcache_iclass = {
+ 2,
+ &dcache_operand_list[0]
+};
+
+static xtensa_operand_internal *s32i_operand_list[] = {
+ &ait_operand,
+ &ais_operand,
+ &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal s32i_iclass = {
+ 3,
+ &s32i_operand_list[0]
+};
+
+static xtensa_operand_internal *jump_operand_list[] = {
+ &lisoffset_operand
+};
+
+static xtensa_iclass_internal jump_iclass = {
+ 1,
+ &jump_operand_list[0]
+};
+
+static xtensa_operand_internal *addi_n_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &iiai4const_operand
+};
+
+static xtensa_iclass_internal addi_n_iclass = {
+ 3,
+ &addi_n_operand_list[0]
+};
+
+static xtensa_iclass_internal sync_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *neg_operand_list[] = {
+ &aor_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal neg_iclass = {
+ 2,
+ &neg_operand_list[0]
+};
+
+static xtensa_iclass_internal syscall_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *bsz12_operand_list[] = {
+ &ais_operand,
+ &lisimm12_operand
+};
+
+static xtensa_iclass_internal bsz12_iclass = {
+ 2,
+ &bsz12_operand_list[0]
+};
+
+static xtensa_iclass_internal excw_iclass = {
+ 0,
+ 0
+};
+
+static xtensa_operand_internal *movi_n_operand_list[] = {
+ &aos_operand,
+ &iisimm7_operand
+};
+
+static xtensa_iclass_internal movi_n_iclass = {
+ 2,
+ &movi_n_operand_list[0]
+};
+
+static xtensa_operand_internal *rtlb_operand_list[] = {
+ &aot_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal rtlb_iclass = {
+ 2,
+ &rtlb_operand_list[0]
+};
+
+static xtensa_operand_internal *actl_operand_list[] = {
+ &aot_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal actl_iclass = {
+ 2,
+ &actl_operand_list[0]
+};
+
+static xtensa_operand_internal *srli_operand_list[] = {
+ &aor_operand,
+ &ait_operand,
+ &iis_operand
+};
+
+static xtensa_iclass_internal srli_iclass = {
+ 3,
+ &srli_operand_list[0]
+};
+
+static xtensa_operand_internal *bsi8b_operand_list[] = {
+ &ais_operand,
+ &iibbi_operand,
+ &lisimm8_operand
+};
+
+static xtensa_iclass_internal bsi8b_iclass = {
+ 3,
+ &bsi8b_operand_list[0]
+};
+
+static xtensa_operand_internal *acts_operand_list[] = {
+ &ait_operand,
+ &ais_operand
+};
+
+static xtensa_iclass_internal acts_iclass = {
+ 2,
+ &acts_operand_list[0]
+};
+
+static xtensa_operand_internal *add_n_operand_list[] = {
+ &aor_operand,
+ &ais_operand,
+ &ait_operand
+};
+
+static xtensa_iclass_internal add_n_iclass = {
+ 3,
+ &add_n_operand_list[0]
+};
+
+static xtensa_operand_internal *srai_operand_list[] = {
+ &aor_operand,
+ &ait_operand,
+ &iisar_operand
+};
+
+static xtensa_iclass_internal srai_iclass = {
+ 3,
+ &srai_operand_list[0]
+};
+
+static xtensa_operand_internal *entry_operand_list[] = {
+ &abs_operand,
+ &iiuimm12x8_operand
+};
+
+static xtensa_iclass_internal entry_iclass = {
+ 2,
+ &entry_operand_list[0]
+};
+
+static xtensa_operand_internal *l32e_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iinimm4x2_operand
+};
+
+static xtensa_iclass_internal l32e_iclass = {
+ 3,
+ &l32e_operand_list[0]
+};
+
+static xtensa_operand_internal *dpf_operand_list[] = {
+ &ais_operand,
+ &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal dpf_iclass = {
+ 2,
+ &dpf_operand_list[0]
+};
+
+static xtensa_operand_internal *l32i_operand_list[] = {
+ &aot_operand,
+ &ais_operand,
+ &iiuimm8x4_operand
+};
+
+static xtensa_iclass_internal l32i_iclass = {
+ 3,
+ &l32i_operand_list[0]
+};
+
+static xtensa_insnbuf abs_template (void);
+static xtensa_insnbuf add_template (void);
+static xtensa_insnbuf add_n_template (void);
+static xtensa_insnbuf addi_template (void);
+static xtensa_insnbuf addi_n_template (void);
+static xtensa_insnbuf addmi_template (void);
+static xtensa_insnbuf addx2_template (void);
+static xtensa_insnbuf addx4_template (void);
+static xtensa_insnbuf addx8_template (void);
+static xtensa_insnbuf and_template (void);
+static xtensa_insnbuf ball_template (void);
+static xtensa_insnbuf bany_template (void);
+static xtensa_insnbuf bbc_template (void);
+static xtensa_insnbuf bbci_template (void);
+static xtensa_insnbuf bbs_template (void);
+static xtensa_insnbuf bbsi_template (void);
+static xtensa_insnbuf beq_template (void);
+static xtensa_insnbuf beqi_template (void);
+static xtensa_insnbuf beqz_template (void);
+static xtensa_insnbuf beqz_n_template (void);
+static xtensa_insnbuf bge_template (void);
+static xtensa_insnbuf bgei_template (void);
+static xtensa_insnbuf bgeu_template (void);
+static xtensa_insnbuf bgeui_template (void);
+static xtensa_insnbuf bgez_template (void);
+static xtensa_insnbuf blt_template (void);
+static xtensa_insnbuf blti_template (void);
+static xtensa_insnbuf bltu_template (void);
+static xtensa_insnbuf bltui_template (void);
+static xtensa_insnbuf bltz_template (void);
+static xtensa_insnbuf bnall_template (void);
+static xtensa_insnbuf bne_template (void);
+static xtensa_insnbuf bnei_template (void);
+static xtensa_insnbuf bnez_template (void);
+static xtensa_insnbuf bnez_n_template (void);
+static xtensa_insnbuf bnone_template (void);
+static xtensa_insnbuf break_template (void);
+static xtensa_insnbuf break_n_template (void);
+static xtensa_insnbuf call0_template (void);
+static xtensa_insnbuf call12_template (void);
+static xtensa_insnbuf call4_template (void);
+static xtensa_insnbuf call8_template (void);
+static xtensa_insnbuf callx0_template (void);
+static xtensa_insnbuf callx12_template (void);
+static xtensa_insnbuf callx4_template (void);
+static xtensa_insnbuf callx8_template (void);
+static xtensa_insnbuf dhi_template (void);
+static xtensa_insnbuf dhwb_template (void);
+static xtensa_insnbuf dhwbi_template (void);
+static xtensa_insnbuf dii_template (void);
+static xtensa_insnbuf diwb_template (void);
+static xtensa_insnbuf diwbi_template (void);
+static xtensa_insnbuf dpfr_template (void);
+static xtensa_insnbuf dpfro_template (void);
+static xtensa_insnbuf dpfw_template (void);
+static xtensa_insnbuf dpfwo_template (void);
+static xtensa_insnbuf dsync_template (void);
+static xtensa_insnbuf entry_template (void);
+static xtensa_insnbuf esync_template (void);
+static xtensa_insnbuf excw_template (void);
+static xtensa_insnbuf extui_template (void);
+static xtensa_insnbuf idtlb_template (void);
+static xtensa_insnbuf idtlba_template (void);
+static xtensa_insnbuf ihi_template (void);
+static xtensa_insnbuf iii_template (void);
+static xtensa_insnbuf iitlb_template (void);
+static xtensa_insnbuf iitlba_template (void);
+static xtensa_insnbuf ipf_template (void);
+static xtensa_insnbuf isync_template (void);
+static xtensa_insnbuf j_template (void);
+static xtensa_insnbuf jx_template (void);
+static xtensa_insnbuf l16si_template (void);
+static xtensa_insnbuf l16ui_template (void);
+static xtensa_insnbuf l32e_template (void);
+static xtensa_insnbuf l32i_template (void);
+static xtensa_insnbuf l32i_n_template (void);
+static xtensa_insnbuf l32r_template (void);
+static xtensa_insnbuf l8ui_template (void);
+static xtensa_insnbuf ldct_template (void);
+static xtensa_insnbuf lict_template (void);
+static xtensa_insnbuf licw_template (void);
+static xtensa_insnbuf loop_template (void);
+static xtensa_insnbuf loopgtz_template (void);
+static xtensa_insnbuf loopnez_template (void);
+static xtensa_insnbuf memw_template (void);
+static xtensa_insnbuf mov_n_template (void);
+static xtensa_insnbuf moveqz_template (void);
+static xtensa_insnbuf movgez_template (void);
+static xtensa_insnbuf movi_template (void);
+static xtensa_insnbuf movi_n_template (void);
+static xtensa_insnbuf movltz_template (void);
+static xtensa_insnbuf movnez_template (void);
+static xtensa_insnbuf movsp_template (void);
+static xtensa_insnbuf neg_template (void);
+static xtensa_insnbuf nop_n_template (void);
+static xtensa_insnbuf nsa_template (void);
+static xtensa_insnbuf nsau_template (void);
+static xtensa_insnbuf or_template (void);
+static xtensa_insnbuf pdtlb_template (void);
+static xtensa_insnbuf pitlb_template (void);
+static xtensa_insnbuf rdtlb0_template (void);
+static xtensa_insnbuf rdtlb1_template (void);
+static xtensa_insnbuf ret_template (void);
+static xtensa_insnbuf ret_n_template (void);
+static xtensa_insnbuf retw_template (void);
+static xtensa_insnbuf retw_n_template (void);
+static xtensa_insnbuf rfde_template (void);
+static xtensa_insnbuf rfe_template (void);
+static xtensa_insnbuf rfi_template (void);
+static xtensa_insnbuf rfwo_template (void);
+static xtensa_insnbuf rfwu_template (void);
+static xtensa_insnbuf ritlb0_template (void);
+static xtensa_insnbuf ritlb1_template (void);
+static xtensa_insnbuf rotw_template (void);
+static xtensa_insnbuf rsil_template (void);
+static xtensa_insnbuf rsr_template (void);
+static xtensa_insnbuf rsync_template (void);
+static xtensa_insnbuf s16i_template (void);
+static xtensa_insnbuf s32e_template (void);
+static xtensa_insnbuf s32i_template (void);
+static xtensa_insnbuf s32i_n_template (void);
+static xtensa_insnbuf s8i_template (void);
+static xtensa_insnbuf sdct_template (void);
+static xtensa_insnbuf sict_template (void);
+static xtensa_insnbuf sicw_template (void);
+static xtensa_insnbuf simcall_template (void);
+static xtensa_insnbuf sll_template (void);
+static xtensa_insnbuf slli_template (void);
+static xtensa_insnbuf sra_template (void);
+static xtensa_insnbuf srai_template (void);
+static xtensa_insnbuf src_template (void);
+static xtensa_insnbuf srl_template (void);
+static xtensa_insnbuf srli_template (void);
+static xtensa_insnbuf ssa8b_template (void);
+static xtensa_insnbuf ssa8l_template (void);
+static xtensa_insnbuf ssai_template (void);
+static xtensa_insnbuf ssl_template (void);
+static xtensa_insnbuf ssr_template (void);
+static xtensa_insnbuf sub_template (void);
+static xtensa_insnbuf subx2_template (void);
+static xtensa_insnbuf subx4_template (void);
+static xtensa_insnbuf subx8_template (void);
+static xtensa_insnbuf syscall_template (void);
+static xtensa_insnbuf waiti_template (void);
+static xtensa_insnbuf wdtlb_template (void);
+static xtensa_insnbuf witlb_template (void);
+static xtensa_insnbuf wsr_template (void);
+static xtensa_insnbuf xor_template (void);
+static xtensa_insnbuf xsr_template (void);
+
+static xtensa_insnbuf
+abs_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00001006 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+add_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000008 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+add_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00a00000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200c00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addi_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00b00000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addmi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200d00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addx2_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000009 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addx4_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000a };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+addx8_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000b };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+and_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000001 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ball_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700400 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bany_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700800 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bbc_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700500 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bbci_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700600 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bbs_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700d00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bbsi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700e00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+beq_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700100 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+beqi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00680000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+beqz_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00640000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+beqz_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00c80000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bge_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700a00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bgei_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006b0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bgeu_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700b00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bgeui_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006f0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bgez_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00670000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+blt_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+blti_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006a0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bltu_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bltui_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006e0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bltz_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00660000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bnall_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700c00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bne_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700900 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bnei_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00690000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bnez_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00650000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bnez_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00cc0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+bnone_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00700000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+break_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000400 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+break_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00d20f00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+call0_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00500000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+call12_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x005c0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+call4_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00540000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+call8_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00580000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+callx0_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00030000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+callx12_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x000f0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+callx4_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00070000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+callx8_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x000b0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dhi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00260700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dhwb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00240700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dhwbi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00250700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dii_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00270700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+diwb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00280740 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+diwbi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00280750 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dpfr_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dpfro_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00220700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dpfw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00210700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dpfwo_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00230700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+dsync_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00030200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+entry_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006c0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+esync_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00020200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+excw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00080200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+extui_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000040 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+idtlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000c05 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+idtlba_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000805 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ihi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x002e0700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+iii_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x002f0700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+iitlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000405 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+iitlba_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000005 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ipf_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x002c0700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+isync_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+j_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00600000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+jx_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x000a0000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l16si_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200900 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l16ui_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200100 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l32e_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000090 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l32i_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l32i_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00800000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l32r_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00100000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+l8ui_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ldct_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000081f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+lict_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000001f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+licw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000021f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+loop_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006d0800 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+loopgtz_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006d0a00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+loopnez_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x006d0900 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+memw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x000c0200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+mov_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00d00000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+moveqz_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000038 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movgez_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000003b };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200a00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movi_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00c00000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movltz_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000003a };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movnez_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000039 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+movsp_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000100 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+neg_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000006 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+nop_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00d30f00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+nsa_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000e04 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+nsau_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000f04 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+or_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000002 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+pdtlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000d05 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+pitlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000505 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rdtlb0_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000b05 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rdtlb1_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000f05 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ret_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00020000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ret_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00d00f00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+retw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00060000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+retw_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00d10f00 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rfde_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00002300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rfe_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rfi_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00010300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rfwo_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00004300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rfwu_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00005300 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ritlb0_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000305 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ritlb1_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000705 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rotw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000804 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rsil_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000600 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rsr_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000030 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+rsync_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00010200 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+s16i_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200500 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+s32e_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000094 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+s32i_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200600 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+s32i_n_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00900000 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+s8i_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00200400 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sdct_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000091f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sict_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000011f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sicw_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000031f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+simcall_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00001500 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sll_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000001a };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+slli_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000010 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sra_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000001b };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+srai_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000012 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+src_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000018 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+srl_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000019 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+srli_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000014 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ssa8b_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000304 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ssa8l_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000204 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ssai_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000404 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ssl_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000104 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+ssr_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000004 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+sub_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000c };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+subx2_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000d };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+subx4_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000e };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+subx8_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x0000000f };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+syscall_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000500 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+waiti_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000700 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+wdtlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000e05 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+witlb_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000605 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+wsr_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000031 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+xor_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000003 };
+ return &template[0];
+}
+
+static xtensa_insnbuf
+xsr_template (void)
+{
+ static xtensa_insnbuf_word template[] = { 0x00000016 };
+ return &template[0];
+}
+
+static xtensa_opcode_internal abs_opcode = {
+ "abs",
+ 3,
+ abs_template,
+ &neg_iclass
+};
+
+static xtensa_opcode_internal add_opcode = {
+ "add",
+ 3,
+ add_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal add_n_opcode = {
+ "add.n",
+ 2,
+ add_n_template,
+ &add_n_iclass
+};
+
+static xtensa_opcode_internal addi_opcode = {
+ "addi",
+ 3,
+ addi_template,
+ &addi_iclass
+};
+
+static xtensa_opcode_internal addi_n_opcode = {
+ "addi.n",
+ 2,
+ addi_n_template,
+ &addi_n_iclass
+};
+
+static xtensa_opcode_internal addmi_opcode = {
+ "addmi",
+ 3,
+ addmi_template,
+ &addmi_iclass
+};
+
+static xtensa_opcode_internal addx2_opcode = {
+ "addx2",
+ 3,
+ addx2_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal addx4_opcode = {
+ "addx4",
+ 3,
+ addx4_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal addx8_opcode = {
+ "addx8",
+ 3,
+ addx8_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal and_opcode = {
+ "and",
+ 3,
+ and_template,
+ &bit_iclass
+};
+
+static xtensa_opcode_internal ball_opcode = {
+ "ball",
+ 3,
+ ball_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bany_opcode = {
+ "bany",
+ 3,
+ bany_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bbc_opcode = {
+ "bbc",
+ 3,
+ bbc_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bbci_opcode = {
+ "bbci",
+ 3,
+ bbci_template,
+ &bsi8b_iclass
+};
+
+static xtensa_opcode_internal bbs_opcode = {
+ "bbs",
+ 3,
+ bbs_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bbsi_opcode = {
+ "bbsi",
+ 3,
+ bbsi_template,
+ &bsi8b_iclass
+};
+
+static xtensa_opcode_internal beq_opcode = {
+ "beq",
+ 3,
+ beq_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal beqi_opcode = {
+ "beqi",
+ 3,
+ beqi_template,
+ &bsi8_iclass
+};
+
+static xtensa_opcode_internal beqz_opcode = {
+ "beqz",
+ 3,
+ beqz_template,
+ &bsz12_iclass
+};
+
+static xtensa_opcode_internal beqz_n_opcode = {
+ "beqz.n",
+ 2,
+ beqz_n_template,
+ &bz6_iclass
+};
+
+static xtensa_opcode_internal bge_opcode = {
+ "bge",
+ 3,
+ bge_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bgei_opcode = {
+ "bgei",
+ 3,
+ bgei_template,
+ &bsi8_iclass
+};
+
+static xtensa_opcode_internal bgeu_opcode = {
+ "bgeu",
+ 3,
+ bgeu_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bgeui_opcode = {
+ "bgeui",
+ 3,
+ bgeui_template,
+ &bsi8u_iclass
+};
+
+static xtensa_opcode_internal bgez_opcode = {
+ "bgez",
+ 3,
+ bgez_template,
+ &bsz12_iclass
+};
+
+static xtensa_opcode_internal blt_opcode = {
+ "blt",
+ 3,
+ blt_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal blti_opcode = {
+ "blti",
+ 3,
+ blti_template,
+ &bsi8_iclass
+};
+
+static xtensa_opcode_internal bltu_opcode = {
+ "bltu",
+ 3,
+ bltu_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bltui_opcode = {
+ "bltui",
+ 3,
+ bltui_template,
+ &bsi8u_iclass
+};
+
+static xtensa_opcode_internal bltz_opcode = {
+ "bltz",
+ 3,
+ bltz_template,
+ &bsz12_iclass
+};
+
+static xtensa_opcode_internal bnall_opcode = {
+ "bnall",
+ 3,
+ bnall_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bne_opcode = {
+ "bne",
+ 3,
+ bne_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal bnei_opcode = {
+ "bnei",
+ 3,
+ bnei_template,
+ &bsi8_iclass
+};
+
+static xtensa_opcode_internal bnez_opcode = {
+ "bnez",
+ 3,
+ bnez_template,
+ &bsz12_iclass
+};
+
+static xtensa_opcode_internal bnez_n_opcode = {
+ "bnez.n",
+ 2,
+ bnez_n_template,
+ &bz6_iclass
+};
+
+static xtensa_opcode_internal bnone_opcode = {
+ "bnone",
+ 3,
+ bnone_template,
+ &bst8_iclass
+};
+
+static xtensa_opcode_internal break_opcode = {
+ "break",
+ 3,
+ break_template,
+ &break_iclass
+};
+
+static xtensa_opcode_internal break_n_opcode = {
+ "break.n",
+ 2,
+ break_n_template,
+ &break_n_iclass
+};
+
+static xtensa_opcode_internal call0_opcode = {
+ "call0",
+ 3,
+ call0_template,
+ &call_iclass
+};
+
+static xtensa_opcode_internal call12_opcode = {
+ "call12",
+ 3,
+ call12_template,
+ &call12_iclass
+};
+
+static xtensa_opcode_internal call4_opcode = {
+ "call4",
+ 3,
+ call4_template,
+ &call4_iclass
+};
+
+static xtensa_opcode_internal call8_opcode = {
+ "call8",
+ 3,
+ call8_template,
+ &call8_iclass
+};
+
+static xtensa_opcode_internal callx0_opcode = {
+ "callx0",
+ 3,
+ callx0_template,
+ &callx_iclass
+};
+
+static xtensa_opcode_internal callx12_opcode = {
+ "callx12",
+ 3,
+ callx12_template,
+ &callx12_iclass
+};
+
+static xtensa_opcode_internal callx4_opcode = {
+ "callx4",
+ 3,
+ callx4_template,
+ &callx4_iclass
+};
+
+static xtensa_opcode_internal callx8_opcode = {
+ "callx8",
+ 3,
+ callx8_template,
+ &callx8_iclass
+};
+
+static xtensa_opcode_internal dhi_opcode = {
+ "dhi",
+ 3,
+ dhi_template,
+ &dcache_iclass
+};
+
+static xtensa_opcode_internal dhwb_opcode = {
+ "dhwb",
+ 3,
+ dhwb_template,
+ &dcache_iclass
+};
+
+static xtensa_opcode_internal dhwbi_opcode = {
+ "dhwbi",
+ 3,
+ dhwbi_template,
+ &dcache_iclass
+};
+
+static xtensa_opcode_internal dii_opcode = {
+ "dii",
+ 3,
+ dii_template,
+ &dcache_iclass
+};
+
+static xtensa_opcode_internal diwb_opcode = {
+ "diwb",
+ 3,
+ diwb_template,
+ &dce_iclass
+};
+
+static xtensa_opcode_internal diwbi_opcode = {
+ "diwbi",
+ 3,
+ diwbi_template,
+ &dce_iclass
+};
+
+static xtensa_opcode_internal dpfr_opcode = {
+ "dpfr",
+ 3,
+ dpfr_template,
+ &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfro_opcode = {
+ "dpfro",
+ 3,
+ dpfro_template,
+ &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfw_opcode = {
+ "dpfw",
+ 3,
+ dpfw_template,
+ &dpf_iclass
+};
+
+static xtensa_opcode_internal dpfwo_opcode = {
+ "dpfwo",
+ 3,
+ dpfwo_template,
+ &dpf_iclass
+};
+
+static xtensa_opcode_internal dsync_opcode = {
+ "dsync",
+ 3,
+ dsync_template,
+ &sync_iclass
+};
+
+static xtensa_opcode_internal entry_opcode = {
+ "entry",
+ 3,
+ entry_template,
+ &entry_iclass
+};
+
+static xtensa_opcode_internal esync_opcode = {
+ "esync",
+ 3,
+ esync_template,
+ &sync_iclass
+};
+
+static xtensa_opcode_internal excw_opcode = {
+ "excw",
+ 3,
+ excw_template,
+ &excw_iclass
+};
+
+static xtensa_opcode_internal extui_opcode = {
+ "extui",
+ 3,
+ extui_template,
+ &exti_iclass
+};
+
+static xtensa_opcode_internal idtlb_opcode = {
+ "idtlb",
+ 3,
+ idtlb_template,
+ &itlb_iclass
+};
+
+static xtensa_opcode_internal idtlba_opcode = {
+ "idtlba",
+ 3,
+ idtlba_template,
+ &itlba_iclass
+};
+
+static xtensa_opcode_internal ihi_opcode = {
+ "ihi",
+ 3,
+ ihi_template,
+ &icache_iclass
+};
+
+static xtensa_opcode_internal iii_opcode = {
+ "iii",
+ 3,
+ iii_template,
+ &icache_iclass
+};
+
+static xtensa_opcode_internal iitlb_opcode = {
+ "iitlb",
+ 3,
+ iitlb_template,
+ &itlb_iclass
+};
+
+static xtensa_opcode_internal iitlba_opcode = {
+ "iitlba",
+ 3,
+ iitlba_template,
+ &itlba_iclass
+};
+
+static xtensa_opcode_internal ipf_opcode = {
+ "ipf",
+ 3,
+ ipf_template,
+ &icache_iclass
+};
+
+static xtensa_opcode_internal isync_opcode = {
+ "isync",
+ 3,
+ isync_template,
+ &sync_iclass
+};
+
+static xtensa_opcode_internal j_opcode = {
+ "j",
+ 3,
+ j_template,
+ &jump_iclass
+};
+
+static xtensa_opcode_internal jx_opcode = {
+ "jx",
+ 3,
+ jx_template,
+ &jumpx_iclass
+};
+
+static xtensa_opcode_internal l16si_opcode = {
+ "l16si",
+ 3,
+ l16si_template,
+ &l16i_iclass
+};
+
+static xtensa_opcode_internal l16ui_opcode = {
+ "l16ui",
+ 3,
+ l16ui_template,
+ &l16i_iclass
+};
+
+static xtensa_opcode_internal l32e_opcode = {
+ "l32e",
+ 3,
+ l32e_template,
+ &l32e_iclass
+};
+
+static xtensa_opcode_internal l32i_opcode = {
+ "l32i",
+ 3,
+ l32i_template,
+ &l32i_iclass
+};
+
+static xtensa_opcode_internal l32i_n_opcode = {
+ "l32i.n",
+ 2,
+ l32i_n_template,
+ &loadi4_iclass
+};
+
+static xtensa_opcode_internal l32r_opcode = {
+ "l32r",
+ 3,
+ l32r_template,
+ &l32r_iclass
+};
+
+static xtensa_opcode_internal l8ui_opcode = {
+ "l8ui",
+ 3,
+ l8ui_template,
+ &l8i_iclass
+};
+
+static xtensa_opcode_internal ldct_opcode = {
+ "ldct",
+ 3,
+ ldct_template,
+ &actl_iclass
+};
+
+static xtensa_opcode_internal lict_opcode = {
+ "lict",
+ 3,
+ lict_template,
+ &actl_iclass
+};
+
+static xtensa_opcode_internal licw_opcode = {
+ "licw",
+ 3,
+ licw_template,
+ &actl_iclass
+};
+
+static xtensa_opcode_internal loop_opcode = {
+ "loop",
+ 3,
+ loop_template,
+ &loop_iclass
+};
+
+static xtensa_opcode_internal loopgtz_opcode = {
+ "loopgtz",
+ 3,
+ loopgtz_template,
+ &loop_iclass
+};
+
+static xtensa_opcode_internal loopnez_opcode = {
+ "loopnez",
+ 3,
+ loopnez_template,
+ &loop_iclass
+};
+
+static xtensa_opcode_internal memw_opcode = {
+ "memw",
+ 3,
+ memw_template,
+ &sync_iclass
+};
+
+static xtensa_opcode_internal mov_n_opcode = {
+ "mov.n",
+ 2,
+ mov_n_template,
+ &mov_n_iclass
+};
+
+static xtensa_opcode_internal moveqz_opcode = {
+ "moveqz",
+ 3,
+ moveqz_template,
+ &movz_iclass
+};
+
+static xtensa_opcode_internal movgez_opcode = {
+ "movgez",
+ 3,
+ movgez_template,
+ &movz_iclass
+};
+
+static xtensa_opcode_internal movi_opcode = {
+ "movi",
+ 3,
+ movi_template,
+ &movi_iclass
+};
+
+static xtensa_opcode_internal movi_n_opcode = {
+ "movi.n",
+ 2,
+ movi_n_template,
+ &movi_n_iclass
+};
+
+static xtensa_opcode_internal movltz_opcode = {
+ "movltz",
+ 3,
+ movltz_template,
+ &movz_iclass
+};
+
+static xtensa_opcode_internal movnez_opcode = {
+ "movnez",
+ 3,
+ movnez_template,
+ &movz_iclass
+};
+
+static xtensa_opcode_internal movsp_opcode = {
+ "movsp",
+ 3,
+ movsp_template,
+ &movsp_iclass
+};
+
+static xtensa_opcode_internal neg_opcode = {
+ "neg",
+ 3,
+ neg_template,
+ &neg_iclass
+};
+
+static xtensa_opcode_internal nop_n_opcode = {
+ "nop.n",
+ 2,
+ nop_n_template,
+ &nopn_iclass
+};
+
+static xtensa_opcode_internal nsa_opcode = {
+ "nsa",
+ 3,
+ nsa_template,
+ &nsa_iclass
+};
+
+static xtensa_opcode_internal nsau_opcode = {
+ "nsau",
+ 3,
+ nsau_template,
+ &nsa_iclass
+};
+
+static xtensa_opcode_internal or_opcode = {
+ "or",
+ 3,
+ or_template,
+ &bit_iclass
+};
+
+static xtensa_opcode_internal pdtlb_opcode = {
+ "pdtlb",
+ 3,
+ pdtlb_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal pitlb_opcode = {
+ "pitlb",
+ 3,
+ pitlb_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal rdtlb0_opcode = {
+ "rdtlb0",
+ 3,
+ rdtlb0_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal rdtlb1_opcode = {
+ "rdtlb1",
+ 3,
+ rdtlb1_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal ret_opcode = {
+ "ret",
+ 3,
+ ret_template,
+ &return_iclass
+};
+
+static xtensa_opcode_internal ret_n_opcode = {
+ "ret.n",
+ 2,
+ ret_n_template,
+ &retn_iclass
+};
+
+static xtensa_opcode_internal retw_opcode = {
+ "retw",
+ 3,
+ retw_template,
+ &return_iclass
+};
+
+static xtensa_opcode_internal retw_n_opcode = {
+ "retw.n",
+ 2,
+ retw_n_template,
+ &retn_iclass
+};
+
+static xtensa_opcode_internal rfde_opcode = {
+ "rfde",
+ 3,
+ rfde_template,
+ &rfe_iclass
+};
+
+static xtensa_opcode_internal rfe_opcode = {
+ "rfe",
+ 3,
+ rfe_template,
+ &rfe_iclass
+};
+
+static xtensa_opcode_internal rfi_opcode = {
+ "rfi",
+ 3,
+ rfi_template,
+ &rfi_iclass
+};
+
+static xtensa_opcode_internal rfwo_opcode = {
+ "rfwo",
+ 3,
+ rfwo_template,
+ &rfe_iclass
+};
+
+static xtensa_opcode_internal rfwu_opcode = {
+ "rfwu",
+ 3,
+ rfwu_template,
+ &rfe_iclass
+};
+
+static xtensa_opcode_internal ritlb0_opcode = {
+ "ritlb0",
+ 3,
+ ritlb0_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal ritlb1_opcode = {
+ "ritlb1",
+ 3,
+ ritlb1_template,
+ &rtlb_iclass
+};
+
+static xtensa_opcode_internal rotw_opcode = {
+ "rotw",
+ 3,
+ rotw_template,
+ &rotw_iclass
+};
+
+static xtensa_opcode_internal rsil_opcode = {
+ "rsil",
+ 3,
+ rsil_template,
+ &rsil_iclass
+};
+
+static xtensa_opcode_internal rsr_opcode = {
+ "rsr",
+ 3,
+ rsr_template,
+ &rsr_iclass
+};
+
+static xtensa_opcode_internal rsync_opcode = {
+ "rsync",
+ 3,
+ rsync_template,
+ &sync_iclass
+};
+
+static xtensa_opcode_internal s16i_opcode = {
+ "s16i",
+ 3,
+ s16i_template,
+ &s16i_iclass
+};
+
+static xtensa_opcode_internal s32e_opcode = {
+ "s32e",
+ 3,
+ s32e_template,
+ &s32e_iclass
+};
+
+static xtensa_opcode_internal s32i_opcode = {
+ "s32i",
+ 3,
+ s32i_template,
+ &s32i_iclass
+};
+
+static xtensa_opcode_internal s32i_n_opcode = {
+ "s32i.n",
+ 2,
+ s32i_n_template,
+ &storei4_iclass
+};
+
+static xtensa_opcode_internal s8i_opcode = {
+ "s8i",
+ 3,
+ s8i_template,
+ &s8i_iclass
+};
+
+static xtensa_opcode_internal sdct_opcode = {
+ "sdct",
+ 3,
+ sdct_template,
+ &acts_iclass
+};
+
+static xtensa_opcode_internal sict_opcode = {
+ "sict",
+ 3,
+ sict_template,
+ &acts_iclass
+};
+
+static xtensa_opcode_internal sicw_opcode = {
+ "sicw",
+ 3,
+ sicw_template,
+ &acts_iclass
+};
+
+static xtensa_opcode_internal simcall_opcode = {
+ "simcall",
+ 3,
+ simcall_template,
+ &syscall_iclass
+};
+
+static xtensa_opcode_internal sll_opcode = {
+ "sll",
+ 3,
+ sll_template,
+ &shifts_iclass
+};
+
+static xtensa_opcode_internal slli_opcode = {
+ "slli",
+ 3,
+ slli_template,
+ &slli_iclass
+};
+
+static xtensa_opcode_internal sra_opcode = {
+ "sra",
+ 3,
+ sra_template,
+ &shiftt_iclass
+};
+
+static xtensa_opcode_internal srai_opcode = {
+ "srai",
+ 3,
+ srai_template,
+ &srai_iclass
+};
+
+static xtensa_opcode_internal src_opcode = {
+ "src",
+ 3,
+ src_template,
+ &shiftst_iclass
+};
+
+static xtensa_opcode_internal srl_opcode = {
+ "srl",
+ 3,
+ srl_template,
+ &shiftt_iclass
+};
+
+static xtensa_opcode_internal srli_opcode = {
+ "srli",
+ 3,
+ srli_template,
+ &srli_iclass
+};
+
+static xtensa_opcode_internal ssa8b_opcode = {
+ "ssa8b",
+ 3,
+ ssa8b_template,
+ &sar_iclass
+};
+
+static xtensa_opcode_internal ssa8l_opcode = {
+ "ssa8l",
+ 3,
+ ssa8l_template,
+ &sar_iclass
+};
+
+static xtensa_opcode_internal ssai_opcode = {
+ "ssai",
+ 3,
+ ssai_template,
+ &sari_iclass
+};
+
+static xtensa_opcode_internal ssl_opcode = {
+ "ssl",
+ 3,
+ ssl_template,
+ &sar_iclass
+};
+
+static xtensa_opcode_internal ssr_opcode = {
+ "ssr",
+ 3,
+ ssr_template,
+ &sar_iclass
+};
+
+static xtensa_opcode_internal sub_opcode = {
+ "sub",
+ 3,
+ sub_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal subx2_opcode = {
+ "subx2",
+ 3,
+ subx2_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal subx4_opcode = {
+ "subx4",
+ 3,
+ subx4_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal subx8_opcode = {
+ "subx8",
+ 3,
+ subx8_template,
+ &addsub_iclass
+};
+
+static xtensa_opcode_internal syscall_opcode = {
+ "syscall",
+ 3,
+ syscall_template,
+ &syscall_iclass
+};
+
+static xtensa_opcode_internal waiti_opcode = {
+ "waiti",
+ 3,
+ waiti_template,
+ &wait_iclass
+};
+
+static xtensa_opcode_internal wdtlb_opcode = {
+ "wdtlb",
+ 3,
+ wdtlb_template,
+ &wtlb_iclass
+};
+
+static xtensa_opcode_internal witlb_opcode = {
+ "witlb",
+ 3,
+ witlb_template,
+ &wtlb_iclass
+};
+
+static xtensa_opcode_internal wsr_opcode = {
+ "wsr",
+ 3,
+ wsr_template,
+ &wsr_iclass
+};
+
+static xtensa_opcode_internal xor_opcode = {
+ "xor",
+ 3,
+ xor_template,
+ &bit_iclass
+};
+
+static xtensa_opcode_internal xsr_opcode = {
+ "xsr",
+ 3,
+ xsr_template,
+ &xsr_iclass
+};
+
+static xtensa_opcode_internal * opcodes[149] = {
+ &abs_opcode,
+ &add_opcode,
+ &add_n_opcode,
+ &addi_opcode,
+ &addi_n_opcode,
+ &addmi_opcode,
+ &addx2_opcode,
+ &addx4_opcode,
+ &addx8_opcode,
+ &and_opcode,
+ &ball_opcode,
+ &bany_opcode,
+ &bbc_opcode,
+ &bbci_opcode,
+ &bbs_opcode,
+ &bbsi_opcode,
+ &beq_opcode,
+ &beqi_opcode,
+ &beqz_opcode,
+ &beqz_n_opcode,
+ &bge_opcode,
+ &bgei_opcode,
+ &bgeu_opcode,
+ &bgeui_opcode,
+ &bgez_opcode,
+ &blt_opcode,
+ &blti_opcode,
+ &bltu_opcode,
+ &bltui_opcode,
+ &bltz_opcode,
+ &bnall_opcode,
+ &bne_opcode,
+ &bnei_opcode,
+ &bnez_opcode,
+ &bnez_n_opcode,
+ &bnone_opcode,
+ &break_opcode,
+ &break_n_opcode,
+ &call0_opcode,
+ &call12_opcode,
+ &call4_opcode,
+ &call8_opcode,
+ &callx0_opcode,
+ &callx12_opcode,
+ &callx4_opcode,
+ &callx8_opcode,
+ &dhi_opcode,
+ &dhwb_opcode,
+ &dhwbi_opcode,
+ &dii_opcode,
+ &diwb_opcode,
+ &diwbi_opcode,
+ &dpfr_opcode,
+ &dpfro_opcode,
+ &dpfw_opcode,
+ &dpfwo_opcode,
+ &dsync_opcode,
+ &entry_opcode,
+ &esync_opcode,
+ &excw_opcode,
+ &extui_opcode,
+ &idtlb_opcode,
+ &idtlba_opcode,
+ &ihi_opcode,
+ &iii_opcode,
+ &iitlb_opcode,
+ &iitlba_opcode,
+ &ipf_opcode,
+ &isync_opcode,
+ &j_opcode,
+ &jx_opcode,
+ &l16si_opcode,
+ &l16ui_opcode,
+ &l32e_opcode,
+ &l32i_opcode,
+ &l32i_n_opcode,
+ &l32r_opcode,
+ &l8ui_opcode,
+ &ldct_opcode,
+ &lict_opcode,
+ &licw_opcode,
+ &loop_opcode,
+ &loopgtz_opcode,
+ &loopnez_opcode,
+ &memw_opcode,
+ &mov_n_opcode,
+ &moveqz_opcode,
+ &movgez_opcode,
+ &movi_opcode,
+ &movi_n_opcode,
+ &movltz_opcode,
+ &movnez_opcode,
+ &movsp_opcode,
+ &neg_opcode,
+ &nop_n_opcode,
+ &nsa_opcode,
+ &nsau_opcode,
+ &or_opcode,
+ &pdtlb_opcode,
+ &pitlb_opcode,
+ &rdtlb0_opcode,
+ &rdtlb1_opcode,
+ &ret_opcode,
+ &ret_n_opcode,
+ &retw_opcode,
+ &retw_n_opcode,
+ &rfde_opcode,
+ &rfe_opcode,
+ &rfi_opcode,
+ &rfwo_opcode,
+ &rfwu_opcode,
+ &ritlb0_opcode,
+ &ritlb1_opcode,
+ &rotw_opcode,
+ &rsil_opcode,
+ &rsr_opcode,
+ &rsync_opcode,
+ &s16i_opcode,
+ &s32e_opcode,
+ &s32i_opcode,
+ &s32i_n_opcode,
+ &s8i_opcode,
+ &sdct_opcode,
+ &sict_opcode,
+ &sicw_opcode,
+ &simcall_opcode,
+ &sll_opcode,
+ &slli_opcode,
+ &sra_opcode,
+ &srai_opcode,
+ &src_opcode,
+ &srl_opcode,
+ &srli_opcode,
+ &ssa8b_opcode,
+ &ssa8l_opcode,
+ &ssai_opcode,
+ &ssl_opcode,
+ &ssr_opcode,
+ &sub_opcode,
+ &subx2_opcode,
+ &subx4_opcode,
+ &subx8_opcode,
+ &syscall_opcode,
+ &waiti_opcode,
+ &wdtlb_opcode,
+ &witlb_opcode,
+ &wsr_opcode,
+ &xor_opcode,
+ &xsr_opcode
+};
+
+xtensa_opcode_internal **
+get_opcodes (void)
+{
+ return &opcodes[0];
+}
+
+const int
+get_num_opcodes (void)
+{
+ return 149;
+}
+
+#define xtensa_abs_op 0
+#define xtensa_add_op 1
+#define xtensa_add_n_op 2
+#define xtensa_addi_op 3
+#define xtensa_addi_n_op 4
+#define xtensa_addmi_op 5
+#define xtensa_addx2_op 6
+#define xtensa_addx4_op 7
+#define xtensa_addx8_op 8
+#define xtensa_and_op 9
+#define xtensa_ball_op 10
+#define xtensa_bany_op 11
+#define xtensa_bbc_op 12
+#define xtensa_bbci_op 13
+#define xtensa_bbs_op 14
+#define xtensa_bbsi_op 15
+#define xtensa_beq_op 16
+#define xtensa_beqi_op 17
+#define xtensa_beqz_op 18
+#define xtensa_beqz_n_op 19
+#define xtensa_bge_op 20
+#define xtensa_bgei_op 21
+#define xtensa_bgeu_op 22
+#define xtensa_bgeui_op 23
+#define xtensa_bgez_op 24
+#define xtensa_blt_op 25
+#define xtensa_blti_op 26
+#define xtensa_bltu_op 27
+#define xtensa_bltui_op 28
+#define xtensa_bltz_op 29
+#define xtensa_bnall_op 30
+#define xtensa_bne_op 31
+#define xtensa_bnei_op 32
+#define xtensa_bnez_op 33
+#define xtensa_bnez_n_op 34
+#define xtensa_bnone_op 35
+#define xtensa_break_op 36
+#define xtensa_break_n_op 37
+#define xtensa_call0_op 38
+#define xtensa_call12_op 39
+#define xtensa_call4_op 40
+#define xtensa_call8_op 41
+#define xtensa_callx0_op 42
+#define xtensa_callx12_op 43
+#define xtensa_callx4_op 44
+#define xtensa_callx8_op 45
+#define xtensa_dhi_op 46
+#define xtensa_dhwb_op 47
+#define xtensa_dhwbi_op 48
+#define xtensa_dii_op 49
+#define xtensa_diwb_op 50
+#define xtensa_diwbi_op 51
+#define xtensa_dpfr_op 52
+#define xtensa_dpfro_op 53
+#define xtensa_dpfw_op 54
+#define xtensa_dpfwo_op 55
+#define xtensa_dsync_op 56
+#define xtensa_entry_op 57
+#define xtensa_esync_op 58
+#define xtensa_excw_op 59
+#define xtensa_extui_op 60
+#define xtensa_idtlb_op 61
+#define xtensa_idtlba_op 62
+#define xtensa_ihi_op 63
+#define xtensa_iii_op 64
+#define xtensa_iitlb_op 65
+#define xtensa_iitlba_op 66
+#define xtensa_ipf_op 67
+#define xtensa_isync_op 68
+#define xtensa_j_op 69
+#define xtensa_jx_op 70
+#define xtensa_l16si_op 71
+#define xtensa_l16ui_op 72
+#define xtensa_l32e_op 73
+#define xtensa_l32i_op 74
+#define xtensa_l32i_n_op 75
+#define xtensa_l32r_op 76
+#define xtensa_l8ui_op 77
+#define xtensa_ldct_op 78
+#define xtensa_lict_op 79
+#define xtensa_licw_op 80
+#define xtensa_loop_op 81
+#define xtensa_loopgtz_op 82
+#define xtensa_loopnez_op 83
+#define xtensa_memw_op 84
+#define xtensa_mov_n_op 85
+#define xtensa_moveqz_op 86
+#define xtensa_movgez_op 87
+#define xtensa_movi_op 88
+#define xtensa_movi_n_op 89
+#define xtensa_movltz_op 90
+#define xtensa_movnez_op 91
+#define xtensa_movsp_op 92
+#define xtensa_neg_op 93
+#define xtensa_nop_n_op 94
+#define xtensa_nsa_op 95
+#define xtensa_nsau_op 96
+#define xtensa_or_op 97
+#define xtensa_pdtlb_op 98
+#define xtensa_pitlb_op 99
+#define xtensa_rdtlb0_op 100
+#define xtensa_rdtlb1_op 101
+#define xtensa_ret_op 102
+#define xtensa_ret_n_op 103
+#define xtensa_retw_op 104
+#define xtensa_retw_n_op 105
+#define xtensa_rfde_op 106
+#define xtensa_rfe_op 107
+#define xtensa_rfi_op 108
+#define xtensa_rfwo_op 109
+#define xtensa_rfwu_op 110
+#define xtensa_ritlb0_op 111
+#define xtensa_ritlb1_op 112
+#define xtensa_rotw_op 113
+#define xtensa_rsil_op 114
+#define xtensa_rsr_op 115
+#define xtensa_rsync_op 116
+#define xtensa_s16i_op 117
+#define xtensa_s32e_op 118
+#define xtensa_s32i_op 119
+#define xtensa_s32i_n_op 120
+#define xtensa_s8i_op 121
+#define xtensa_sdct_op 122
+#define xtensa_sict_op 123
+#define xtensa_sicw_op 124
+#define xtensa_simcall_op 125
+#define xtensa_sll_op 126
+#define xtensa_slli_op 127
+#define xtensa_sra_op 128
+#define xtensa_srai_op 129
+#define xtensa_src_op 130
+#define xtensa_srl_op 131
+#define xtensa_srli_op 132
+#define xtensa_ssa8b_op 133
+#define xtensa_ssa8l_op 134
+#define xtensa_ssai_op 135
+#define xtensa_ssl_op 136
+#define xtensa_ssr_op 137
+#define xtensa_sub_op 138
+#define xtensa_subx2_op 139
+#define xtensa_subx4_op 140
+#define xtensa_subx8_op 141
+#define xtensa_syscall_op 142
+#define xtensa_waiti_op 143
+#define xtensa_wdtlb_op 144
+#define xtensa_witlb_op 145
+#define xtensa_wsr_op 146
+#define xtensa_xor_op 147
+#define xtensa_xsr_op 148
+
+int
+decode_insn (const xtensa_insnbuf insn)
+{
+ switch (get_op0_field (insn)) {
+ case 0: /* QRST: op0=0000 */
+ switch (get_op1_field (insn)) {
+ case 3: /* RST3: op1=0011 */
+ switch (get_op2_field (insn)) {
+ case 8: /* MOVEQZ: op2=1000 */
+ return xtensa_moveqz_op;
+ case 9: /* MOVNEZ: op2=1001 */
+ return xtensa_movnez_op;
+ case 10: /* MOVLTZ: op2=1010 */
+ return xtensa_movltz_op;
+ case 11: /* MOVGEZ: op2=1011 */
+ return xtensa_movgez_op;
+ case 0: /* RSR: op2=0000 */
+ return xtensa_rsr_op;
+ case 1: /* WSR: op2=0001 */
+ return xtensa_wsr_op;
+ }
+ break;
+ case 9: /* LSI4: op1=1001 */
+ switch (get_op2_field (insn)) {
+ case 4: /* S32E: op2=0100 */
+ return xtensa_s32e_op;
+ case 0: /* L32E: op2=0000 */
+ return xtensa_l32e_op;
+ }
+ break;
+ case 4: /* EXTUI: op1=010x */
+ case 5: /* EXTUI: op1=010x */
+ return xtensa_extui_op;
+ case 0: /* RST0: op1=0000 */
+ switch (get_op2_field (insn)) {
+ case 15: /* SUBX8: op2=1111 */
+ return xtensa_subx8_op;
+ case 0: /* ST0: op2=0000 */
+ switch (get_r_field (insn)) {
+ case 0: /* SNM0: r=0000 */
+ switch (get_m_field (insn)) {
+ case 2: /* JR: m=10 */
+ switch (get_n_field (insn)) {
+ case 0: /* RET: n=00 */
+ return xtensa_ret_op;
+ case 1: /* RETW: n=01 */
+ return xtensa_retw_op;
+ case 2: /* JX: n=10 */
+ return xtensa_jx_op;
+ }
+ break;
+ case 3: /* CALLX: m=11 */
+ switch (get_n_field (insn)) {
+ case 0: /* CALLX0: n=00 */
+ return xtensa_callx0_op;
+ case 1: /* CALLX4: n=01 */
+ return xtensa_callx4_op;
+ case 2: /* CALLX8: n=10 */
+ return xtensa_callx8_op;
+ case 3: /* CALLX12: n=11 */
+ return xtensa_callx12_op;
+ }
+ break;
+ }
+ break;
+ case 1: /* MOVSP: r=0001 */
+ return xtensa_movsp_op;
+ case 2: /* SYNC: r=0010 */
+ switch (get_s_field (insn)) {
+ case 0: /* SYNCT: s=0000 */
+ switch (get_t_field (insn)) {
+ case 2: /* ESYNC: t=0010 */
+ return xtensa_esync_op;
+ case 3: /* DSYNC: t=0011 */
+ return xtensa_dsync_op;
+ case 8: /* EXCW: t=1000 */
+ return xtensa_excw_op;
+ case 12: /* MEMW: t=1100 */
+ return xtensa_memw_op;
+ case 0: /* ISYNC: t=0000 */
+ return xtensa_isync_op;
+ case 1: /* RSYNC: t=0001 */
+ return xtensa_rsync_op;
+ }
+ break;
+ }
+ break;
+ case 4: /* BREAK: r=0100 */
+ return xtensa_break_op;
+ case 3: /* RFEI: r=0011 */
+ switch (get_t_field (insn)) {
+ case 0: /* RFET: t=0000 */
+ switch (get_s_field (insn)) {
+ case 2: /* RFDE: s=0010 */
+ return xtensa_rfde_op;
+ case 4: /* RFWO: s=0100 */
+ return xtensa_rfwo_op;
+ case 5: /* RFWU: s=0101 */
+ return xtensa_rfwu_op;
+ case 0: /* RFE: s=0000 */
+ return xtensa_rfe_op;
+ }
+ break;
+ case 1: /* RFI: t=0001 */
+ return xtensa_rfi_op;
+ }
+ break;
+ case 5: /* SCALL: r=0101 */
+ switch (get_s_field (insn)) {
+ case 0: /* SYSCALL: s=0000 */
+ return xtensa_syscall_op;
+ case 1: /* SIMCALL: s=0001 */
+ return xtensa_simcall_op;
+ }
+ break;
+ case 6: /* RSIL: r=0110 */
+ return xtensa_rsil_op;
+ case 7: /* WAITI: r=0111 */
+ return xtensa_waiti_op;
+ }
+ break;
+ case 1: /* AND: op2=0001 */
+ return xtensa_and_op;
+ case 2: /* OR: op2=0010 */
+ return xtensa_or_op;
+ case 3: /* XOR: op2=0011 */
+ return xtensa_xor_op;
+ case 4: /* ST1: op2=0100 */
+ switch (get_r_field (insn)) {
+ case 15: /* NSAU: r=1111 */
+ return xtensa_nsau_op;
+ case 0: /* SSR: r=0000 */
+ return xtensa_ssr_op;
+ case 1: /* SSL: r=0001 */
+ return xtensa_ssl_op;
+ case 2: /* SSA8L: r=0010 */
+ return xtensa_ssa8l_op;
+ case 3: /* SSA8B: r=0011 */
+ return xtensa_ssa8b_op;
+ case 4: /* SSAI: r=0100 */
+ return xtensa_ssai_op;
+ case 8: /* ROTW: r=1000 */
+ return xtensa_rotw_op;
+ case 14: /* NSA: r=1110 */
+ return xtensa_nsa_op;
+ }
+ break;
+ case 8: /* ADD: op2=1000 */
+ return xtensa_add_op;
+ case 5: /* ST4: op2=0101 */
+ switch (get_r_field (insn)) {
+ case 15: /* RDTLB1: r=1111 */
+ return xtensa_rdtlb1_op;
+ case 0: /* IITLBA: r=0000 */
+ return xtensa_iitlba_op;
+ case 3: /* RITLB0: r=0011 */
+ return xtensa_ritlb0_op;
+ case 4: /* IITLB: r=0100 */
+ return xtensa_iitlb_op;
+ case 8: /* IDTLBA: r=1000 */
+ return xtensa_idtlba_op;
+ case 5: /* PITLB: r=0101 */
+ return xtensa_pitlb_op;
+ case 6: /* WITLB: r=0110 */
+ return xtensa_witlb_op;
+ case 7: /* RITLB1: r=0111 */
+ return xtensa_ritlb1_op;
+ case 11: /* RDTLB0: r=1011 */
+ return xtensa_rdtlb0_op;
+ case 12: /* IDTLB: r=1100 */
+ return xtensa_idtlb_op;
+ case 13: /* PDTLB: r=1101 */
+ return xtensa_pdtlb_op;
+ case 14: /* WDTLB: r=1110 */
+ return xtensa_wdtlb_op;
+ }
+ break;
+ case 6: /* RT0: op2=0110 */
+ switch (get_s_field (insn)) {
+ case 0: /* NEG: s=0000 */
+ return xtensa_neg_op;
+ case 1: /* ABS: s=0001 */
+ return xtensa_abs_op;
+ }
+ break;
+ case 9: /* ADDX2: op2=1001 */
+ return xtensa_addx2_op;
+ case 10: /* ADDX4: op2=1010 */
+ return xtensa_addx4_op;
+ case 11: /* ADDX8: op2=1011 */
+ return xtensa_addx8_op;
+ case 12: /* SUB: op2=1100 */
+ return xtensa_sub_op;
+ case 13: /* SUBX2: op2=1101 */
+ return xtensa_subx2_op;
+ case 14: /* SUBX4: op2=1110 */
+ return xtensa_subx4_op;
+ }
+ break;
+ case 1: /* RST1: op1=0001 */
+ switch (get_op2_field (insn)) {
+ case 15: /* IMP: op2=1111 */
+ switch (get_r_field (insn)) {
+ case 0: /* LICT: r=0000 */
+ return xtensa_lict_op;
+ case 1: /* SICT: r=0001 */
+ return xtensa_sict_op;
+ case 2: /* LICW: r=0010 */
+ return xtensa_licw_op;
+ case 3: /* SICW: r=0011 */
+ return xtensa_sicw_op;
+ case 8: /* LDCT: r=1000 */
+ return xtensa_ldct_op;
+ case 9: /* SDCT: r=1001 */
+ return xtensa_sdct_op;
+ }
+ break;
+ case 0: /* SLLI: op2=000x */
+ case 1: /* SLLI: op2=000x */
+ return xtensa_slli_op;
+ case 2: /* SRAI: op2=001x */
+ case 3: /* SRAI: op2=001x */
+ return xtensa_srai_op;
+ case 4: /* SRLI: op2=0100 */
+ return xtensa_srli_op;
+ case 8: /* SRC: op2=1000 */
+ return xtensa_src_op;
+ case 9: /* SRL: op2=1001 */
+ return xtensa_srl_op;
+ case 6: /* XSR: op2=0110 */
+ return xtensa_xsr_op;
+ case 10: /* SLL: op2=1010 */
+ return xtensa_sll_op;
+ case 11: /* SRA: op2=1011 */
+ return xtensa_sra_op;
+ }
+ break;
+ }
+ break;
+ case 1: /* L32R: op0=0001 */
+ return xtensa_l32r_op;
+ case 2: /* LSAI: op0=0010 */
+ switch (get_r_field (insn)) {
+ case 0: /* L8UI: r=0000 */
+ return xtensa_l8ui_op;
+ case 1: /* L16UI: r=0001 */
+ return xtensa_l16ui_op;
+ case 2: /* L32I: r=0010 */
+ return xtensa_l32i_op;
+ case 4: /* S8I: r=0100 */
+ return xtensa_s8i_op;
+ case 5: /* S16I: r=0101 */
+ return xtensa_s16i_op;
+ case 9: /* L16SI: r=1001 */
+ return xtensa_l16si_op;
+ case 6: /* S32I: r=0110 */
+ return xtensa_s32i_op;
+ case 7: /* CACHE: r=0111 */
+ switch (get_t_field (insn)) {
+ case 15: /* III: t=1111 */
+ return xtensa_iii_op;
+ case 0: /* DPFR: t=0000 */
+ return xtensa_dpfr_op;
+ case 1: /* DPFW: t=0001 */
+ return xtensa_dpfw_op;
+ case 2: /* DPFRO: t=0010 */
+ return xtensa_dpfro_op;
+ case 4: /* DHWB: t=0100 */
+ return xtensa_dhwb_op;
+ case 3: /* DPFWO: t=0011 */
+ return xtensa_dpfwo_op;
+ case 8: /* DCE: t=1000 */
+ switch (get_op1_field (insn)) {
+ case 4: /* DIWB: op1=0100 */
+ return xtensa_diwb_op;
+ case 5: /* DIWBI: op1=0101 */
+ return xtensa_diwbi_op;
+ }
+ break;
+ case 5: /* DHWBI: t=0101 */
+ return xtensa_dhwbi_op;
+ case 6: /* DHI: t=0110 */
+ return xtensa_dhi_op;
+ case 7: /* DII: t=0111 */
+ return xtensa_dii_op;
+ case 12: /* IPF: t=1100 */
+ return xtensa_ipf_op;
+ case 14: /* IHI: t=1110 */
+ return xtensa_ihi_op;
+ }
+ break;
+ case 10: /* MOVI: r=1010 */
+ return xtensa_movi_op;
+ case 12: /* ADDI: r=1100 */
+ return xtensa_addi_op;
+ case 13: /* ADDMI: r=1101 */
+ return xtensa_addmi_op;
+ }
+ break;
+ case 8: /* L32I.N: op0=1000 */
+ return xtensa_l32i_n_op;
+ case 5: /* CALL: op0=0101 */
+ switch (get_n_field (insn)) {
+ case 0: /* CALL0: n=00 */
+ return xtensa_call0_op;
+ case 1: /* CALL4: n=01 */
+ return xtensa_call4_op;
+ case 2: /* CALL8: n=10 */
+ return xtensa_call8_op;
+ case 3: /* CALL12: n=11 */
+ return xtensa_call12_op;
+ }
+ break;
+ case 6: /* SI: op0=0110 */
+ switch (get_n_field (insn)) {
+ case 0: /* J: n=00 */
+ return xtensa_j_op;
+ case 1: /* BZ: n=01 */
+ switch (get_m_field (insn)) {
+ case 0: /* BEQZ: m=00 */
+ return xtensa_beqz_op;
+ case 1: /* BNEZ: m=01 */
+ return xtensa_bnez_op;
+ case 2: /* BLTZ: m=10 */
+ return xtensa_bltz_op;
+ case 3: /* BGEZ: m=11 */
+ return xtensa_bgez_op;
+ }
+ break;
+ case 2: /* BI0: n=10 */
+ switch (get_m_field (insn)) {
+ case 0: /* BEQI: m=00 */
+ return xtensa_beqi_op;
+ case 1: /* BNEI: m=01 */
+ return xtensa_bnei_op;
+ case 2: /* BLTI: m=10 */
+ return xtensa_blti_op;
+ case 3: /* BGEI: m=11 */
+ return xtensa_bgei_op;
+ }
+ break;
+ case 3: /* BI1: n=11 */
+ switch (get_m_field (insn)) {
+ case 0: /* ENTRY: m=00 */
+ return xtensa_entry_op;
+ case 1: /* B1: m=01 */
+ switch (get_r_field (insn)) {
+ case 8: /* LOOP: r=1000 */
+ return xtensa_loop_op;
+ case 9: /* LOOPNEZ: r=1001 */
+ return xtensa_loopnez_op;
+ case 10: /* LOOPGTZ: r=1010 */
+ return xtensa_loopgtz_op;
+ }
+ break;
+ case 2: /* BLTUI: m=10 */
+ return xtensa_bltui_op;
+ case 3: /* BGEUI: m=11 */
+ return xtensa_bgeui_op;
+ }
+ break;
+ }
+ break;
+ case 9: /* S32I.N: op0=1001 */
+ return xtensa_s32i_n_op;
+ case 10: /* ADD.N: op0=1010 */
+ return xtensa_add_n_op;
+ case 7: /* B: op0=0111 */
+ switch (get_r_field (insn)) {
+ case 6: /* BBCI: r=011x */
+ case 7: /* BBCI: r=011x */
+ return xtensa_bbci_op;
+ case 0: /* BNONE: r=0000 */
+ return xtensa_bnone_op;
+ case 1: /* BEQ: r=0001 */
+ return xtensa_beq_op;
+ case 2: /* BLT: r=0010 */
+ return xtensa_blt_op;
+ case 4: /* BALL: r=0100 */
+ return xtensa_ball_op;
+ case 14: /* BBSI: r=111x */
+ case 15: /* BBSI: r=111x */
+ return xtensa_bbsi_op;
+ case 3: /* BLTU: r=0011 */
+ return xtensa_bltu_op;
+ case 5: /* BBC: r=0101 */
+ return xtensa_bbc_op;
+ case 8: /* BANY: r=1000 */
+ return xtensa_bany_op;
+ case 9: /* BNE: r=1001 */
+ return xtensa_bne_op;
+ case 10: /* BGE: r=1010 */
+ return xtensa_bge_op;
+ case 11: /* BGEU: r=1011 */
+ return xtensa_bgeu_op;
+ case 12: /* BNALL: r=1100 */
+ return xtensa_bnall_op;
+ case 13: /* BBS: r=1101 */
+ return xtensa_bbs_op;
+ }
+ break;
+ case 11: /* ADDI.N: op0=1011 */
+ return xtensa_addi_n_op;
+ case 12: /* ST2: op0=1100 */
+ switch (get_i_field (insn)) {
+ case 0: /* MOVI.N: i=0 */
+ return xtensa_movi_n_op;
+ case 1: /* BZ6: i=1 */
+ switch (get_z_field (insn)) {
+ case 0: /* BEQZ.N: z=0 */
+ return xtensa_beqz_n_op;
+ case 1: /* BNEZ.N: z=1 */
+ return xtensa_bnez_n_op;
+ }
+ break;
+ }
+ break;
+ case 13: /* ST3: op0=1101 */
+ switch (get_r_field (insn)) {
+ case 15: /* S3: r=1111 */
+ switch (get_t_field (insn)) {
+ case 0: /* RET.N: t=0000 */
+ return xtensa_ret_n_op;
+ case 1: /* RETW.N: t=0001 */
+ return xtensa_retw_n_op;
+ case 2: /* BREAK.N: t=0010 */
+ return xtensa_break_n_op;
+ case 3: /* NOP.N: t=0011 */
+ return xtensa_nop_n_op;
+ }
+ break;
+ case 0: /* MOV.N: r=0000 */
+ return xtensa_mov_n_op;
+ }
+ break;
+ }
+ return XTENSA_UNDEFINED;
+}
+
+int
+interface_version (void)
+{
+ return 3;
+}
+
+static struct config_struct config_table[] = {
+ {"IsaMemoryOrder", "BigEndian"},
+ {"PIFReadDataBits", "128"},
+ {"PIFWriteDataBits", "128"},
+ {"IsaCoprocessorCount", "0"},
+ {"IsaUseBooleans", "0"},
+ {"IsaUseDensityInstruction", "1"},
+ {0, 0}
+};
+
+struct config_struct * get_config_table (void);
+
+struct config_struct *
+get_config_table (void)
+{
+ return config_table;
+}
+
+xtensa_isa_module xtensa_isa_modules[] = {
+ { get_num_opcodes, get_opcodes, decode_insn, get_config_table },
+ { 0, 0, 0, 0 }
+};
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a0f2770..e5d2ce6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,65 @@
-2003-03-26 Andrew Cagney <cagney@redhat.com>
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * Makefile.in (SUBDIR_MI_OBS): Add "mi-cmd-file.o".
+ (SUBDIR_MI_SRCS): Add "mi-cmd-file.c".
+ (mi-cmd-file.o): Update dependencies.
+
+2003-04-01 Kevin Buettner <kevinb@redhat.com>
+
+ * mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum)
+ (mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM.
+
+2003-04-01 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h).
+ * language.h (struct language_defn): Add la_demangle.
+ (language_demangle): Declare.
+ * language.c (language_demangle): New function.
+ (unk_lang_demangle): Likewise.
+ (unknown_language_defn, auto_language_defn, local_language_defn):
+ Add ukn_lang_demangle.
+ * ada-lang.c (ada_language_defn): Add NULL for la_demangle element.
+ * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise.
+ * c-lang.c (c_language_defn, asm_language_defn): Likewise.
+ (cplus_language_defn): Add cplus_demangle for la_demangle element.
+ * jv-lang.c (java_demangle): New function
+ (java_language_defn): Use it for la_demangle element.
+ * objc-lang.c (objc_demangle): Add options argument
+ (objc_language_defn): Use objc_demangle for la_demangle element.
+ * maint.c (maintenance_demangle): Replace switch with
+ call to language_demangle.
+ * utils.c (fprintf_symbol_filtered): Likewise.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * printcmd.c (print_frame_nameless_args): Delete #ifdef
+ NAMELESS_ARG_VALUE, PRINT_NAMELESS_INTEGER and
+ PRINT_TYPELESS_INTEGER.
+ * config/sparc/tm-sp64.h (DEPRECATED_PUSH_RETURN_ADDRESS): Rename
+ PUSH_RETURN_ADDRESS.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (d10v-tdep.o): Update dependencies.
+ * d10v-tdep.c: Include "frame-base.h".
+ (d10v_frame_unwind): Make constant.
+ (d10v_frame_base_address): New function.
+ (d10v_frame_base): New variable.
+ (d10v_gdbarch_init): Set frame_base default.
+ (struct d10v_unwind_cache): Add the field "prev_sp". Update
+ comment for base.
+ (d10v_frame_unwind_cache): Set and use "prev_sp".
+ (d10v_frame_this_id): Use the previous frame's inner most stack
+ address and this frame's func address for the frame ID. Use
+ frame_id_build. Don't analyze beyond the current instruction.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (get_frame_locals_address, get_frame_args_address):
+ Refer to the base address, instead of the address of the first
+ local or parameter.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
Add frame debug info addresses:
* frame-base.c: New file.
@@ -14,27 +75,437 @@
(get_frame_locals_address): New function.
(get_frame_base_address): New function.
(get_frame_args_address): New function.
- * findvar.c (read_var_value): Use get_frame_locals_address.
+ * findvar.c (read_var_value): Use get_frame_locals_address and
+ get_frame_args_address.
* stack.c (frame_info): Use get_frame_locals_address and
get_frame_args_address.
(FRAME_ARGS_ADDRESS_CORRECT): Delete conditionally defined macro,
moved to "frame-base.c".
- * Makefile.in (frame_base_h): Define.
- (frame.o): Update dependencies.
- (d10v-tdep.o): Update dependencies.
- (frame-base.o): Add dependencies.
- (SFILES): Add frame-base.c.
- (COMMON_OBS): Add frame-base.o.
* printcmd.c (print_frame_nameless_args): Ditto.
* symtab.h (address_class): Update comments.
* dwarf2loc.c (dwarf_expr_frame_base): Add note about
get_frame_base_address.
* dwarf2expr.c (execute_stack_op): Ditto.
- * d10v-tdep.c: Include "frame-base.h".
- (d10v_frame_unwind): Make constant.
- (d10v_frame_base_address): New function.
- (d10v_frame_base): New variable.
- (d10v_gdbarch_init): Set frame_base default.
+ * Makefile.in (frame_base_h): Define.
+ (frame.o): Update dependencies.
+ (frame-base.o): Add dependencies.
+ (SFILES): Add frame-base.c.
+ (COMMON_OBS): Add frame-base.o.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_START_OFFSET): Default to zero.
+ CALL_DUMMY_LENGTH): Ditto.
+ * gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_START_OFFSET): Delete macro.
+ (CALL_DUMMY_LENGTH): Delete macro.
+ * alpha-tdep.c (alpha_gdbarch_init): Do not set above when zero.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * hppa-tdep.c (hppa_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+
+2003-04-01 Corinna Vinschen <vinschen@redhat.com>
+
+ * frame.c (get_prev_frame): Disable call to inside_entry_file().
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_BREAKPOINT_OFFSET): Default to zero.
+ (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * config/sparc/tm-sp64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * config/pa/tm-hppa64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * inferior.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ (CALL_DUMMY_BREAKPOINT_OFFSET): Delete.
+ * infcmd.c (run_stack_dummy): Simplify assuming
+ CALL_DUMMY_BREAKPOINT_OFFSET_P.
+ * infrun.c (handle_inferior_event): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Do not set
+ call_dummy_breakpoint_offset or call_dummy_breakpoint_offset_p.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+
+2003-04-01 Daniel Jacobowitz <drow@mvista.com>
+
+ * symfile.c (symfile_relocate_debug_section): Update call to
+ bfd_simple_get_relocated_section_contents.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (FIX_CALL_DUMMY): Change to function with predicate.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * inferior.h (FIX_CALL_DUMMY): Delete macro.
+ * valops.c (hand_function_call): Only call FIX_CALL_DUMMY when
+ available.
+ * frame.h (generic_fix_call_dummy): Delete declaration.
+ * dummy-frame.h: Update comment.
+ * dummy-frame.c (generic_fix_call_dummy): Delete function.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ fix_call_dummy.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+
+2003-03-31 J. Brobecker <brobecker@gnat.com>
+
+ * config/pa/tm-hppa64.h (FRAME_ARGS_ADDRESS): Delete macro, not useful.
+ (INIT_FRAME_AP): Likewise.
+ (EXTRA_FRAME_INFO): Likewise.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh: Include "symfile.h".
+ (CALL_DUMMY_ADDRESS): Default to entry_point_address.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_ADDRESS): Delete macro.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ call_dummy_address, the default is at entry_point_address.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_P): Delete.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_P): Delete macro.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_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.
+ * breakpoint.c (deprecated_frame_in_dummy): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * dummy-frame.c (dummy_frame_this_id): Update comments.
+ * rs6000-tdep.c (rs6000_extract_struct_value_address): Ditto.
+ * frame.c (legacy_get_prev_frame): Ditto.
+ * valops.c (call_function_by_hand): Delete function.
+ (hand_function_call): Rename to call_function_by_hand
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ 2002-11-10 Klee Dienes <kdienes@apple.com>
+ * value.h (struct value): Update comment.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c: Replace _FP_REGNUM and FP_REGNUM with
+ D10V_FP_REGNUM.
+ (d10v_gdbarch_init): Do not set fp_regnum.
+
+ * frame.c (get_frame_base): Force ID initialization.
+ (get_prev_frame): Move computation of the frame ID from here ...
+ (get_frame_id): ... to here.
+ (legacy_get_prev_frame): Mark the frame ID as valid.
+ * frame.h (struct frame_info): Add field "id_p".
+
+2003-03-30 Mark Kettenis <kettenis@gnu.org>
+
+ * i386-tdep.c (i386_store_struct_return): Removed.
+ (i386_gdbarch_init): Don't set deprecated_store_struct_return.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_DUMMY_WRITE_SP): Replace TARGET_WRITE_SP.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * v850-tdep.c (v850_gdbarch_init): Set deprecated_dummy_write_sp.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_push_dummy_frame, sparc_pop_frame): Update.
+ * config/sparc/tm-sp64.h (DEPRECATED_DUMMY_WRITE_SP): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_DUMMY_WRITE_SP): Define.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * valops.c (hand_function_call): Replace TARGET_WRITE_SP with
+ DEPRECATED_DUMMY_WRITE_SP. Call when the method is available,
+ instead of when push_dummy_call is not available.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * infttrace.c: Include "gdbthread.h".
+ (parent_attach_all): Fix function signature.
+ (call_ptrace): Update call.
+ * Makefile.in (infttrace.o): Update dependencies.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_PUSH_RETURN_ADDRESS): Replace
+ PUSH_RETURN_ADDRESS.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * 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.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * valops.c (hand_function_call): Update.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_gdbarch_init): Do not set call_dummy_words or
+ sizeof_call_dummy_words.
+ * gdbarch.sh (CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS): Always
+ define.
+ * gdbarch.h: Regenerate.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * infttrace.h: New file.
+ * hpread.c: Include "gdb_assert.h" and "somsolib.h".
+ (hpread_get_textlow): Detect an uninitialized dn_bufp.
+ (hpread_read_doc_function_type): Detect an initialized type1.
+ (hpread_quick_traverse): Initialize mod_name_string.
+ * somsolib.h: Add #ifdef SOMSOLIB_H wrapper.
+ (som_solib_get_solib_by_pc): Declare.
+ (so_lib_thread_start_addr): Declare.
+ (no_shared_libraries): Declare.
+ * somread.c (init_import_symbols): Make static. Add forward
+ declaration.
+ * config/pa/nm-hppah.h: Include "infttrace.h" for
+ parent_attach_all.
+ (hppa_insert_hw_watchpoint): Declare.
+ (hppa_can_use_hw_watchpoint, hppa_remove_hw_watchpoint): Declare.
+ * hppah-nat.c: Include "gdb_string.h".
+ (parent_attach_all): Delete extern declaration, moved to
+ "infttrace.h".
+ (hppa_can_use_hw_watchpoint): Change type of "type" parameter to
+ int.
+ (hppa_remove_hw_watchpoint, hppa_insert_hw_watchpoint): Ditto.
+ * Makefile.in (infttrace_h): Define.
+ (hpread.o): Update dependencies.
+ (hppah-nat.o, hppa-hpux-tdep.o, hppa-tdep.o): Ditto.
+ * hppa-hpux-tdep.c: Include "gdb_string.h".
+ * hppa-tdep.c (hppa_frame_saved_pc): Initialize "old_pc".
+ * infrun.c (handle_inferior_event): Always initialize
+ stepped_after_stopped_by_watchpoint. Add default and remove
+ fallthrough in switch statement.
+ * infttrace.c (hppa_can_use_hw_watchpoint): Change type of "type"
+ parameter to int.
+ (hppa_remove_hw_watchpoint): Ditto.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * ns32k-tdep.c (ns32k_gdbarch_init): Set the call dummy breakpoint
+ offset.
+
+2003-03-29 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (arm_push_arguments): Delete.
+ (struct stack_item): New type.
+ (push_stack_item, pop_stack_item, arm_push_dummy_call): New functions.
+ (arm_store_struct_return): Delte.
+ (arm_gdbarch_init): Register arm_push_dummy_call. Don't register
+ arm_push_arguments or arm_store_struct_return.
+
+2003-03-28 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (d10v-tdep.o): Update dependencies.
+ * remote.h (target_resume_hook, target_wait_loop_hook): Declare.
+ * d10v-tdep.c: Include "remote.h".
+ (target_resume_hook): Delete extern declaration.
+ (target_wait_loop_hook): Ditto.
+ (tdisassemble_command): Eliminate assignment in "if" conditional.
+ (d10v_ts2_register_sim_regno): Eliminate call to
+ legacy_register_sim_regno.
+ (d10v_ts3_register_sim_regno): Ditto.
+
+2003-03-28 Jeff Johnston <jjohnstn@redhat.com>
+
+ * thread.c: Reindented.
+ * lin-lwp.c: Ditto.
+ * linux-proc.c: Ditto.
+
+2003-03-28 Bob Rossi <bob_rossi@cox.net>
+
+ * MAINTAINERS (write after approval): Add myself.
+
+2003-03-27 Theodore A. Roth <troth@openavr.org>
+
+ * objc-exp.y: Add missing semi-colons.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.c (write_sp): Delete function and references.
+ * inferior.h (write_sp): Delete declaration.
+ * valops.c (hand_function_call): Replace write_sp with
+ TARGET_WRITE_SP.
+ * sparc-tdep.c (sparc_push_dummy_frame): Ditto.
+ (sparc_pop_frame): Ditto.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * NEWS: Mention removal of support for hppa*-*-bsd* and
+ hppa*-*-osf* natives, and hppa*-*-pro* target.
+ * config/pa/xm-hppah.h: Do not include "pa/xm-pa.h".
+ * config/pa/xm-pa.h: Obsolete file.
+ * config/pa/xm-hppab.h: Obsolete file.
+ * config/pa/nm-hppab.h: Obsolete file.
+ * config/pa/tm-hppab.h: Obsolete file.
+ * config/pa/tm-hppao.h: Obsolete file.
+ * config/pa/nm-hppao.h: Obsolete file.
+ * config/pa/tm-pro.h: Obsolete file.
+ * config/pa/hppaosf.mt: Obsolete file.
+ * config/pa/hppaosf.mh: Obsolete file.
+ * config/pa/hppapro.mt: Obsolete file.
+ * config/pa/hppabsd.mt: Obsolete file.
+ * config/pa/hppabsd.mh: Obsolete file.
+ * configure.host: Disable hppa*-*-bsd* and hppa*-*-osf*.
+ * configure.tgt: Disable hppa*-*-bsd*, hppa*-*-pro* and
+ hppa*-*-osf*.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_gdbarch_init): Set push_dummy_call instead of
+ push_arguments. Don't set push_return_address or write_sp.
+ (d10v_push_dummy_call): Replace d10v_push_arguments.
+ (d10v_push_return_address, d10v_write_sp): Delete function,
+ handled by push_dummy_call.
+
+2003-03-26 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_PUSH_ARGUMENTS): Rename PUSH_ARGUMENTS.
+ (push_dummy_call): New pure multi-arch replacement with gdbarch,
+ regcache and dummy_addr parameters.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * valops.c (hand_function_call): Use gdbarch_push_dummy_call when
+ available; assume it will handle stack alignment and return
+ address issues. Fall back to DEPRECATED_PUSH_ARGUMENTS and
+ legacy_push_arguments.
+ (legacy_push_arguments): Rename default_push_arguments.
+ * value.h (legacy_push_arguments): Rename default_push_arguments.
+ * i386-tdep.c (i386_push_arguments): Call legacy_push_arguments.
+ * config/sparc/tm-sparc.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/sparc/tm-sp64.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/i386/tm-symmetry.h: Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * 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.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_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.
+ * arm-linux-tdep.c (arm_linux_init_abi): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * signals/signals.c (do_target_signal_to_host): Correct realtime
+ signal range test.
2003-03-26 Daniel Jacobowitz <drow@mvista.com>
@@ -78,7 +549,7 @@
* objc-lang.c (objc_skip_trampoline): New function.
(objc_language_defn): Add objc_skip_trampoline.
-I2003-03-25 Andrew Cagney <cagney@redhat.com>
+2003-03-25 Andrew Cagney <cagney@redhat.com>
* frame.c (get_prev_frame): Delay validating a frame's ID -
non-NULL, didn't go backwards - until an attempt to unwind it to
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 0adfcb6..15a0ea8 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -367,6 +367,7 @@ Hans-Peter Nilsson hp@bitrange.com
David O'Brien obrien@freebsd.org
Alexandre Oliva aoliva@redhat.com
Tom Rix trix@redhat.com
+Bob Rossi bob_rossi@cox.net
Theodore A. Roth troth@verinet.com
Ian Roxborough irox@redhat.com
Grace Sainsbury graces@redhat.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 5449392..c5ba5d8 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -168,14 +168,14 @@ SUBDIR_CLI_UNINSTALL=
SUBDIR_MI_OBS = \
mi-out.o mi-console.o \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
- mi-cmd-disas.o \
+ mi-cmd-file.o mi-cmd-disas.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
- mi/mi-cmd-disas.c \
+ mi/mi-cmd-file.c mi/mi-cmd-disas.c \
mi/mi-interp.c \
mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
@@ -724,6 +724,7 @@ symtab_h = symtab.h
target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h)
terminal_h = terminal.h
top_h = top.h
+infttrace_h = infttrace.h
tracepoint_h = tracepoint.h
typeprint_h = typeprint.h
ui_file_h = ui-file.h
@@ -1570,7 +1571,8 @@ builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \
$(gdb_string_h) $(gdb_assert_h)
c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \
- $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h)
+ $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \
+ $(demangle_h)
c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
$(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
@@ -1625,7 +1627,8 @@ d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \
$(gdb_string_h) $(value_h) $(inferior_h) $(dis_asm_h) $(symfile_h) \
$(objfiles_h) $(language_h) $(arch_utils_h) $(regcache_h) \
- $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) $(gdb_assert_h)
+ $(remote_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \
+ $(gdb_assert_h)
dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(m68k_tdep_h)
dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \
@@ -1708,7 +1711,7 @@ frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \
$(gdb_obstack_h) $(dummy_frame_h) $(sentinel_frame_h) $(gdbcore_h) \
$(annotate_h) $(language_h) $(frame_unwind_h) $(frame_base_h) \
$(command_h) $(gdbcmd_h)
-frame-base.o: frame-base.c $(defs_h) $(frame_base_h)
+frame-base.o: frame-base.c $(defs_h) $(frame_base_h) $(frame_h)
frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(gdb_assert_h) $(dummy_frame_h) $(legacy_frame_h)
frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
@@ -1748,11 +1751,12 @@ h8500-tdep.o: h8500-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \
hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \
$(gdbtypes_h) $(gdbcore_h) $(cp_abi_h)
hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
- $(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \
+ $(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
+ $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(a_out_encap_h) \
$(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \
- $(symfile_h) $(objfiles_h) $(language_h) $(osabi_h) $(gdb_assert_h)
+ $(symfile_h) $(objfiles_h)
hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
- $(osabi_h)
+ $(osabi_h) $(gdb_string_h)
hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h)
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
$(gdb_wait_h) $(regcache_h)
@@ -1761,7 +1765,7 @@ hppam3-nat.o: hppam3-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \
$(syms_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \
$(complaints_h) $(gdb_stabs_h) $(gdbtypes_h) $(demangle_h) \
- $(gdb_string_h)
+ $(somsolib_h) $(gdb_assert_h) $(gdb_string_h)
hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
@@ -1839,7 +1843,7 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h)
infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
- $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbcore_h)
+ $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbthread_h) $(gdbcore_h)
interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
$(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
$(gdb_events_h) $(gdb_assert_h) $(top_h)
@@ -1850,7 +1854,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \
- $(jv_lang_h) $(gdbcore_h) $(block_h)
+ $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h)
jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \
$(c_lang_h) $(cp_abi_h)
@@ -1862,7 +1866,7 @@ kod.o: kod.c $(defs_h) $(command_h) $(gdbcmd_h) $(target_h) $(gdb_string_h) \
$(kod_h)
language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
- $(parser_defs_h) $(jv_lang_h)
+ $(parser_defs_h) $(jv_lang_h) $(demangle_h)
lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
@@ -2117,7 +2121,7 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \
$(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) $(gdb_stabs_h) \
$(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) $(gdb_assert_h) \
$(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \
- $(gdbcore_h)
+ $(gdbcore_h) $(solib_h)
rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h)
rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
@@ -2542,6 +2546,10 @@ mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \
$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
$(mi_getopt_h) $(gdb_events_h) $(gdb_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
+mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.c $(defs_h) $(mi_cmds_h) \
+ $(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
+ $(mi_getopt_h) $(gdb_events_h) $(gdb_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-file.c
mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
$(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c
diff --git a/gdb/NEWS b/gdb/NEWS
index eaefeff..0e381d9 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -41,6 +41,9 @@ Mitsubishi M32R/D w/simulator m32r-*-elf*
Z8000 simulator z8k-zilog-none or z8ksim
Matsushita MN10200 w/simulator mn10200-*-*
H8/500 simulator h8500-hitachi-hms or h8500hms
+HP/PA running BSD hppa*-*-bsd*
+HP/PA running OSF/1 hppa*-*-osf*
+HP/PA Pro target hppa*-*-pro*
* REMOVED configurations and files
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index bcb2805..bc0809d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8081,6 +8081,7 @@ const struct language_defn ada_language_defn = {
ada_val_print, /* Print a value using appropriate syntax */
ada_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
#if 0
{"8#%lo#", "8#", "o", "#"}, /* Octal format info */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index a6449e1..d3b5865 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -67,7 +67,6 @@ static gdbarch_frame_locals_address_ftype alpha_frame_locals_address;
static gdbarch_skip_prologue_ftype alpha_skip_prologue;
static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call;
-static gdbarch_push_arguments_ftype alpha_push_arguments;
static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
@@ -1852,15 +1851,13 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Settings for calling functions in the inferior. */
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, alpha_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, alpha_push_arguments);
set_gdbarch_deprecated_pop_frame (gdbarch, alpha_pop_frame);
/* On the Alpha, the call dummy code is never copied to user space,
stopping the user call is achieved via a bp_call_dummy breakpoint.
But we need a fake CALL_DUMMY definition to enable the proper
call_function_by_hand and to avoid zero length array warnings. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, alpha_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
set_gdbarch_frame_args_address (gdbarch, alpha_frame_args_address);
@@ -1871,11 +1868,10 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
argument handling and bp_call_dummy takes care of stopping the dummy. */
set_gdbarch_call_dummy_address (gdbarch, alpha_call_dummy_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy);
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 01b45f1..fa4d8fa 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -536,7 +536,7 @@ arm_linux_init_abi (struct gdbarch_info info,
/* The following two overrides shouldn't be needed. */
set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, arm_linux_push_arguments);
/* Shared library handling. */
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index dbe1483..21d8488 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1334,137 +1334,6 @@ arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
write_register (4, fun);
}
-/* Note: ScottB
-
- This function does not support passing parameters using the FPA
- variant of the APCS. It passes any floating point arguments in the
- general registers and/or on the stack. */
-
-static CORE_ADDR
-arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
-{
- CORE_ADDR fp;
- int argnum;
- int argreg;
- int nstack;
- int simd_argreg;
- int second_pass;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
- /* Walk through the list of args and determine how large a temporary
- stack is required. Need to take care here as structs may be
- passed on the stack, and we have to to push them. On the second
- pass, do the store. */
- nstack = 0;
- fp = sp;
- for (second_pass = 0; second_pass < 2; second_pass++)
- {
- /* Compute the FP using the information computed during the
- first pass. */
- if (second_pass)
- fp = sp - nstack;
-
- simd_argreg = 0;
- argreg = ARM_A1_REGNUM;
- nstack = 0;
-
- /* The struct_return pointer occupies the first parameter
- passing register. */
- if (struct_return)
- {
- if (second_pass)
- {
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "struct return in %s = 0x%s\n",
- REGISTER_NAME (argreg),
- paddr (struct_addr));
- write_register (argreg, struct_addr);
- }
- argreg++;
- }
-
- for (argnum = 0; argnum < nargs; argnum++)
- {
- int len;
- struct type *arg_type;
- struct type *target_type;
- enum type_code typecode;
- char *val;
-
- arg_type = check_typedef (VALUE_TYPE (args[argnum]));
- len = TYPE_LENGTH (arg_type);
- target_type = TYPE_TARGET_TYPE (arg_type);
- typecode = TYPE_CODE (arg_type);
- val = VALUE_CONTENTS (args[argnum]);
-
- /* If the argument is a pointer to a function, and it is a
- Thumb function, create a LOCAL copy of the value and set
- the THUMB bit in it. */
- if (second_pass
- && TYPE_CODE_PTR == typecode
- && target_type != NULL
- && TYPE_CODE_FUNC == TYPE_CODE (target_type))
- {
- CORE_ADDR regval = extract_address (val, len);
- if (arm_pc_is_thumb (regval))
- {
- val = alloca (len);
- store_address (val, len, MAKE_THUMB_ADDR (regval));
- }
- }
-
- /* Copy the argument to general registers or the stack in
- register-sized pieces. Large arguments are split between
- registers and stack. */
- while (len > 0)
- {
- int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
-
- if (argreg <= ARM_LAST_ARG_REGNUM)
- {
- /* The argument is being passed in a general purpose
- register. */
- if (second_pass)
- {
- CORE_ADDR regval = extract_address (val,
- partial_len);
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "arg %d in %s = 0x%s\n",
- argnum,
- REGISTER_NAME (argreg),
- phex (regval, REGISTER_SIZE));
- write_register (argreg, regval);
- }
- argreg++;
- }
- else
- {
- if (second_pass)
- {
- /* Push the arguments onto the stack. */
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "arg %d @ 0x%s + %d\n",
- argnum, paddr (fp), nstack);
- write_memory (fp + nstack, val, REGISTER_SIZE);
- }
- nstack += REGISTER_SIZE;
- }
-
- len -= partial_len;
- val += partial_len;
- }
-
- }
- }
-
- /* Return the bottom of the argument list (pointed to by fp). */
- return fp;
-}
-
/* Pop the current frame. So long as the frame info has been
initialized properly (see arm_init_extra_frame_info), this code
works for dummy frames as well as regular frames. I.e, there's no
@@ -1499,6 +1368,161 @@ arm_pop_frame (void)
flush_cached_frames ();
}
+/* When arguments must be pushed onto the stack, they go on in reverse
+ order. The code below implements a FILO (stack) to do this. */
+
+struct stack_item
+{
+ int len;
+ struct stack_item *prev;
+ void *data;
+};
+
+static struct stack_item *
+push_stack_item (struct stack_item *prev, void *contents, int len)
+{
+ struct stack_item *si;
+ si = xmalloc (sizeof (struct stack_item));
+ si->data = malloc (len);
+ si->len = len;
+ si->prev = prev;
+ memcpy (si->data, contents, len);
+ return si;
+}
+
+static struct stack_item *
+pop_stack_item (struct stack_item *si)
+{
+ struct stack_item *dead = si;
+ si = si->prev;
+ xfree (dead->data);
+ xfree (dead);
+ return si;
+}
+
+/* We currently only support passing parameters in integer registers. This
+ conforms with GCC's default model. Several other variants exist and
+ we should probably support some of them based on the selected ABI. */
+
+static CORE_ADDR
+arm_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR dummy_addr, int nargs, struct value **args,
+ CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+ int argnum;
+ int argreg;
+ int nstack;
+ struct stack_item *si = NULL;
+
+ /* Set the return address. For the ARM, the return breakpoint is always
+ at DUMMY_ADDR. */
+ /* XXX Fix for Thumb. */
+ regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, dummy_addr);
+
+ /* Walk through the list of args and determine how large a temporary
+ stack is required. Need to take care here as structs may be
+ passed on the stack, and we have to to push them. */
+ nstack = 0;
+
+ argreg = ARM_A1_REGNUM;
+ nstack = 0;
+
+ /* Some platforms require a double-word aligned stack. Make sure sp
+ is correctly aligned before we start. We always do this even if
+ it isn't really needed -- it can never hurt things. */
+ sp &= ~(CORE_ADDR)(2 * REGISTER_SIZE - 1);
+
+ /* The struct_return pointer occupies the first parameter
+ passing register. */
+ if (struct_return)
+ {
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "struct return in %s = 0x%s\n",
+ REGISTER_NAME (argreg), paddr (struct_addr));
+ regcache_cooked_write_unsigned (regcache, argreg, struct_addr);
+ argreg++;
+ }
+
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int len;
+ struct type *arg_type;
+ struct type *target_type;
+ enum type_code typecode;
+ char *val;
+
+ arg_type = check_typedef (VALUE_TYPE (args[argnum]));
+ len = TYPE_LENGTH (arg_type);
+ target_type = TYPE_TARGET_TYPE (arg_type);
+ typecode = TYPE_CODE (arg_type);
+ val = VALUE_CONTENTS (args[argnum]);
+
+ /* If the argument is a pointer to a function, and it is a
+ Thumb function, create a LOCAL copy of the value and set
+ the THUMB bit in it. */
+ if (TYPE_CODE_PTR == typecode
+ && target_type != NULL
+ && TYPE_CODE_FUNC == TYPE_CODE (target_type))
+ {
+ CORE_ADDR regval = extract_address (val, len);
+ if (arm_pc_is_thumb (regval))
+ {
+ val = alloca (len);
+ store_address (val, len, MAKE_THUMB_ADDR (regval));
+ }
+ }
+
+ /* Copy the argument to general registers or the stack in
+ register-sized pieces. Large arguments are split between
+ registers and stack. */
+ while (len > 0)
+ {
+ int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
+
+ if (argreg <= ARM_LAST_ARG_REGNUM)
+ {
+ /* The argument is being passed in a general purpose
+ register. */
+ CORE_ADDR regval = extract_address (val, partial_len);
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
+ argnum, REGISTER_NAME (argreg),
+ phex (regval, REGISTER_SIZE));
+ regcache_cooked_write_unsigned (regcache, argreg, regval);
+ argreg++;
+ }
+ else
+ {
+ /* Push the arguments onto the stack. */
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n",
+ argnum, nstack);
+ si = push_stack_item (si, val, REGISTER_SIZE);
+ nstack += REGISTER_SIZE;
+ }
+
+ len -= partial_len;
+ val += partial_len;
+ }
+ }
+ /* If we have an odd number of words to push, then decrement the stack
+ by one word now, so first stack argument will be dword aligned. */
+ if (nstack & 4)
+ sp -= 4;
+
+ while (si)
+ {
+ sp -= si->len;
+ write_memory (sp, si->data, si->len);
+ si = pop_stack_item (si);
+ }
+
+ /* Finally, update teh SP register. */
+ regcache_cooked_write_unsigned (regcache, ARM_SP_REGNUM, sp);
+
+ return sp;
+}
+
static void
print_fpu_flags (int flags)
{
@@ -2456,15 +2480,6 @@ arm_store_return_value (struct type *type, struct regcache *regs,
}
}
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function. */
-
-static void
-arm_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- write_register (ARM_A1_REGNUM, addr);
-}
-
static int
arm_get_longjmp_target (CORE_ADDR *pc)
{
@@ -2915,22 +2930,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->lowest_pc = 0x20;
tdep->jb_pc = -1; /* Longjump support not enabled by default. */
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-
- set_gdbarch_call_dummy_p (gdbarch, 1);
-
set_gdbarch_call_dummy_words (gdbarch, arm_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
-
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_push_return_address (gdbarch, arm_push_return_address);
- set_gdbarch_push_arguments (gdbarch, arm_push_arguments);
+ set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
/* Frame handling. */
set_gdbarch_deprecated_frame_chain_valid (gdbarch, arm_frame_chain_valid);
@@ -2994,7 +2997,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Returning results. */
set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value);
set_gdbarch_store_return_value (gdbarch, arm_store_return_value);
- set_gdbarch_deprecated_store_struct_return (gdbarch, arm_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention);
set_gdbarch_extract_struct_value_address (gdbarch,
arm_extract_struct_value_address);
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 7358837..9ebc0ce 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1147,7 +1147,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, avr_write_pc);
set_gdbarch_read_fp (gdbarch, avr_read_fp);
set_gdbarch_read_sp (gdbarch, avr_read_sp);
- set_gdbarch_write_sp (gdbarch, avr_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp);
set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS);
@@ -1168,20 +1168,14 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, print_insn_avr);
set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
/* set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
- set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
- set_gdbarch_push_return_address (gdbarch, avr_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, avr_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame);
set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 443175d..b349457 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1684,9 +1684,6 @@ deprecated_frame_in_dummy (struct frame_info *frame)
{
struct breakpoint *b;
- if (!CALL_DUMMY_P)
- return 0;
-
/* This function is used by two files: get_frame_type(), after first
checking that !DEPRECATED_USE_GENERIC_DUMMY_FRAMES; and
sparc-tdep.c, which doesn't yet use generic dummy frames anyway. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 4890a2b..e492b9a 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -31,6 +31,7 @@
#include "gdb_assert.h"
#include "charset.h"
#include "gdb_string.h"
+#include "demangle.h"
extern void _initialize_c_language (void);
static void c_emit_char (int c, struct ui_file * stream, int quoter);
@@ -553,6 +554,7 @@ const struct language_defn c_language_defn =
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -606,6 +608,7 @@ const struct language_defn cplus_language_defn =
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ cplus_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -636,6 +639,7 @@ const struct language_defn asm_language_defn =
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h
index a15f45f..ea22290 100644
--- a/gdb/config/i386/tm-symmetry.h
+++ b/gdb/config/i386/tm-symmetry.h
@@ -266,7 +266,7 @@ switch (regno) { \
passes it on the stack. gcc should be fixed in future versions to
adopt native cc conventions. */
-#undef PUSH_ARGUMENTS
+#undef DEPRECATED_PUSH_ARGUMENTS
#undef STORE_STRUCT_RETURN
#define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR))
diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh
index d4a152d..e4d0215 100644
--- a/gdb/config/pa/hppabsd.mh
+++ b/gdb/config/pa/hppabsd.mh
@@ -1,4 +1,4 @@
-# Host: Hewlett-Packard PA-RISC machine, running BSD
-XM_FILE= xm-hppab.h
-NAT_FILE= nm-hppab.h
-NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
+# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD
+# OBSOLETE XM_FILE= xm-hppab.h
+# OBSOLETE NAT_FILE= nm-hppab.h
+# OBSOLETE NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
diff --git a/gdb/config/pa/hppabsd.mt b/gdb/config/pa/hppabsd.mt
index 0fc0380..e63f9b8 100644
--- a/gdb/config/pa/hppabsd.mt
+++ b/gdb/config/pa/hppabsd.mt
@@ -1,3 +1,3 @@
-# Target: HP PA-RISC running bsd
-TDEPFILES= hppa-tdep.o
-TM_FILE= tm-hppab.h
+# OBSOLETE # Target: HP PA-RISC running bsd
+# OBSOLETE TDEPFILES= hppa-tdep.o
+# OBSOLETE TM_FILE= tm-hppab.h
diff --git a/gdb/config/pa/hppaosf.mh b/gdb/config/pa/hppaosf.mh
index d6dd282..0e82dc1 100644
--- a/gdb/config/pa/hppaosf.mh
+++ b/gdb/config/pa/hppaosf.mh
@@ -1,5 +1,5 @@
-# Host: Hewlett-Packard PA-RISC machine, running BSD
-XM_FILE= xm-hppab.h
-NAT_FILE= nm-hppao.h
-NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o
-NAT_CLIBS= -lmachid -lnetname -lmach
+# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD
+# OBSOLETE XM_FILE= xm-hppab.h
+# OBSOLETE NAT_FILE= nm-hppao.h
+# OBSOLETE NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o
+# OBSOLETE NAT_CLIBS= -lmachid -lnetname -lmach
diff --git a/gdb/config/pa/hppaosf.mt b/gdb/config/pa/hppaosf.mt
index 6754023..4a54c79 100644
--- a/gdb/config/pa/hppaosf.mt
+++ b/gdb/config/pa/hppaosf.mt
@@ -1,3 +1,3 @@
-# Target: HP PA-RISC running OSF1
-TDEPFILES= hppa-tdep.o
-TM_FILE= tm-hppao.h
+# OBSOLETE # Target: HP PA-RISC running OSF1
+# OBSOLETE TDEPFILES= hppa-tdep.o
+# OBSOLETE TM_FILE= tm-hppao.h
diff --git a/gdb/config/pa/hppapro.mt b/gdb/config/pa/hppapro.mt
index 4851b18..cfd9969 100644
--- a/gdb/config/pa/hppapro.mt
+++ b/gdb/config/pa/hppapro.mt
@@ -1,3 +1,3 @@
-# Target: PA based debug monitor
-TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o
-TM_FILE= tm-pro.h
+# OBSOLETE # Target: PA based debug monitor
+# OBSOLETE TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o
+# OBSOLETE TM_FILE= tm-pro.h
diff --git a/gdb/config/pa/nm-hppab.h b/gdb/config/pa/nm-hppab.h
index d9827dc..96dea6e 100644
--- a/gdb/config/pa/nm-hppab.h
+++ b/gdb/config/pa/nm-hppab.h
@@ -1,123 +1,123 @@
-/* HPPA PA-RISC machine native support for BSD, for GDB.
- Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "somsolib.h"
-#include "regcache.h"
-
-#define U_REGS_OFFSET 0
-
-#define KERNEL_U_ADDR 0
-
-/* What a coincidence! */
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
-
-/* 3rd argument to ptrace is supposed to be a caddr_t. */
-
-#define PTRACE_ARG3_TYPE caddr_t
-
-/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
- with five arguments, so programs written for normal ptrace lose. */
-#define FIVE_ARG_PTRACE
-
-
-/* fetch_inferior_registers is in hppab-nat.c. */
-#define FETCH_INFERIOR_REGISTERS
-
-/* attach/detach works to some extent under BSD and HPUX. So long
- as the process you're attaching to isn't blocked waiting on io,
- blocked waiting on a signal, or in a system call things work
- fine. (The problems in those cases are related to the fact that
- the kernel can't provide complete register information for the
- target process... Which really pisses off GDB.) */
-
-#define ATTACH_DETACH
-
-/* The PA-BSD kernel has support for using the data memory break bit
- to implement fast watchpoints.
-
- Watchpoints on the PA act much like traditional page protection
- schemes, but with some notable differences.
-
- First, a special bit in the page table entry is used to cause
- a trap when a specific page is written to. This avoids having
- to overload watchpoints on the page protection bits. This makes
- it possible for the kernel to easily decide if a trap was caused
- by a watchpoint or by the user writing to protected memory and can
- signal the user program differently in each case.
-
- Second, the PA has a bit in the processor status word which causes
- data memory breakpoints (aka watchpoints) to be disabled for a single
- instruction. This bit can be used to avoid the overhead of unprotecting
- and reprotecting pages when it becomes necessary to step over a watchpoint.
-
-
- When the kernel receives a trap indicating a write to a page which
- is being watched, the kernel performs a couple of simple actions. First
- is sets the magic "disable memory breakpoint" bit in the processor
- status word, it then sends a SIGTRAP to the process which caused the
- trap.
-
- GDB will take control and catch the signal for the inferior. GDB then
- examines the PSW-X bit to determine if the SIGTRAP was caused by a
- watchpoint firing. If so GDB single steps the inferior over the
- instruction which caused the watchpoint to trigger (note because the
- kernel disabled the data memory break bit for one instruction no trap
- will be taken!). GDB will then determines the appropriate action to
- take. (this may include restarting the inferior if the watchpoint
- fired because of a write to an address on the same page as a watchpoint,
- but no write to the watched address occured). */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */
-
-/* The PA can watch any number of locations, there's no need for it to reject
- anything (generic routines already check that all intermediates are
- in memory). */
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
- ((type) == bp_hardware_watchpoint)
-
-/* When a hardware watchpoint fires off the PC will be left at the
- instruction which caused the watchpoint. It will be necessary for
- GDB to step over the watchpoint.
-
- On a PA running BSD, it is trivial to identify when it will be
- necessary to step over a hardware watchpoint as we can examine
- the PSW-X bit. If the bit is on, then we trapped because of a
- watchpoint, else we trapped for some other reason. */
-#define STOPPED_BY_WATCHPOINT(W) \
- ((W).kind == TARGET_WAITKIND_STOPPED \
- && (W).value.sig == TARGET_SIGNAL_TRAP \
- && ((int) read_register (IPSW_REGNUM) & 0x00100000))
-
-/* The PA can single step over a watchpoint if the kernel has set the
- "X" bit in the processor status word (disable data memory breakpoint
- for one instruction).
-
- The kernel will always set this bit before notifying the inferior
- that it hit a watchpoint. Thus, the inferior can single step over
- the instruction which caused the watchpoint to fire. This avoids
- the traditional need to disable the watchpoint, step the inferior,
- then enable the watchpoint again. */
-#define HAVE_STEPPABLE_WATCHPOINT
-
-/* Use these macros for watchpoint insertion/deletion. */
-/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
-#define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1)
-#define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0)
+// OBSOLETE /* HPPA PA-RISC machine native support for BSD, for GDB.
+// OBSOLETE Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "somsolib.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #define U_REGS_OFFSET 0
+// OBSOLETE
+// OBSOLETE #define KERNEL_U_ADDR 0
+// OBSOLETE
+// OBSOLETE /* What a coincidence! */
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);}
+// OBSOLETE
+// OBSOLETE /* 3rd argument to ptrace is supposed to be a caddr_t. */
+// OBSOLETE
+// OBSOLETE #define PTRACE_ARG3_TYPE caddr_t
+// OBSOLETE
+// OBSOLETE /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
+// OBSOLETE with five arguments, so programs written for normal ptrace lose. */
+// OBSOLETE #define FIVE_ARG_PTRACE
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long
+// OBSOLETE as the process you're attaching to isn't blocked waiting on io,
+// OBSOLETE blocked waiting on a signal, or in a system call things work
+// OBSOLETE fine. (The problems in those cases are related to the fact that
+// OBSOLETE the kernel can't provide complete register information for the
+// OBSOLETE target process... Which really pisses off GDB.) */
+// OBSOLETE
+// OBSOLETE #define ATTACH_DETACH
+// OBSOLETE
+// OBSOLETE /* The PA-BSD kernel has support for using the data memory break bit
+// OBSOLETE to implement fast watchpoints.
+// OBSOLETE
+// OBSOLETE Watchpoints on the PA act much like traditional page protection
+// OBSOLETE schemes, but with some notable differences.
+// OBSOLETE
+// OBSOLETE First, a special bit in the page table entry is used to cause
+// OBSOLETE a trap when a specific page is written to. This avoids having
+// OBSOLETE to overload watchpoints on the page protection bits. This makes
+// OBSOLETE it possible for the kernel to easily decide if a trap was caused
+// OBSOLETE by a watchpoint or by the user writing to protected memory and can
+// OBSOLETE signal the user program differently in each case.
+// OBSOLETE
+// OBSOLETE Second, the PA has a bit in the processor status word which causes
+// OBSOLETE data memory breakpoints (aka watchpoints) to be disabled for a single
+// OBSOLETE instruction. This bit can be used to avoid the overhead of unprotecting
+// OBSOLETE and reprotecting pages when it becomes necessary to step over a watchpoint.
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE When the kernel receives a trap indicating a write to a page which
+// OBSOLETE is being watched, the kernel performs a couple of simple actions. First
+// OBSOLETE is sets the magic "disable memory breakpoint" bit in the processor
+// OBSOLETE status word, it then sends a SIGTRAP to the process which caused the
+// OBSOLETE trap.
+// OBSOLETE
+// OBSOLETE GDB will take control and catch the signal for the inferior. GDB then
+// OBSOLETE examines the PSW-X bit to determine if the SIGTRAP was caused by a
+// OBSOLETE watchpoint firing. If so GDB single steps the inferior over the
+// OBSOLETE instruction which caused the watchpoint to trigger (note because the
+// OBSOLETE kernel disabled the data memory break bit for one instruction no trap
+// OBSOLETE will be taken!). GDB will then determines the appropriate action to
+// OBSOLETE take. (this may include restarting the inferior if the watchpoint
+// OBSOLETE fired because of a write to an address on the same page as a watchpoint,
+// OBSOLETE but no write to the watched address occured). */
+// OBSOLETE
+// OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */
+// OBSOLETE
+// OBSOLETE /* The PA can watch any number of locations, there's no need for it to reject
+// OBSOLETE anything (generic routines already check that all intermediates are
+// OBSOLETE in memory). */
+// OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+// OBSOLETE ((type) == bp_hardware_watchpoint)
+// OBSOLETE
+// OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the
+// OBSOLETE instruction which caused the watchpoint. It will be necessary for
+// OBSOLETE GDB to step over the watchpoint.
+// OBSOLETE
+// OBSOLETE On a PA running BSD, it is trivial to identify when it will be
+// OBSOLETE necessary to step over a hardware watchpoint as we can examine
+// OBSOLETE the PSW-X bit. If the bit is on, then we trapped because of a
+// OBSOLETE watchpoint, else we trapped for some other reason. */
+// OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \
+// OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \
+// OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \
+// OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000))
+// OBSOLETE
+// OBSOLETE /* The PA can single step over a watchpoint if the kernel has set the
+// OBSOLETE "X" bit in the processor status word (disable data memory breakpoint
+// OBSOLETE for one instruction).
+// OBSOLETE
+// OBSOLETE The kernel will always set this bit before notifying the inferior
+// OBSOLETE that it hit a watchpoint. Thus, the inferior can single step over
+// OBSOLETE the instruction which caused the watchpoint to fire. This avoids
+// OBSOLETE the traditional need to disable the watchpoint, step the inferior,
+// OBSOLETE then enable the watchpoint again. */
+// OBSOLETE #define HAVE_STEPPABLE_WATCHPOINT
+// OBSOLETE
+// OBSOLETE /* Use these macros for watchpoint insertion/deletion. */
+// OBSOLETE /* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
+// OBSOLETE #define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1)
+// OBSOLETE #define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0)
diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h
index 8387115..2cc1e30 100644
--- a/gdb/config/pa/nm-hppah.h
+++ b/gdb/config/pa/nm-hppah.h
@@ -117,6 +117,7 @@ extern int hppa_require_detach (int, int);
/* The PA can watch any number of locations (generic routines already check
that all intermediates are in watchable memory locations). */
+extern int hppa_can_use_hw_watchpoint (int type, int cnt, int ot);
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
hppa_can_use_hw_watchpoint(type, cnt, ot)
@@ -198,9 +199,13 @@ extern void hppa_enable_page_protection_events (int);
extern void hppa_disable_page_protection_events (int);
/* Use these macros for watchpoint insertion/deletion. */
+extern int hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+ int type);
#define target_insert_watchpoint(addr, len, type) \
hppa_insert_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type)
+extern int hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+ int type);
#define target_remove_watchpoint(addr, len, type) \
hppa_remove_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type)
@@ -265,3 +270,5 @@ extern int hppa_resume_execd_vforking_child_to_get_parent_vfork (void);
#define MAY_FOLLOW_EXEC (1)
#define USE_THREAD_STEP_NEEDED (1)
+
+#include "infttrace.h" /* For parent_attach_all. */
diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h
index 6389b2c..0a6b810 100644
--- a/gdb/config/pa/nm-hppao.h
+++ b/gdb/config/pa/nm-hppao.h
@@ -1,43 +1,43 @@
-/* HPPA PA-RISC machine native support for Lites, for GDB.
- Copyright 1995, 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "config/nm-m3.h"
-#define U_REGS_OFFSET 0
-
-#define KERNEL_U_ADDR 0
-
-/* What a coincidence! */
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
-
-/* fetch_inferior_registers is in hppab-nat.c. */
-#define FETCH_INFERIOR_REGISTERS
-
-/* attach/detach works to some extent under BSD and HPUX. So long
- as the process you're attaching to isn't blocked waiting on io,
- blocked waiting on a signal, or in a system call things work
- fine. (The problems in those cases are related to the fact that
- the kernel can't provide complete register information for the
- target process... Which really pisses off GDB.) */
-
-#define ATTACH_DETACH
-
-#define EMULATOR_BASE 0x90100000
-#define EMULATOR_END 0x90200000
+// OBSOLETE /* HPPA PA-RISC machine native support for Lites, for GDB.
+// OBSOLETE Copyright 1995, 2002 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "config/nm-m3.h"
+// OBSOLETE #define U_REGS_OFFSET 0
+// OBSOLETE
+// OBSOLETE #define KERNEL_U_ADDR 0
+// OBSOLETE
+// OBSOLETE /* What a coincidence! */
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);}
+// OBSOLETE
+// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long
+// OBSOLETE as the process you're attaching to isn't blocked waiting on io,
+// OBSOLETE blocked waiting on a signal, or in a system call things work
+// OBSOLETE fine. (The problems in those cases are related to the fact that
+// OBSOLETE the kernel can't provide complete register information for the
+// OBSOLETE target process... Which really pisses off GDB.) */
+// OBSOLETE
+// OBSOLETE #define ATTACH_DETACH
+// OBSOLETE
+// OBSOLETE #define EMULATOR_BASE 0x90100000
+// OBSOLETE #define EMULATOR_END 0x90200000
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index 64a4fe1..9c26c79 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -24,6 +24,9 @@
#include "regcache.h"
+/* Wonder if this is correct? Should be using push_dummy_call(). */
+#define DEPRECATED_DUMMY_WRITE_SP(SP) generic_target_write_sp (SP)
+
#define GDB_MULTI_ARCH 0
/* NOTE: cagney/2002-11-24: This is a guess. */
@@ -614,7 +617,7 @@ extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
struct value **, struct type *, int);
#if !GDB_MULTI_ARCH
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
(hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int,
CORE_ADDR);
diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h
index e6177b0..b2b98e4 100644
--- a/gdb/config/pa/tm-hppa64.h
+++ b/gdb/config/pa/tm-hppa64.h
@@ -122,20 +122,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SR5_REGNUM 48
-#undef FRAME_ARGS_ADDRESS
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->ap)
-
/* We access locals from SP. This may not work for frames which call
alloca; for those, we may need to consult unwind tables.
jimb: FIXME. */
#undef FRAME_LOCALS_ADDRESS
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-#define INIT_FRAME_AP init_frame_ap
-
-#define EXTRA_FRAME_INFO \
- CORE_ADDR ap;
-
/* For a number of horrible reasons we may have to adjust the location
of variables on the stack. Ugh. jimb: why? */
#define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR)
@@ -191,7 +183,6 @@ call_dummy
0xe820f0000fb110d3LL, 0x0001000400151820LL,\
0xe6c0000008000240LL}
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
#define CALL_DUMMY_BREAKPOINT_OFFSET 22 * 4
/* CALL_DUMMY_LENGTH is computed based on the size of a word on the target
diff --git a/gdb/config/pa/tm-hppab.h b/gdb/config/pa/tm-hppab.h
index 1cd438d..edacdbf 100644
--- a/gdb/config/pa/tm-hppab.h
+++ b/gdb/config/pa/tm-hppab.h
@@ -1,47 +1,47 @@
-/* Parameters for execution on an HP PA-RISC machine running BSD, for GDB.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-/* For BSD:
-
- The signal context structure pointer is always saved at the base
- of the frame + 0x4.
-
- We get the PC & SP directly from the sigcontext structure itself.
- For other registers we have to dive in a little deeper:
-
- The hardware save state pointer is at offset 0x10 within the
- signal context structure.
-
- Within the hardware save state, registers are found in the same order
- as the register numbers in GDB. */
-
-#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
-}
-
-#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
-}
-
-#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
-{ \
- int i; \
- CORE_ADDR TMP; \
- TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- TMP = read_memory_integer (TMP + 0x10, 4); \
- for (i = 0; i < NUM_REGS; i++) \
- { \
- if (i == SP_REGNUM) \
- (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
- else \
- (FSR)->regs[i] = TMP + i * 4; \
- } \
-}
-
-/* It's mostly just the common stuff. */
-#include "pa/tm-hppa.h"
+// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running BSD, for GDB.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE /* For BSD:
+// OBSOLETE
+// OBSOLETE The signal context structure pointer is always saved at the base
+// OBSOLETE of the frame + 0x4.
+// OBSOLETE
+// OBSOLETE We get the PC & SP directly from the sigcontext structure itself.
+// OBSOLETE For other registers we have to dive in a little deeper:
+// OBSOLETE
+// OBSOLETE The hardware save state pointer is at offset 0x10 within the
+// OBSOLETE signal context structure.
+// OBSOLETE
+// OBSOLETE Within the hardware save state, registers are found in the same order
+// OBSOLETE as the register numbers in GDB. */
+// OBSOLETE
+// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
+// OBSOLETE { \
+// OBSOLETE int i; \
+// OBSOLETE CORE_ADDR TMP; \
+// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \
+// OBSOLETE for (i = 0; i < NUM_REGS; i++) \
+// OBSOLETE { \
+// OBSOLETE if (i == SP_REGNUM) \
+// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
+// OBSOLETE else \
+// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \
+// OBSOLETE } \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE #include "pa/tm-hppa.h"
diff --git a/gdb/config/pa/tm-hppao.h b/gdb/config/pa/tm-hppao.h
index e6fae89..a466287 100644
--- a/gdb/config/pa/tm-hppao.h
+++ b/gdb/config/pa/tm-hppao.h
@@ -1,98 +1,98 @@
-/* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-#include "regcache.h"
-
-/* Define offsets to access CPROC stack when it does not have
- * a kernel thread.
- */
-#define MACHINE_CPROC_SP_OFFSET 20
-#define MACHINE_CPROC_PC_OFFSET 16
-#define MACHINE_CPROC_FP_OFFSET 12
-
-/*
- * Software defined PSW masks.
- */
-#define PSW_SS 0x10000000 /* Kernel managed single step */
-
-/* Thread flavors used in re-setting the T bit.
- * @@ this is also bad for cross debugging.
- */
-#define TRACE_FLAVOR HP800_THREAD_STATE
-#define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT
-#define TRACE_SET(x,state) \
- ((struct hp800_thread_state *)state)->cr22 |= PSW_SS
-#define TRACE_CLEAR(x,state) \
- ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1)
-
-/* For OSF1 (Should be close if not identical to BSD, but I haven't
- tested it yet):
-
- The signal context structure pointer is always saved at the base
- of the frame + 0x4.
-
- We get the PC & SP directly from the sigcontext structure itself.
- For other registers we have to dive in a little deeper:
-
- The hardware save state pointer is at offset 0x10 within the
- signal context structure.
-
- Within the hardware save state, registers are found in the same order
- as the register numbers in GDB. */
-
-#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
-}
-
-#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
-}
-
-#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
-{ \
- int i; \
- CORE_ADDR TMP; \
- TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- TMP = read_memory_integer (TMP + 0x10, 4); \
- for (i = 0; i < NUM_REGS; i++) \
- { \
- if (i == SP_REGNUM) \
- (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
- else \
- (FSR)->regs[i] = TMP + i * 4; \
- } \
-}
-
-/* OSF1 does not need the pc space queue restored. */
-#define NO_PC_SPACE_QUEUE_RESTORE
-
-/* The mach kernel uses the recovery counter to implement single
- stepping. While this greatly simplifies the kernel support
- necessary for single stepping, it unfortunately does the wrong
- thing in the presense of a nullified instruction (gives control
- back two insns after the nullifed insn). This is an artifact
- of the HP architecture (recovery counter doesn't tick for
- nullified insns).
-
- Do our best to avoid losing in such situations. */
-#define INSTRUCTION_NULLIFIED \
-(({ \
- int ipsw = (int)read_register(IPSW_REGNUM); \
- if (ipsw & PSW_N) \
- { \
- int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \
- write_register(PCOQ_HEAD_REGNUM, pcoqt); \
- write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \
- write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \
- stop_pc = pcoqt; \
- } \
- }), 0)
-
-/* It's mostly just the common stuff. */
-
-#include "pa/tm-hppa.h"
+// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE /* Define offsets to access CPROC stack when it does not have
+// OBSOLETE * a kernel thread.
+// OBSOLETE */
+// OBSOLETE #define MACHINE_CPROC_SP_OFFSET 20
+// OBSOLETE #define MACHINE_CPROC_PC_OFFSET 16
+// OBSOLETE #define MACHINE_CPROC_FP_OFFSET 12
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Software defined PSW masks.
+// OBSOLETE */
+// OBSOLETE #define PSW_SS 0x10000000 /* Kernel managed single step */
+// OBSOLETE
+// OBSOLETE /* Thread flavors used in re-setting the T bit.
+// OBSOLETE * @@ this is also bad for cross debugging.
+// OBSOLETE */
+// OBSOLETE #define TRACE_FLAVOR HP800_THREAD_STATE
+// OBSOLETE #define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT
+// OBSOLETE #define TRACE_SET(x,state) \
+// OBSOLETE ((struct hp800_thread_state *)state)->cr22 |= PSW_SS
+// OBSOLETE #define TRACE_CLEAR(x,state) \
+// OBSOLETE ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1)
+// OBSOLETE
+// OBSOLETE /* For OSF1 (Should be close if not identical to BSD, but I haven't
+// OBSOLETE tested it yet):
+// OBSOLETE
+// OBSOLETE The signal context structure pointer is always saved at the base
+// OBSOLETE of the frame + 0x4.
+// OBSOLETE
+// OBSOLETE We get the PC & SP directly from the sigcontext structure itself.
+// OBSOLETE For other registers we have to dive in a little deeper:
+// OBSOLETE
+// OBSOLETE The hardware save state pointer is at offset 0x10 within the
+// OBSOLETE signal context structure.
+// OBSOLETE
+// OBSOLETE Within the hardware save state, registers are found in the same order
+// OBSOLETE as the register numbers in GDB. */
+// OBSOLETE
+// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
+// OBSOLETE { \
+// OBSOLETE int i; \
+// OBSOLETE CORE_ADDR TMP; \
+// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \
+// OBSOLETE for (i = 0; i < NUM_REGS; i++) \
+// OBSOLETE { \
+// OBSOLETE if (i == SP_REGNUM) \
+// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
+// OBSOLETE else \
+// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \
+// OBSOLETE } \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* OSF1 does not need the pc space queue restored. */
+// OBSOLETE #define NO_PC_SPACE_QUEUE_RESTORE
+// OBSOLETE
+// OBSOLETE /* The mach kernel uses the recovery counter to implement single
+// OBSOLETE stepping. While this greatly simplifies the kernel support
+// OBSOLETE necessary for single stepping, it unfortunately does the wrong
+// OBSOLETE thing in the presense of a nullified instruction (gives control
+// OBSOLETE back two insns after the nullifed insn). This is an artifact
+// OBSOLETE of the HP architecture (recovery counter doesn't tick for
+// OBSOLETE nullified insns).
+// OBSOLETE
+// OBSOLETE Do our best to avoid losing in such situations. */
+// OBSOLETE #define INSTRUCTION_NULLIFIED \
+// OBSOLETE (({ \
+// OBSOLETE int ipsw = (int)read_register(IPSW_REGNUM); \
+// OBSOLETE if (ipsw & PSW_N) \
+// OBSOLETE { \
+// OBSOLETE int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \
+// OBSOLETE write_register(PCOQ_HEAD_REGNUM, pcoqt); \
+// OBSOLETE write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \
+// OBSOLETE write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \
+// OBSOLETE stop_pc = pcoqt; \
+// OBSOLETE } \
+// OBSOLETE }), 0)
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE
+// OBSOLETE #include "pa/tm-hppa.h"
diff --git a/gdb/config/pa/tm-pro.h b/gdb/config/pa/tm-pro.h
index 05ecb62..c4f2b77 100644
--- a/gdb/config/pa/tm-pro.h
+++ b/gdb/config/pa/tm-pro.h
@@ -1,14 +1,14 @@
-/* Parameters for execution on an HP PA-RISC level 0 embedded system.
- This is based on tm-hppab.h.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-#define PA_LEVEL_0 /* Disables touching space regs and fp */
-
-/* All the PRO targets use software floating point at the moment. */
-#define SOFT_FLOAT 1
-
-/* It's mostly just the common stuff. */
-#include "pa/tm-hppa.h"
-
-#define GDB_TARGET_IS_PA_ELF
+// OBSOLETE /* Parameters for execution on an HP PA-RISC level 0 embedded system.
+// OBSOLETE This is based on tm-hppab.h.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE #define PA_LEVEL_0 /* Disables touching space regs and fp */
+// OBSOLETE
+// OBSOLETE /* All the PRO targets use software floating point at the moment. */
+// OBSOLETE #define SOFT_FLOAT 1
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE #include "pa/tm-hppa.h"
+// OBSOLETE
+// OBSOLETE #define GDB_TARGET_IS_PA_ELF
diff --git a/gdb/config/pa/xm-hppab.h b/gdb/config/pa/xm-hppab.h
index d2561df..d46e5ad 100644
--- a/gdb/config/pa/xm-hppab.h
+++ b/gdb/config/pa/xm-hppab.h
@@ -1,24 +1,24 @@
-/* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB.
- Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
-
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu).
-
- 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 "pa/xm-pa.h"
+// OBSOLETE /* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB.
+// OBSOLETE Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu).
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "pa/xm-pa.h"
diff --git a/gdb/config/pa/xm-hppah.h b/gdb/config/pa/xm-hppah.h
index b1c26dd..a2ed9ba 100644
--- a/gdb/config/pa/xm-hppah.h
+++ b/gdb/config/pa/xm-hppah.h
@@ -22,8 +22,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "pa/xm-pa.h"
-
#define USG
#define HAVE_TERMIOS
diff --git a/gdb/config/pa/xm-pa.h b/gdb/config/pa/xm-pa.h
index 979609d..0095003 100644
--- a/gdb/config/pa/xm-pa.h
+++ b/gdb/config/pa/xm-pa.h
@@ -1,5 +1,5 @@
-/* Definitions for all PA machines. */
-
-/* This was created for "makeva", which is obsolete. This file can
- probably go away (unless someone can think of some other host thing
- which is common to various pa machines). */
+// OBSOLETE /* Definitions for all PA machines. */
+// OBSOLETE
+// OBSOLETE /* This was created for "makeva", which is obsolete. This file can
+// OBSOLETE probably go away (unless someone can think of some other host thing
+// OBSOLETE which is common to various pa machines). */
diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h
index 8abec1c..a415b83 100644
--- a/gdb/config/sparc/tm-sp64.h
+++ b/gdb/config/sparc/tm-sp64.h
@@ -96,8 +96,6 @@
#define CALL_DUMMY_START_OFFSET 0
#undef CALL_DUMMY_BREAKPOINT_OFFSET
#define CALL_DUMMY_BREAKPOINT_OFFSET 0
-#undef CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
#undef CALL_DUMMY_LOCATION
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
#undef DEPRECATED_PC_IN_CALL_DUMMY
@@ -110,8 +108,8 @@
#define CALL_DUMMY_ADDRESS() entry_point_address()
#undef FIX_CALL_DUMMY
#define FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P)
-#undef PUSH_RETURN_ADDRESS
-#define PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP)
+#undef DEPRECATED_PUSH_RETURN_ADDRESS
+#define DEPRECATED_PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP)
extern CORE_ADDR sparc_at_entry_push_return_address (CORE_ADDR pc,
CORE_ADDR sp);
@@ -162,10 +160,6 @@ extern void sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
#undef CALL_DUMMY_BREAKPOINT_OFFSET
#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + (8 * 4))
-/* Let's GDB know that it can make a call_dummy breakpoint. */
-#undef CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
-
/* Call dummy will be located on the stack. */
#undef CALL_DUMMY_LOCATION
#define CALL_DUMMY_LOCATION ON_STACK
@@ -182,7 +176,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
/* The remainder of these will accept the default definition. */
#undef SIZEOF_CALL_DUMMY_WORDS
-#undef PUSH_RETURN_ADDRESS
+#undef DEPRECATED_PUSH_RETURN_ADDRESS
#undef CALL_DUMMY_ADDRESS
#undef STORE_STRUCT_RETURN
@@ -208,8 +202,8 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
CORE_ADDR sparc64_push_arguments (int,
struct value **, CORE_ADDR, int, CORE_ADDR);
-#undef PUSH_ARGUMENTS
-#define PUSH_ARGUMENTS(A,B,C,D,E) \
+#undef DEPRECATED_PUSH_ARGUMENTS
+#define DEPRECATED_PUSH_ARGUMENTS(A,B,C,D,E) \
(sparc64_push_arguments ((A), (B), (C), (D), (E)))
/* Store the address of the place in which to copy the structure the
@@ -274,7 +268,7 @@ extern void sparc64_write_sp (CORE_ADDR);
#define TARGET_READ_SP() (sparc64_read_sp ())
#define TARGET_READ_FP() (sparc64_read_fp ())
-#define TARGET_WRITE_SP(X) (sparc64_write_sp (X))
+#define DEPRECATED_DUMMY_WRITE_SP(X) (sparc64_write_sp (X))
#undef DEPRECATED_EXTRACT_RETURN_VALUE
#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index 7b11c4f..ef39962 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -688,7 +688,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
void sparc_push_dummy_frame (void);
void sparc_pop_frame (void);
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+#define DEPRECATED_PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
sparc32_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
extern CORE_ADDR sparc32_push_arguments (int, struct value **, CORE_ADDR, int,
diff --git a/gdb/configure.host b/gdb/configure.host
index b309a33..98acc7e 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -40,13 +40,13 @@ arm*-*-linux*) gdb_host=linux ;;
arm*-*-netbsdelf*) gdb_host=nbsdelf ;;
arm*-*-netbsd*) gdb_host=nbsdaout ;;
-hppa*-*-bsd*) gdb_host=hppabsd ;;
+# OBSOLETE hppa*-*-bsd*) gdb_host=hppabsd ;;
hppa*-*-hiux*) gdb_host=hppahpux ;;
hppa*-*-hpux10.20) gdb_host=hpux1020 ;;
hppa*64*-*-hpux11*) gdb_host=hpux11w ;;
hppa*-*-hpux11*) gdb_host=hpux11 ;;
hppa*-*-hpux*) gdb_host=hppahpux ;;
-hppa*-*-osf*) gdb_host=hppaosf ;;
+# OBSOLETE hppa*-*-osf*) gdb_host=hppaosf ;;
i[3456]86-ncr-*) gdb_host=ncr3000 ;;
i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 17ac70f..9a4dba3 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -73,12 +73,12 @@ h8300-*-*) gdb_target=h8300 ;;
frv-*-*) gdb_target=frv ;;
-hppa*-*-bsd*) gdb_target=hppabsd ;;
-hppa*-*-pro*) gdb_target=hppapro ;;
+# OBSOLETE hppa*-*-bsd*) gdb_target=hppabsd ;;
+# OBSOLETE hppa*-*-pro*) gdb_target=hppapro ;;
hppa*64*-*-hpux11*) gdb_target=hppa64 ;;
hppa*-*-hpux*) gdb_target=hppahpux ;;
hppa*-*-hiux*) gdb_target=hppahpux ;;
-hppa*-*-osf*) gdb_target=hppaosf ;;
+# OBSOLETE hppa*-*-osf*) gdb_target=hppaosf ;;
hppa*-*-*) gdb_target=hppa ;;
i[3456]86-sequent-bsd*) gdb_target=symmetry ;;
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 8bf0646..4f9ee9b 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -4154,7 +4154,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (tdep->cris_abi == CRIS_ABI_ORIGINAL)
{
set_gdbarch_double_bit (gdbarch, 32);
- set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_original_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch,
cris_abi_original_store_return_value);
set_gdbarch_deprecated_extract_return_value
@@ -4165,7 +4165,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else if (tdep->cris_abi == CRIS_ABI_V2)
{
set_gdbarch_double_bit (gdbarch, 64);
- set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_v2_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_v2_store_return_value);
set_gdbarch_deprecated_extract_return_value
(gdbarch, cris_abi_v2_extract_return_value);
@@ -4255,35 +4255,20 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Use generic dummy frames. */
- /* Where to execute the call in the memory segments. */
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-
- /* Start execution at the beginning of dummy. */
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-
- /* Set to 1 since call_dummy_breakpoint_offset was defined. */
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-
/* Read all about dummy frames in blockframe.c. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
/* Defined to 1 to indicate that the target supports inferior function
calls. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, 0);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- /* No stack adjustment needed when peforming an inferior function call. */
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
/* No register requires conversion from raw format to virtual format. */
set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
- set_gdbarch_push_return_address (gdbarch, cris_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, cris_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame);
set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return);
@@ -4323,6 +4308,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Helpful for backtracing and returning in a call dummy. */
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Use target_specific function to define link map offsets. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, cris_linux_svr4_fetch_link_map_offsets);
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index 31b4989..9d56169 100644
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -39,7 +39,7 @@
#include "language.h"
#include "arch-utils.h"
#include "regcache.h"
-
+#include "remote.h"
#include "floatformat.h"
#include "gdb/sim-d10v.h"
#include "sim-regno.h"
@@ -69,7 +69,7 @@ enum
{
R0_REGNUM = 0,
R3_REGNUM = 3,
- _FP_REGNUM = 11,
+ D10V_FP_REGNUM = 11,
LR_REGNUM = 13,
_SP_REGNUM = 15,
PSW_REGNUM = 16,
@@ -277,8 +277,8 @@ d10v_imap_register (int reg_nr)
static int
d10v_ts2_register_sim_regno (int nr)
{
- if (legacy_register_sim_regno (nr) < 0)
- return legacy_register_sim_regno (nr);
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (nr >= 0 && nr < NUM_REGS);
if (nr >= TS2_IMAP0_REGNUM
&& nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -293,8 +293,8 @@ d10v_ts2_register_sim_regno (int nr)
static int
d10v_ts3_register_sim_regno (int nr)
{
- if (legacy_register_sim_regno (nr) < 0)
- return legacy_register_sim_regno (nr);
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (nr >= 0 && nr < NUM_REGS);
if (nr >= TS3_IMAP0_REGNUM
&& nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -346,7 +346,7 @@ d10v_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == PC_REGNUM)
return builtin_type_void_func_ptr;
- if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM)
+ if (reg_nr == _SP_REGNUM || reg_nr == D10V_FP_REGNUM)
return builtin_type_void_data_ptr;
else if (reg_nr >= A0_REGNUM
&& reg_nr < (A0_REGNUM + NR_A_REGS))
@@ -599,7 +599,10 @@ d10v_skip_prologue (CORE_ADDR pc)
struct d10v_unwind_cache
{
CORE_ADDR return_pc;
- /* The frame's base. Used when constructing a frame ID. */
+ /* The previous frame's inner most stack address. Used as this
+ frame ID's stack_addr. */
+ CORE_ADDR prev_sp;
+ /* The frame's base, optionally used by the high-level debug info. */
CORE_ADDR base;
int size;
CORE_ADDR *saved_regs;
@@ -716,10 +719,10 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
info->return_pc = 0;
info->sp_offset = 0;
- pc = get_pc_function_start (frame_pc_unwind (next_frame));
-
info->uses_frame = 0;
- while (1)
+ for (pc = get_pc_function_start (frame_pc_unwind (next_frame));
+ pc < frame_pc_unwind (next_frame);
+ pc += 4)
{
op = (unsigned long) read_memory_integer (pc, 4);
if ((op & 0xC0000000) == 0xC0000000)
@@ -766,7 +769,6 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
|| !prologue_find_regs (info, op2, pc))
break;
}
- pc += 4;
}
info->size = -info->sp_offset;
@@ -777,7 +779,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
/* The SP was moved to the FP. This indicates that a new frame
was created. Get THIS frame's FP value by unwinding it from
the next frame. */
- frame_unwind_unsigned_register (next_frame, FP_REGNUM, &this_base);
+ frame_unwind_unsigned_register (next_frame, D10V_FP_REGNUM, &this_base);
/* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */
prev_sp = this_base + info->size;
@@ -800,14 +802,14 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
}
info->base = d10v_make_daddr (this_base);
- prev_sp = d10v_make_daddr (prev_sp);
+ info->prev_sp = d10v_make_daddr (prev_sp);
/* Adjust all the saved registers so that they contain addresses and
not offsets. */
for (i = 0; i < NUM_REGS - 1; i++)
if (info->saved_regs[i])
{
- info->saved_regs[i] = (prev_sp + info->saved_regs[i]);
+ info->saved_regs[i] = (info->prev_sp + info->saved_regs[i]);
}
if (info->saved_regs[LR_REGNUM])
@@ -826,7 +828,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
/* The SP_REGNUM is special. Instead of the address of the SP, the
previous frame's SP value is saved. */
- info->saved_regs[SP_REGNUM] = prev_sp;
+ info->saved_regs[SP_REGNUM] = info->prev_sp;
return info;
}
@@ -950,30 +952,12 @@ d10v_read_sp (void)
return (d10v_make_daddr (read_register (SP_REGNUM)));
}
-static void
-d10v_write_sp (CORE_ADDR val)
-{
- write_register (SP_REGNUM, d10v_convert_daddr_to_raw (val));
-}
-
static CORE_ADDR
d10v_read_fp (void)
{
- return (d10v_make_daddr (read_register (FP_REGNUM)));
+ return (d10v_make_daddr (read_register (D10V_FP_REGNUM)));
}
-/* Function: push_return_address (pc)
- Set up the return address for the inferior function call.
- Needed for targets where we don't actually execute a JSR/BSR instruction */
-
-static CORE_ADDR
-d10v_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
- write_register (LR_REGNUM, d10v_convert_iaddr_to_raw (CALL_DUMMY_ADDRESS ()));
- return sp;
-}
-
-
/* When arguments must be pushed onto the stack, they go on in reverse
order. The below implements a FILO (stack) to do this. */
@@ -1011,20 +995,26 @@ pop_stack_item (struct stack_item *si)
static CORE_ADDR
-d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR dummy_addr, int nargs, struct value **args,
+ CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
int i;
int regnum = ARG1_REGNUM;
struct stack_item *si = NULL;
long val;
+ /* Set the return address. For the d10v, the return breakpoint is
+ always at DUMMY_ADDR. */
+ regcache_cooked_write_unsigned (regcache, LR_REGNUM,
+ d10v_convert_iaddr_to_raw (dummy_addr));
+
/* If STRUCT_RETURN is true, then the struct return address (in
STRUCT_ADDR) will consume the first argument-passing register.
Both adjust the register count and store that value. */
if (struct_return)
{
- write_register (regnum, struct_addr);
+ regcache_cooked_write_unsigned (regcache, regnum, struct_addr);
regnum++;
}
@@ -1042,7 +1032,7 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* fits in a single register, do not align */
{
val = extract_unsigned_integer (contents, len);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
/* value fits in remaining registers, store keeping left
@@ -1053,12 +1043,12 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
for (b = 0; b < (len & ~1); b += 2)
{
val = extract_unsigned_integer (&contents[b], 2);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
if (b < len)
{
val = extract_unsigned_integer (&contents[b], 1);
- write_register (regnum++, (val << 8));
+ regcache_cooked_write_unsigned (regcache, regnum++, (val << 8));
}
}
else
@@ -1076,6 +1066,10 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
si = pop_stack_item (si);
}
+ /* Finally, update the SP register. */
+ regcache_cooked_write_unsigned (regcache, SP_REGNUM,
+ d10v_convert_daddr_to_raw (sp));
+
return sp;
}
@@ -1348,26 +1342,29 @@ tdisassemble_command (char *arg, int from_tty)
{
int i, count;
CORE_ADDR low, high;
- char *space_index;
if (!arg)
{
low = 0;
high = trace_data.size;
}
- else if (!(space_index = (char *) strchr (arg, ' ')))
- {
- low = parse_and_eval_address (arg);
- high = low + 5;
- }
else
- {
- /* Two arguments. */
- *space_index = '\0';
- low = parse_and_eval_address (arg);
- high = parse_and_eval_address (space_index + 1);
- if (high < low)
- high = low;
+ {
+ char *space_index = strchr (arg, ' ');
+ if (space_index == NULL)
+ {
+ low = parse_and_eval_address (arg);
+ high = low + 5;
+ }
+ else
+ {
+ /* Two arguments. */
+ *space_index = '\0';
+ low = parse_and_eval_address (arg);
+ high = parse_and_eval_address (space_index + 1);
+ if (high < low)
+ high = low;
+ }
}
printf_filtered ("Dump of trace from %s to %s:\n", paddr_u (low), paddr_u (high));
@@ -1456,9 +1453,6 @@ d10v_frame_this_id (struct frame_info *next_frame,
CORE_ADDR base;
CORE_ADDR pc;
- /* Start with a NULL frame ID. */
- (*this_id) = null_frame_id;
-
/* The PC is easy. */
pc = frame_pc_unwind (next_frame);
@@ -1470,7 +1464,7 @@ d10v_frame_this_id (struct frame_info *next_frame,
/* Hopefully the prologue analysis either correctly determined the
frame's base (which is the SP from the previous frame), or set
that base to "NULL". */
- base = info->base;
+ base = info->prev_sp;
if (base == STACK_START || base == 0)
return;
@@ -1484,8 +1478,7 @@ d10v_frame_this_id (struct frame_info *next_frame,
&& get_frame_id (next_frame).base == base)
return;
- this_id->base = base;
- this_id->pc = pc;
+ (*this_id) = frame_id_build (base, pc);
}
static void
@@ -1606,8 +1599,6 @@ static gdbarch_init_ftype d10v_gdbarch_init;
static struct gdbarch *
d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- static LONGEST d10v_call_dummy_words[] =
- {0};
struct gdbarch *gdbarch;
int d10v_num_regs;
struct gdbarch_tdep *tdep;
@@ -1651,11 +1642,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, d10v_write_pc);
set_gdbarch_read_fp (gdbarch, d10v_read_fp);
set_gdbarch_read_sp (gdbarch, d10v_read_sp);
- set_gdbarch_write_sp (gdbarch, d10v_write_sp);
set_gdbarch_num_regs (gdbarch, d10v_num_regs);
set_gdbarch_sp_regnum (gdbarch, 15);
- set_gdbarch_fp_regnum (gdbarch, 11);
set_gdbarch_pc_regnum (gdbarch, 18);
set_gdbarch_register_name (gdbarch, d10v_register_name);
set_gdbarch_register_size (gdbarch, 2);
@@ -1696,20 +1685,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
"d10v_gdbarch_init: bad byte order for float format");
}
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_words (gdbarch, d10v_call_dummy_words);
- set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
- set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
-
+ set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);
@@ -1746,10 +1723,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-
-extern void (*target_resume_hook) (void);
-extern void (*target_wait_loop_hook) (void);
-
void
_initialize_d10v_tdep (void)
{
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 3aeadd3..7c35033 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,43 @@
+2003-04-02 J. Brobecker <brobecker@gnat.com>
+
+ * observer.texi (GDB Observers): Adjust the documentation for the
+ normal_stop notification to better describe reality. Fix a couple
+ of minor typos.
+
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * gdb.texinfo (GDB/MI Program Control): Add
+ '-file-list-exec-source-file'
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ references to CALL_DUMMY_P.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * 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
+ references to write_sp.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.texinfo (GDB/MI Variable Objects): Replace @include with
+ chapter body. Use @smallexample instead of @example.
+ (Annotations): Ditto.
+ * Makefile.in (GDB_DOC_SOURCE_INCLUDES): Remove gdbmi.texinfo and
+ annotate.texi.
+
+2003-03-26 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Replace
+ PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and
+ dummy_addr parameters.
+
2003-03-25 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index db74889..5221314 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -98,10 +98,8 @@ DVIPS = dvips
# Main GDB manual
GDB_DOC_SOURCE_INCLUDES = \
- $(srcdir)/annotate.texi \
$(srcdir)/fdl.texi \
$(srcdir)/gpl.texi \
- $(GDBMI_DIR)/gdbmi.texinfo \
$(READLINE_DIR)/rluser.texinfo \
$(READLINE_DIR)/inc-hist.texinfo
GDB_DOC_BUILD_INCLUDES = \
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 8c38e87..f00cf2b 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14045,8 +14045,4570 @@ environment. Users of this environment can use a new command,
each value is printed in its own window.
@end ignore
-@include annotate.texi
-@include gdbmi.texinfo
+
+@node GDB/MI
+@chapter The @sc{gdb/mi} Interface
+
+@unnumberedsec Function and Purpose
+
+@cindex @sc{gdb/mi}, its purpose
+@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
+specifically intended to support the development of systems which use
+the debugger as just one small component of a larger system.
+
+This chapter is a specification of the @sc{gdb/mi} interface. It is written
+in the form of a reference manual.
+
+Note that @sc{gdb/mi} is still under construction, so some of the
+features described below are incomplete and subject to change.
+
+@unnumberedsec Notation and Terminology
+
+@cindex notational conventions, for @sc{gdb/mi}
+This chapter uses the following notation:
+
+@itemize @bullet
+@item
+@code{|} separates two alternatives.
+
+@item
+@code{[ @var{something} ]} indicates that @var{something} is optional:
+it may or may not be given.
+
+@item
+@code{( @var{group} )*} means that @var{group} inside the parentheses
+may repeat zero or more times.
+
+@item
+@code{( @var{group} )+} means that @var{group} inside the parentheses
+may repeat one or more times.
+
+@item
+@code{"@var{string}"} means a literal @var{string}.
+@end itemize
+
+@ignore
+@heading Dependencies
+@end ignore
+
+@heading Acknowledgments
+
+In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
+Elena Zannoni.
+
+@menu
+* GDB/MI Command Syntax::
+* GDB/MI Compatibility with CLI::
+* GDB/MI Output Records::
+* GDB/MI Command Description Format::
+* GDB/MI Breakpoint Table Commands::
+* GDB/MI Data Manipulation::
+* GDB/MI Program Control::
+* GDB/MI Miscellaneous Commands::
+@ignore
+* GDB/MI Kod Commands::
+* GDB/MI Memory Overlay Commands::
+* GDB/MI Signal Handling Commands::
+@end ignore
+* GDB/MI Stack Manipulation::
+* GDB/MI Symbol Query::
+* GDB/MI Target Manipulation::
+* GDB/MI Thread Commands::
+* GDB/MI Tracepoint Commands::
+* GDB/MI Variable Objects::
+@end menu
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Command Syntax
+@section @sc{gdb/mi} Command Syntax
+
+@menu
+* GDB/MI Input Syntax::
+* GDB/MI Output Syntax::
+* GDB/MI Simple Examples::
+@end menu
+
+@node GDB/MI Input Syntax
+@subsection @sc{gdb/mi} Input Syntax
+
+@cindex input syntax for @sc{gdb/mi}
+@cindex @sc{gdb/mi}, input syntax
+@table @code
+@item @var{command} @expansion{}
+@code{@var{cli-command} | @var{mi-command}}
+
+@item @var{cli-command} @expansion{}
+@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
+@var{cli-command} is any existing @value{GDBN} CLI command.
+
+@item @var{mi-command} @expansion{}
+@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
+@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
+
+@item @var{token} @expansion{}
+"any sequence of digits"
+
+@item @var{option} @expansion{}
+@code{"-" @var{parameter} [ " " @var{parameter} ]}
+
+@item @var{parameter} @expansion{}
+@code{@var{non-blank-sequence} | @var{c-string}}
+
+@item @var{operation} @expansion{}
+@emph{any of the operations described in this chapter}
+
+@item @var{non-blank-sequence} @expansion{}
+@emph{anything, provided it doesn't contain special characters such as
+"-", @var{nl}, """ and of course " "}
+
+@item @var{c-string} @expansion{}
+@code{""" @var{seven-bit-iso-c-string-content} """}
+
+@item @var{nl} @expansion{}
+@code{CR | CR-LF}
+@end table
+
+@noindent
+Notes:
+
+@itemize @bullet
+@item
+The CLI commands are still handled by the @sc{mi} interpreter; their
+output is described below.
+
+@item
+The @code{@var{token}}, when present, is passed back when the command
+finishes.
+
+@item
+Some @sc{mi} commands accept optional arguments as part of the parameter
+list. Each option is identified by a leading @samp{-} (dash) and may be
+followed by an optional argument parameter. Options occur first in the
+parameter list and can be delimited from normal parameters using
+@samp{--} (this is useful when some parameters begin with a dash).
+@end itemize
+
+Pragmatics:
+
+@itemize @bullet
+@item
+We want easy access to the existing CLI syntax (for debugging).
+
+@item
+We want it to be easy to spot a @sc{mi} operation.
+@end itemize
+
+@node GDB/MI Output Syntax
+@subsection @sc{gdb/mi} Output Syntax
+
+@cindex output syntax of @sc{gdb/mi}
+@cindex @sc{gdb/mi}, output syntax
+The output from @sc{gdb/mi} consists of zero or more out-of-band records
+followed, optionally, by a single result record. This result record
+is for the most recent command. The sequence of output records is
+terminated by @samp{(@value{GDBP})}.
+
+If an input command was prefixed with a @code{@var{token}} then the
+corresponding output for that command will also be prefixed by that same
+@var{token}.
+
+@table @code
+@item @var{output} @expansion{}
+@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
+
+@item @var{result-record} @expansion{}
+@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
+
+@item @var{out-of-band-record} @expansion{}
+@code{@var{async-record} | @var{stream-record}}
+
+@item @var{async-record} @expansion{}
+@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
+
+@item @var{exec-async-output} @expansion{}
+@code{[ @var{token} ] "*" @var{async-output}}
+
+@item @var{status-async-output} @expansion{}
+@code{[ @var{token} ] "+" @var{async-output}}
+
+@item @var{notify-async-output} @expansion{}
+@code{[ @var{token} ] "=" @var{async-output}}
+
+@item @var{async-output} @expansion{}
+@code{@var{async-class} ( "," @var{result} )* @var{nl}}
+
+@item @var{result-class} @expansion{}
+@code{"done" | "running" | "connected" | "error" | "exit"}
+
+@item @var{async-class} @expansion{}
+@code{"stopped" | @var{others}} (where @var{others} will be added
+depending on the needs---this is still in development).
+
+@item @var{result} @expansion{}
+@code{ @var{variable} "=" @var{value}}
+
+@item @var{variable} @expansion{}
+@code{ @var{string} }
+
+@item @var{value} @expansion{}
+@code{ @var{const} | @var{tuple} | @var{list} }
+
+@item @var{const} @expansion{}
+@code{@var{c-string}}
+
+@item @var{tuple} @expansion{}
+@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
+
+@item @var{list} @expansion{}
+@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
+@var{result} ( "," @var{result} )* "]" }
+
+@item @var{stream-record} @expansion{}
+@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
+
+@item @var{console-stream-output} @expansion{}
+@code{"~" @var{c-string}}
+
+@item @var{target-stream-output} @expansion{}
+@code{"@@" @var{c-string}}
+
+@item @var{log-stream-output} @expansion{}
+@code{"&" @var{c-string}}
+
+@item @var{nl} @expansion{}
+@code{CR | CR-LF}
+
+@item @var{token} @expansion{}
+@emph{any sequence of digits}.
+@end table
+
+@noindent
+Notes:
+
+@itemize @bullet
+@item
+All output sequences end in a single line containing a period.
+
+@item
+The @code{@var{token}} is from the corresponding request. If an execution
+command is interrupted by the @samp{-exec-interrupt} command, the
+@var{token} associated with the @samp{*stopped} message is the one of the
+original execution command, not the one of the interrupt command.
+
+@item
+@cindex status output in @sc{gdb/mi}
+@var{status-async-output} contains on-going status information about the
+progress of a slow operation. It can be discarded. All status output is
+prefixed by @samp{+}.
+
+@item
+@cindex async output in @sc{gdb/mi}
+@var{exec-async-output} contains asynchronous state change on the target
+(stopped, started, disappeared). All async output is prefixed by
+@samp{*}.
+
+@item
+@cindex notify output in @sc{gdb/mi}
+@var{notify-async-output} contains supplementary information that the
+client should handle (e.g., a new breakpoint information). All notify
+output is prefixed by @samp{=}.
+
+@item
+@cindex console output in @sc{gdb/mi}
+@var{console-stream-output} is output that should be displayed as is in the
+console. It is the textual response to a CLI command. All the console
+output is prefixed by @samp{~}.
+
+@item
+@cindex target output in @sc{gdb/mi}
+@var{target-stream-output} is the output produced by the target program.
+All the target output is prefixed by @samp{@@}.
+
+@item
+@cindex log output in @sc{gdb/mi}
+@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
+instance messages that should be displayed as part of an error log. All
+the log output is prefixed by @samp{&}.
+
+@item
+@cindex list output in @sc{gdb/mi}
+New @sc{gdb/mi} commands should only output @var{lists} containing
+@var{values}.
+
+
+@end itemize
+
+@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
+details about the various output records.
+
+@node GDB/MI Simple Examples
+@subsection Simple Examples of @sc{gdb/mi} Interaction
+@cindex @sc{gdb/mi}, simple examples
+
+This subsection presents several simple examples of interaction using
+the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
+following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
+the output received from @sc{gdb/mi}.
+
+@subsubheading Target Stop
+@c Ummm... There is no "-stop" command. This assumes async, no?
+Here's an example of stopping the inferior process:
+
+@smallexample
+-> -stop
+<- (@value{GDBP})
+@end smallexample
+
+@noindent
+and later:
+
+@smallexample
+<- *stop,reason="stop",address="0x123",source="a.c:123"
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading Simple CLI Command
+
+Here's an example of a simple CLI command being passed through
+@sc{gdb/mi} and on to the CLI.
+
+@smallexample
+-> print 1+2
+<- &"print 1+2\n"
+<- ~"$1 = 3\n"
+<- ^done
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading Command With Side Effects
+
+@smallexample
+-> -symbol-file xyz.exe
+<- *breakpoint,nr="3",address="0x123",source="a.c:123"
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading A Bad Command
+
+Here's what happens if you pass a non-existent command:
+
+@smallexample
+-> -rubbish
+<- ^error,msg="Undefined MI command: rubbish"
+<- (@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Compatibility with CLI
+@section @sc{gdb/mi} Compatibility with CLI
+
+@cindex compatibility, @sc{gdb/mi} and CLI
+@cindex @sc{gdb/mi}, compatibility with CLI
+To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
+accepts existing CLI commands. As specified by the syntax, such
+commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
+respond.
+
+This mechanism is provided as an aid to developers of @sc{gdb/mi}
+clients and not as a reliable interface into the CLI. Since the command
+is being interpreteted in an environment that assumes @sc{gdb/mi}
+behaviour, the exact output of such commands is likely to end up being
+an un-supported hybrid of @sc{gdb/mi} and CLI output.
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Output Records
+@section @sc{gdb/mi} Output Records
+
+@menu
+* GDB/MI Result Records::
+* GDB/MI Stream Records::
+* GDB/MI Out-of-band Records::
+@end menu
+
+@node GDB/MI Result Records
+@subsection @sc{gdb/mi} Result Records
+
+@cindex result records in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, result records
+In addition to a number of out-of-band notifications, the response to a
+@sc{gdb/mi} command includes one of the following result indications:
+
+@table @code
+@findex ^done
+@item "^done" [ "," @var{results} ]
+The synchronous operation was successful, @code{@var{results}} are the return
+values.
+
+@item "^running"
+@findex ^running
+@c Is this one correct? Should it be an out-of-band notification?
+The asynchronous operation was successfully started. The target is
+running.
+
+@item "^error" "," @var{c-string}
+@findex ^error
+The operation failed. The @code{@var{c-string}} contains the corresponding
+error message.
+@end table
+
+@node GDB/MI Stream Records
+@subsection @sc{gdb/mi} Stream Records
+
+@cindex @sc{gdb/mi}, stream records
+@cindex stream records in @sc{gdb/mi}
+@value{GDBN} internally maintains a number of output streams: the console, the
+target, and the log. The output intended for each of these streams is
+funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
+
+Each stream record begins with a unique @dfn{prefix character} which
+identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
+Syntax}). In addition to the prefix, each stream record contains a
+@code{@var{string-output}}. This is either raw text (with an implicit new
+line) or a quoted C string (which does not contain an implicit newline).
+
+@table @code
+@item "~" @var{string-output}
+The console output stream contains text that should be displayed in the
+CLI console window. It contains the textual responses to CLI commands.
+
+@item "@@" @var{string-output}
+The target output stream contains any textual output from the running
+target.
+
+@item "&" @var{string-output}
+The log stream contains debugging messages being produced by @value{GDBN}'s
+internals.
+@end table
+
+@node GDB/MI Out-of-band Records
+@subsection @sc{gdb/mi} Out-of-band Records
+
+@cindex out-of-band records in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, out-of-band records
+@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
+additional changes that have occurred. Those changes can either be a
+consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
+target activity (e.g., target stopped).
+
+The following is a preliminary list of possible out-of-band records.
+
+@table @code
+@item "*" "stop"
+@end table
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Command Description Format
+@section @sc{gdb/mi} Command Description Format
+
+The remaining sections describe blocks of commands. Each block of
+commands is laid out in a fashion similar to this section.
+
+Note the the line breaks shown in the examples are here only for
+readability. They don't appear in the real output.
+Also note that the commands with a non-available example (N.A.@:) are
+not yet implemented.
+
+@subheading Motivation
+
+The motivation for this collection of commands.
+
+@subheading Introduction
+
+A brief introduction to this collection of commands as a whole.
+
+@subheading Commands
+
+For each command in the block, the following is described:
+
+@subsubheading Synopsis
+
+@smallexample
+ -command @var{args}@dots{}
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} CLI command.
+
+@subsubheading Result
+
+@subsubheading Out-of-band
+
+@subsubheading Notes
+
+@subsubheading Example
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Breakpoint Table Commands
+@section @sc{gdb/mi} Breakpoint table commands
+
+@cindex breakpoint commands for @sc{gdb/mi}
+@cindex @sc{gdb/mi}, breakpoint commands
+This section documents @sc{gdb/mi} commands for manipulating
+breakpoints.
+
+@subheading The @code{-break-after} Command
+@findex -break-after
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-after @var{number} @var{count}
+@end smallexample
+
+The breakpoint number @var{number} is not in effect until it has been
+hit @var{count} times. To see how this is reflected in the output of
+the @samp{-break-list} command, see the description of the
+@samp{-break-list} command below.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{ignore}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
+(@value{GDBP})
+-break-after 1 3
+~
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
+ignore="3"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@subheading The @code{-break-catch} Command
+@findex -break-catch
+
+@subheading The @code{-break-commands} Command
+@findex -break-commands
+@end ignore
+
+
+@subheading The @code{-break-condition} Command
+@findex -break-condition
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-condition @var{number} @var{expr}
+@end smallexample
+
+Breakpoint @var{number} will stop the program only if the condition in
+@var{expr} is true. The condition becomes part of the
+@samp{-break-list} output (see the description of the @samp{-break-list}
+command below).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{condition}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-condition 1 1
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
+times="0",ignore="3"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-delete} Command
+@findex -break-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-delete ( @var{breakpoint} )+
+@end smallexample
+
+Delete the breakpoint(s) whose number(s) are specified in the argument
+list. This is obviously reflected in the breakpoint list.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{delete}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-delete 1
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-disable} Command
+@findex -break-disable
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-disable ( @var{breakpoint} )+
+@end smallexample
+
+Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
+break list is now set to @samp{n} for the named @var{breakpoint}(s).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{disable}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-disable 2
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-enable} Command
+@findex -break-enable
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-enable ( @var{breakpoint} )+
+@end smallexample
+
+Enable (previously disabled) @var{breakpoint}(s).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{enable}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-enable 2
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-info} Command
+@findex -break-info
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-info @var{breakpoint}
+@end smallexample
+
+@c REDUNDANT???
+Get information about a single breakpoint.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
+
+@subsubheading Example
+N.A.
+
+@subheading The @code{-break-insert} Command
+@findex -break-insert
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-insert [ -t ] [ -h ] [ -r ]
+ [ -c @var{condition} ] [ -i @var{ignore-count} ]
+ [ -p @var{thread} ] [ @var{line} | @var{addr} ]
+@end smallexample
+
+@noindent
+If specified, @var{line}, can be one of:
+
+@itemize @bullet
+@item function
+@c @item +offset
+@c @item -offset
+@c @item linenum
+@item filename:linenum
+@item filename:function
+@item *address
+@end itemize
+
+The possible optional parameters of this command are:
+
+@table @samp
+@item -t
+Insert a tempoary breakpoint.
+@item -h
+Insert a hardware breakpoint.
+@item -c @var{condition}
+Make the breakpoint conditional on @var{condition}.
+@item -i @var{ignore-count}
+Initialize the @var{ignore-count}.
+@item -r
+Insert a regular breakpoint in all the functions whose names match the
+given regular expression. Other flags are not applicable to regular
+expresson.
+@end table
+
+@subsubheading Result
+
+The result is in the form:
+
+@smallexample
+ ^done,bkptno="@var{number}",func="@var{funcname}",
+ file="@var{filename}",line="@var{lineno}"
+@end smallexample
+
+@noindent
+where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
+is the name of the function where the breakpoint was inserted,
+@var{filename} is the name of the source file which contains this
+function, and @var{lineno} is the source line number within that file.
+
+Note: this format is open to change.
+@c An out-of-band breakpoint instead of part of the result?
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
+@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
+(@value{GDBP})
+-break-insert -t foo
+^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
+bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
+addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
+(@value{GDBP})
+-break-insert -r foo.*
+~int foo(int, int);
+^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-list} Command
+@findex -break-list
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-list
+@end smallexample
+
+Displays the list of inserted breakpoints, showing the following fields:
+
+@table @samp
+@item Number
+number of the breakpoint
+@item Type
+type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
+@item Disposition
+should the breakpoint be deleted or disabled when it is hit: @samp{keep}
+or @samp{nokeep}
+@item Enabled
+is the breakpoint enabled or no: @samp{y} or @samp{n}
+@item Address
+memory location at which the breakpoint is set
+@item What
+logical location of the breakpoint, expressed by function name, file
+name, line number
+@item Times
+number of times the breakpoint has been hit
+@end table
+
+If there are no breakpoints or watchpoints, the @code{BreakpointTable}
+@code{body} field is an empty list.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info break}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
+bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+Here's an example of the result when there are no breakpoints:
+
+@smallexample
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-watch} Command
+@findex -break-watch
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-watch [ -a | -r ]
+@end smallexample
+
+Create a watchpoint. With the @samp{-a} option it will create an
+@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
+read from or on a write to the memory location. With the @samp{-r}
+option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
+trigger only when the memory location is accessed for reading. Without
+either of the options, the watchpoint created is a regular watchpoint,
+i.e. it will trigger when the memory location is accessed for writing.
+@xref{Set Watchpoints, , Setting watchpoints}.
+
+Note that @samp{-break-list} will report a single list of watchpoints and
+breakpoints inserted.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
+@samp{rwatch}.
+
+@subsubheading Example
+
+Setting a watchpoint on a variable in the @code{main} function:
+
+@smallexample
+(@value{GDBP})
+-break-watch x
+^done,wpt=@{number="2",exp="x"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
+value=@{old="-268439212",new="55"@},
+frame=@{func="main",args=[],file="recursive2.c",line="5"@}
+(@value{GDBP})
+@end smallexample
+
+Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
+the program execution twice: first for the variable changing value, then
+for the watchpoint going out of scope.
+
+@smallexample
+(@value{GDBP})
+-break-watch C
+^done,wpt=@{number="5",exp="C"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",
+wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-scope",wpnum="5",
+frame=@{func="callee3",args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+@end smallexample
+
+Listing breakpoints and watchpoints, at different points in the program
+execution. Note that once the watchpoint goes out of scope, it is
+deleted.
+
+@smallexample
+(@value{GDBP})
+-break-watch C
+^done,wpt=@{number="2",exp="C"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+bkpt=@{number="2",type="watchpoint",disp="keep",
+enabled="y",addr="",what="C",times="0"@}]@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
+value=@{old="-276895068",new="3"@},
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+bkpt=@{number="2",type="watchpoint",disp="keep",
+enabled="y",addr="",what="C",times="-5"@}]@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-scope",wpnum="2",
+frame=@{func="callee3",args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Data Manipulation
+@section @sc{gdb/mi} Data Manipulation
+
+@cindex data manipulation, in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, data manipulation
+This section describes the @sc{gdb/mi} commands that manipulate data:
+examine memory and registers, evaluate expressions, etc.
+
+@c REMOVED FROM THE INTERFACE.
+@c @subheading -data-assign
+@c Change the value of a program variable. Plenty of side effects.
+@c @subsubheading GDB command
+@c set variable
+@c @subsubheading Example
+@c N.A.
+
+@subheading The @code{-data-disassemble} Command
+@findex -data-disassemble
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-disassemble
+ [ -s @var{start-addr} -e @var{end-addr} ]
+ | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
+ -- @var{mode}
+@end smallexample
+
+@noindent
+Where:
+
+@table @samp
+@item @var{start-addr}
+is the beginning address (or @code{$pc})
+@item @var{end-addr}
+is the end address
+@item @var{filename}
+is the name of the file to disassemble
+@item @var{linenum}
+is the line number to disassemble around
+@item @var{lines}
+is the the number of disassembly lines to be produced. If it is -1,
+the whole function will be disassembled, in case no @var{end-addr} is
+specified. If @var{end-addr} is specified as a non-zero value, and
+@var{lines} is lower than the number of disassembly lines between
+@var{start-addr} and @var{end-addr}, only @var{lines} lines are
+displayed; if @var{lines} is higher than the number of lines between
+@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
+are displayed.
+@item @var{mode}
+is either 0 (meaning only disassembly) or 1 (meaning mixed source and
+disassembly).
+@end table
+
+@subsubheading Result
+
+The output for each instruction is composed of four fields:
+
+@itemize @bullet
+@item Address
+@item Func-name
+@item Offset
+@item Instruction
+@end itemize
+
+Note that whatever included in the instruction field, is not manipulated
+directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
+
+@subsubheading @value{GDBN} Command
+
+There's no direct mapping from this command to the CLI.
+
+@subsubheading Example
+
+Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -s $pc -e "$pc + 20" -- 0
+^done,
+asm_insns=[
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@},
+@{address="0x000107c8",func-name="main",offset="12",
+inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
+@{address="0x000107cc",func-name="main",offset="16",
+inst="sethi %hi(0x11800), %o2"@},
+@{address="0x000107d0",func-name="main",offset="20",
+inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble the whole @code{main} function. Line 32 is part of
+@code{main}.
+
+@smallexample
+-data-disassemble -f basics.c -l 32 -- 0
+^done,asm_insns=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@},
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@},
+[@dots{}]
+@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
+@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble 3 instructions from the start of @code{main}:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -f basics.c -l 32 -n 3 -- 0
+^done,asm_insns=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@},
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble 3 instructions from the start of @code{main} in mixed mode:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -f basics.c -l 32 -n 3 -- 1
+^done,asm_insns=[
+src_and_asm_line=@{line="31",
+file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
+ testsuite/gdb.mi/basics.c",line_asm_insn=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@}]@},
+src_and_asm_line=@{line="32",
+file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
+ testsuite/gdb.mi/basics.c",line_asm_insn=[
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@}]@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-evaluate-expression} Command
+@findex -data-evaluate-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-evaluate-expression @var{expr}
+@end smallexample
+
+Evaluate @var{expr} as an expression. The expression could contain an
+inferior function call. The function call will execute synchronously.
+If the expression contains spaces, it must be enclosed in double quotes.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
+@samp{call}. In @code{gdbtk} only, there's a corresponding
+@samp{gdb_eval} command.
+
+@subsubheading Example
+
+In the following example, the numbers that precede the commands are the
+@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
+Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
+output.
+
+@smallexample
+211-data-evaluate-expression A
+211^done,value="1"
+(@value{GDBP})
+311-data-evaluate-expression &A
+311^done,value="0xefffeb7c"
+(@value{GDBP})
+411-data-evaluate-expression A+3
+411^done,value="4"
+(@value{GDBP})
+511-data-evaluate-expression "A + 3"
+511^done,value="4"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-list-changed-registers} Command
+@findex -data-list-changed-registers
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-changed-registers
+@end smallexample
+
+Display a list of the registers that have changed.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
+has the corresponding command @samp{gdb_changed_register_list}.
+
+@subsubheading Example
+
+On a PPC MBX board:
+
+@smallexample
+(@value{GDBP})
+-exec-continue
+^running
+
+(@value{GDBP})
+*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
+args=[],file="try.c",line="5"@}
+(@value{GDBP})
+-data-list-changed-registers
+^done,changed-registers=["0","1","2","4","5","6","7","8","9",
+"10","11","13","14","15","16","17","18","19","20","21","22","23",
+"24","25","26","27","28","30","31","64","65","66","67","69"]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-list-register-names} Command
+@findex -data-list-register-names
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-register-names [ ( @var{regno} )+ ]
+@end smallexample
+
+Show a list of register names for the current target. If no arguments
+are given, it shows a list of the names of all the registers. If
+integer numbers are given as arguments, it will print a list of the
+names of the registers corresponding to the arguments. To ensure
+consistency between a register name and its number, the output list may
+include empty register names.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} does not have a command which corresponds to
+@samp{-data-list-register-names}. In @code{gdbtk} there is a
+corresponding command @samp{gdb_regnames}.
+
+@subsubheading Example
+
+For the PPC MBX board:
+@smallexample
+(@value{GDBP})
+-data-list-register-names
+^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
+"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
+"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
+"r30","r31","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",
+"", "pc","ps","cr","lr","ctr","xer"]
+(@value{GDBP})
+-data-list-register-names 1 2 3
+^done,register-names=["r1","r2","r3"]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-data-list-register-values} Command
+@findex -data-list-register-values
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-register-values @var{fmt} [ ( @var{regno} )*]
+@end smallexample
+
+Display the registers' contents. @var{fmt} is the format according to
+which the registers' contents are to be returned, followed by an optional
+list of numbers specifying the registers to display. A missing list of
+numbers indicates that the contents of all the registers must be returned.
+
+Allowed formats for @var{fmt} are:
+
+@table @code
+@item x
+Hexadecimal
+@item o
+Octal
+@item t
+Binary
+@item d
+Decimal
+@item r
+Raw
+@item N
+Natural
+@end table
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
+all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
+
+@subsubheading Example
+
+For a PPC MBX board (note: line breaks are for readability only, they
+don't appear in the actual output):
+
+@smallexample
+(@value{GDBP})
+-data-list-register-values r 64 65
+^done,register-values=[@{number="64",value="0xfe00a300"@},
+@{number="65",value="0x00029002"@}]
+(@value{GDBP})
+-data-list-register-values x
+^done,register-values=[@{number="0",value="0xfe0043c8"@},
+@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
+@{number="3",value="0x0"@},@{number="4",value="0xa"@},
+@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
+@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
+@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
+@{number="11",value="0x1"@},@{number="12",value="0x0"@},
+@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
+@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
+@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
+@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
+@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
+@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
+@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
+@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
+@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
+@{number="31",value="0x0"@},@{number="32",value="0x0"@},
+@{number="33",value="0x0"@},@{number="34",value="0x0"@},
+@{number="35",value="0x0"@},@{number="36",value="0x0"@},
+@{number="37",value="0x0"@},@{number="38",value="0x0"@},
+@{number="39",value="0x0"@},@{number="40",value="0x0"@},
+@{number="41",value="0x0"@},@{number="42",value="0x0"@},
+@{number="43",value="0x0"@},@{number="44",value="0x0"@},
+@{number="45",value="0x0"@},@{number="46",value="0x0"@},
+@{number="47",value="0x0"@},@{number="48",value="0x0"@},
+@{number="49",value="0x0"@},@{number="50",value="0x0"@},
+@{number="51",value="0x0"@},@{number="52",value="0x0"@},
+@{number="53",value="0x0"@},@{number="54",value="0x0"@},
+@{number="55",value="0x0"@},@{number="56",value="0x0"@},
+@{number="57",value="0x0"@},@{number="58",value="0x0"@},
+@{number="59",value="0x0"@},@{number="60",value="0x0"@},
+@{number="61",value="0x0"@},@{number="62",value="0x0"@},
+@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
+@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
+@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
+@{number="69",value="0x20002b03"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-read-memory} Command
+@findex -data-read-memory
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-read-memory [ -o @var{byte-offset} ]
+ @var{address} @var{word-format} @var{word-size}
+ @var{nr-rows} @var{nr-cols} [ @var{aschar} ]
+@end smallexample
+
+@noindent
+where:
+
+@table @samp
+@item @var{address}
+An expression specifying the address of the first memory word to be
+read. Complex expressions containing embedded white space should be
+quoted using the C convention.
+
+@item @var{word-format}
+The format to be used to print the memory words. The notation is the
+same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
+,Output formats}).
+
+@item @var{word-size}
+The size of each memory word in bytes.
+
+@item @var{nr-rows}
+The number of rows in the output table.
+
+@item @var{nr-cols}
+The number of columns in the output table.
+
+@item @var{aschar}
+If present, indicates that each row should include an @sc{ascii} dump. The
+value of @var{aschar} is used as a padding character when a byte is not a
+member of the printable @sc{ascii} character set (printable @sc{ascii}
+characters are those whose code is between 32 and 126, inclusively).
+
+@item @var{byte-offset}
+An offset to add to the @var{address} before fetching memory.
+@end table
+
+This command displays memory contents as a table of @var{nr-rows} by
+@var{nr-cols} words, each word being @var{word-size} bytes. In total,
+@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
+(returned as @samp{total-bytes}). Should less than the requested number
+of bytes be returned by the target, the missing words are identified
+using @samp{N/A}. The number of bytes read from the target is returned
+in @samp{nr-bytes} and the starting address used to read memory in
+@samp{addr}.
+
+The address of the next/previous row or page is available in
+@samp{next-row} and @samp{prev-row}, @samp{next-page} and
+@samp{prev-page}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
+@samp{gdb_get_mem} memory read command.
+
+@subsubheading Example
+
+Read six bytes of memory starting at @code{bytes+6} but then offset by
+@code{-6} bytes. Format as three rows of two columns. One byte per
+word. Display each word in hex.
+
+@smallexample
+(@value{GDBP})
+9-data-read-memory -o -6 -- bytes+6 x 1 3 2
+9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
+next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
+prev-page="0x0000138a",memory=[
+@{addr="0x00001390",data=["0x00","0x01"]@},
+@{addr="0x00001392",data=["0x02","0x03"]@},
+@{addr="0x00001394",data=["0x04","0x05"]@}]
+(@value{GDBP})
+@end smallexample
+
+Read two bytes of memory starting at address @code{shorts + 64} and
+display as a single word formatted in decimal.
+
+@smallexample
+(@value{GDBP})
+5-data-read-memory shorts+64 d 2 1 1
+5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
+next-row="0x00001512",prev-row="0x0000150e",
+next-page="0x00001512",prev-page="0x0000150e",memory=[
+@{addr="0x00001510",data=["128"]@}]
+(@value{GDBP})
+@end smallexample
+
+Read thirty two bytes of memory starting at @code{bytes+16} and format
+as eight rows of four columns. Include a string encoding with @samp{x}
+used as the non-printable character.
+
+@smallexample
+(@value{GDBP})
+4-data-read-memory bytes+16 x 1 8 4 x
+4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
+next-row="0x000013c0",prev-row="0x0000139c",
+next-page="0x000013c0",prev-page="0x00001380",memory=[
+@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
+@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
+@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
+@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
+@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
+@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
+@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
+@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-display-delete} Command
+@findex -display-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-delete @var{number}
+@end smallexample
+
+Delete the display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{delete display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-disable} Command
+@findex -display-disable
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-disable @var{number}
+@end smallexample
+
+Disable display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{disable display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-enable} Command
+@findex -display-enable
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-enable @var{number}
+@end smallexample
+
+Enable display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{enable display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-insert} Command
+@findex -display-insert
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-insert @var{expression}
+@end smallexample
+
+Display @var{expression} every time the program stops.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-list} Command
+@findex -display-list
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-list
+@end smallexample
+
+List the displays. Do not show the current values.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-environment-cd} Command
+@findex -environment-cd
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-cd @var{pathdir}
+@end smallexample
+
+Set @value{GDBN}'s working directory.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{cd}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-directory} Command
+@findex -environment-directory
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-directory [ -r ] [ @var{pathdir} ]+
+@end smallexample
+
+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
+@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 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
+character must not be used
+in any directory name.
+If no directories are specified, the current search path is displayed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{dir}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
+^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory ""
+^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory -r /home/jjohnstn/src/gdb /usr/src
+^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory -r
+^done,source-path="$cdir:$cwd"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-path} Command
+@findex -environment-path
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-path [ -r ] [ @var{pathdir} ]+
+@end smallexample
+
+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
+@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 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
+character must not be used
+in any directory name.
+If no directories are specified, the current path is displayed.
+
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{path}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-path
+^done,path="/usr/bin"
+(@value{GDBP})
+-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
+^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
+(@value{GDBP})
+-environment-path -r /usr/local/bin
+^done,path="/usr/local/bin:/usr/bin"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-pwd} Command
+@findex -environment-pwd
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-pwd
+@end smallexample
+
+Show the current working directory.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{pwd}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-pwd
+^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Program Control
+@section @sc{gdb/mi} Program control
+
+@subsubheading Program termination
+
+As a result of execution, the inferior program can run to completion, if
+it doesn't encounter any breakpoints. In this case the output will
+include an exit code, if the program has exited exceptionally.
+
+@subsubheading Examples
+
+@noindent
+Program exited normally:
+
+@smallexample
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="exited-normally"
+(@value{GDBP})
+@end smallexample
+
+@noindent
+Program exited exceptionally:
+
+@smallexample
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="exited",exit-code="01"
+(@value{GDBP})
+@end smallexample
+
+Another way the program can terminate is if it receives a signal such as
+@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
+
+@smallexample
+(@value{GDBP})
+*stopped,reason="exited-signalled",signal-name="SIGINT",
+signal-meaning="Interrupt"
+@end smallexample
+
+
+@subheading The @code{-exec-abort} Command
+@findex -exec-abort
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-abort
+@end smallexample
+
+Kill the inferior running program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{kill}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-exec-arguments} Command
+@findex -exec-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-arguments @var{args}
+@end smallexample
+
+Set the inferior program arguments, to be used in the next
+@samp{-exec-run}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{set args}.
+
+@subsubheading Example
+
+@c FIXME!
+Don't have one around.
+
+
+@subheading The @code{-exec-continue} Command
+@findex -exec-continue
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-continue
+@end smallexample
+
+Asynchronous command. Resumes the execution of the inferior program
+until a breakpoint is encountered, or until the inferior exits.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} corresponding is @samp{continue}.
+
+@subsubheading Example
+
+@smallexample
+-exec-continue
+^running
+(@value{GDBP})
+@@Hello world
+*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
+file="hello.c",line="13"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-finish} Command
+@findex -exec-finish
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-finish
+@end smallexample
+
+Asynchronous command. Resumes the execution of the inferior program
+until the current function is exited. Displays the results returned by
+the function.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{finish}.
+
+@subsubheading Example
+
+Function returning @code{void}.
+
+@smallexample
+-exec-finish
+^running
+(@value{GDBP})
+@@hello from foo
+*stopped,reason="function-finished",frame=@{func="main",args=[],
+file="hello.c",line="7"@}
+(@value{GDBP})
+@end smallexample
+
+Function returning other than @code{void}. The name of the internal
+@value{GDBN} variable storing the result is printed, together with the
+value itself.
+
+@smallexample
+-exec-finish
+^running
+(@value{GDBP})
+*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
+args=[@{name="a",value="1"],@{name="b",value="9"@}@},
+file="recursive2.c",line="14"@},
+gdb-result-var="$1",return-value="0"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-interrupt} Command
+@findex -exec-interrupt
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-interrupt
+@end smallexample
+
+Asynchronous command. Interrupts the background execution of the target.
+Note how the token associated with the stop message is the one for the
+execution command that has been interrupted. The token for the interrupt
+itself only appears in the @samp{^done} output. If the user is trying to
+interrupt a non-running program, an error message will be printed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{interrupt}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+111-exec-continue
+111^running
+
+(@value{GDBP})
+222-exec-interrupt
+222^done
+(@value{GDBP})
+111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
+frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
+(@value{GDBP})
+
+(@value{GDBP})
+-exec-interrupt
+^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-next} Command
+@findex -exec-next
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-next
+@end smallexample
+
+Asynchronous command. Resumes execution of the inferior program, stopping
+when the beginning of the next source line is reached.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{next}.
+
+@subsubheading Example
+
+@smallexample
+-exec-next
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",line="8",file="hello.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-next-instruction} Command
+@findex -exec-next-instruction
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-next-instruction
+@end smallexample
+
+Asynchronous command. Executes one machine instruction. If the
+instruction is a function call continues until the function returns. If
+the program stops at an instruction in the middle of a source line, the
+address will be printed as well.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{nexti}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-next-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+addr="0x000100d4",line="5",file="hello.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-return} Command
+@findex -exec-return
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-return
+@end smallexample
+
+Makes current function return immediately. Doesn't execute the inferior.
+Displays the new current frame.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{return}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+200-break-insert callee4
+200^done,bkpt=@{number="1",addr="0x00010734",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+(@value{GDBP})
+000-exec-run
+000^running
+(@value{GDBP})
+000*stopped,reason="breakpoint-hit",bkptno="1",
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+(@value{GDBP})
+205-break-delete
+205^done
+(@value{GDBP})
+111-exec-return
+111^done,frame=@{level="0",func="callee3",
+args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-run} Command
+@findex -exec-run
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-run
+@end smallexample
+
+Asynchronous command. Starts execution of the inferior from the
+beginning. The inferior executes until either a breakpoint is
+encountered or the program exits.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{run}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+*stopped,reason="breakpoint-hit",bkptno="1",
+frame=@{func="main",args=[],file="recursive2.c",line="4"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-show-arguments} Command
+@findex -exec-show-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-show-arguments
+@end smallexample
+
+Print the arguments of the program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{show args}.
+
+@subsubheading Example
+N.A.
+
+@c @subheading -exec-signal
+
+@subheading The @code{-exec-step} Command
+@findex -exec-step
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-step
+@end smallexample
+
+Asynchronous command. Resumes execution of the inferior program, stopping
+when the beginning of the next source line is reached, if the next
+source line is not a function call. If it is, stop at the first
+instruction of the called function.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{step}.
+
+@subsubheading Example
+
+Stepping into a function:
+
+@smallexample
+-exec-step
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{func="foo",args=[@{name="a",value="10"@},
+@{name="b",value="0"@}],file="recursive2.c",line="11"@}
+(@value{GDBP})
+@end smallexample
+
+Regular stepping:
+
+@smallexample
+-exec-step
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-step-instruction} Command
+@findex -exec-step-instruction
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-step-instruction
+@end smallexample
+
+Asynchronous command. Resumes the inferior which executes one machine
+instruction. The output, once @value{GDBN} has stopped, will vary depending on
+whether we have stopped in the middle of a source line or not. In the
+former case, the address at which the program stopped will be printed as
+well.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{stepi}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-step-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{func="foo",args=[],file="try.c",line="10"@}
+(@value{GDBP})
+-exec-step-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-until} Command
+@findex -exec-until
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-until [ @var{location} ]
+@end smallexample
+
+Asynchronous command. Executes the inferior until the @var{location}
+specified in the argument is reached. If there is no argument, the inferior
+executes until a source line greater than the current one is reached.
+The reason for stopping in this case will be @samp{location-reached}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{until}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-until recursive2.c:6
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="location-reached",frame=@{func="main",args=[],
+file="recursive2.c",line="6"@}
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@subheading -file-clear
+Is this going away????
+@end ignore
+
+
+@subheading The @code{-file-exec-and-symbols} Command
+@findex -file-exec-and-symbols
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-exec-and-symbols @var{file}
+@end smallexample
+
+Specify the executable file to be debugged. This file is the one from
+which the symbol table is also read. If no file is specified, the
+command clears the executable and symbol information. If breakpoints
+are set when using this command with no arguments, @value{GDBN} will produce
+error messages. Otherwise, no output is produced, except a completion
+notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-exec-file} Command
+@findex -file-exec-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-exec-file @var{file}
+@end smallexample
+
+Specify the executable file to be debugged. Unlike
+@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
+from this file. If used without argument, @value{GDBN} clears the information
+about the executable file. No output is produced, except a completion
+notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{exec-file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-list-exec-sections} Command
+@findex -file-list-exec-sections
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-sections
+@end smallexample
+
+List the sections of the current executable file.
+
+@subsubheading @value{GDBN} Command
+
+The @value{GDBN} command @samp{info file} shows, among the rest, the same
+information as this command. @code{gdbtk} has a corresponding command
+@samp{gdb_load_info}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-exec-source-file} Command
+@findex -file-list-exec-source-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-source-file
+@end smallexample
+
+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
+
+There's no @value{GDBN} command which directly corresponds to this one.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+123-file-list-exec-source-file
+123^done,line="1",file="foo.c",fullname="/home/bar/foo.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-list-exec-source-files} Command
+@findex -file-list-exec-source-files
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-source-files
+@end smallexample
+
+List the source files for the current executable.
+
+@subsubheading @value{GDBN} Command
+
+There's no @value{GDBN} command which directly corresponds to this one.
+@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-shared-libraries} Command
+@findex -file-list-shared-libraries
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-shared-libraries
+@end smallexample
+
+List the shared libraries in the program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info shared}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-symbol-files} Command
+@findex -file-list-symbol-files
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-symbol-files
+@end smallexample
+
+List symbol files.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info file} (part of it).
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-symbol-file} Command
+@findex -file-symbol-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-symbol-file @var{file}
+@end smallexample
+
+Read symbol table info from the specified @var{file} argument. When
+used without arguments, clears @value{GDBN}'s symbol table info. No output is
+produced, except for a completion notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{symbol-file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Miscellaneous Commands
+@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
+
+@c @subheading -gdb-complete
+
+@subheading The @code{-gdb-exit} Command
+@findex -gdb-exit
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-exit
+@end smallexample
+
+Exit @value{GDBN} immediately.
+
+@subsubheading @value{GDBN} Command
+
+Approximately corresponds to @samp{quit}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-exit
+@end smallexample
+
+@subheading The @code{-gdb-set} Command
+@findex -gdb-set
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-set
+@end smallexample
+
+Set an internal @value{GDBN} variable.
+@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{set}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-set $foo=3
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-gdb-show} Command
+@findex -gdb-show
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-show
+@end smallexample
+
+Show the current value of a @value{GDBN} variable.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{show}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-show annotate
+^done,value="0"
+(@value{GDBP})
+@end smallexample
+
+@c @subheading -gdb-source
+
+
+@subheading The @code{-gdb-version} Command
+@findex -gdb-version
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-version
+@end smallexample
+
+Show version information for @value{GDBN}. Used mostly in testing.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
+information when you start an interactive session.
+
+@subsubheading Example
+
+@c This example modifies the actual output from GDB to avoid overfull
+@c box in TeX.
+@smallexample
+(@value{GDBP})
+-gdb-version
+~GNU gdb 5.2.1
+~Copyright 2000 Free Software Foundation, Inc.
+~GDB is free software, covered by the GNU General Public License, and
+~you are welcome to change it and/or distribute copies of it under
+~ certain conditions.
+~Type "show copying" to see the conditions.
+~There is absolutely no warranty for GDB. Type "show warranty" for
+~ details.
+~This GDB was configured as
+ "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
+^done
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-interpreter-exec} Command
+@findex -interpreter-exec
+
+@subheading Synopsis
+
+@smallexample
+-interpreter-exec @var{interpreter} @var{command}
+@end smallexample
+
+Execute the specified @var{command} in the given @var{interpreter}.
+
+@subheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{interpreter-exec}.
+
+@subheading Example
+
+@smallexample
+(@value{GDBP})
+-interpreter-exec console "break main"
+&"During symbol reading, couldn't parse type; debugger out of date?.\n"
+&"During symbol reading, bad structure-type format.\n"
+~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
+^done
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Kod Commands
+@section @sc{gdb/mi} Kod Commands
+
+The Kod commands are not implemented.
+
+@c @subheading -kod-info
+
+@c @subheading -kod-list
+
+@c @subheading -kod-list-object-types
+
+@c @subheading -kod-show
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Memory Overlay Commands
+@section @sc{gdb/mi} Memory Overlay Commands
+
+The memory overlay commands are not implemented.
+
+@c @subheading -overlay-auto
+
+@c @subheading -overlay-list-mapping-state
+
+@c @subheading -overlay-list-overlays
+
+@c @subheading -overlay-map
+
+@c @subheading -overlay-off
+
+@c @subheading -overlay-on
+
+@c @subheading -overlay-unmap
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Signal Handling Commands
+@section @sc{gdb/mi} Signal Handling Commands
+
+Signal handling commands are not implemented.
+
+@c @subheading -signal-handle
+
+@c @subheading -signal-list-handle-actions
+
+@c @subheading -signal-list-signal-types
+@end ignore
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Stack Manipulation
+@section @sc{gdb/mi} Stack Manipulation Commands
+
+
+@subheading The @code{-stack-info-frame} Command
+@findex -stack-info-frame
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-info-frame
+@end smallexample
+
+Get info on the current frame.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
+(without arguments).
+
+@subsubheading Example
+N.A.
+
+@subheading The @code{-stack-info-depth} Command
+@findex -stack-info-depth
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-info-depth [ @var{max-depth} ]
+@end smallexample
+
+Return the depth of the stack. If the integer argument @var{max-depth}
+is specified, do not count beyond @var{max-depth} frames.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command.
+
+@subsubheading Example
+
+For a stack with frame levels 0 through 11:
+
+@smallexample
+(@value{GDBP})
+-stack-info-depth
+^done,depth="12"
+(@value{GDBP})
+-stack-info-depth 4
+^done,depth="4"
+(@value{GDBP})
+-stack-info-depth 12
+^done,depth="12"
+(@value{GDBP})
+-stack-info-depth 11
+^done,depth="11"
+(@value{GDBP})
+-stack-info-depth 13
+^done,depth="12"
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-stack-list-arguments} Command
+@findex -stack-list-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-arguments @var{show-values}
+ [ @var{low-frame} @var{high-frame} ]
+@end smallexample
+
+Display a list of the arguments for the frames between @var{low-frame}
+and @var{high-frame} (inclusive). If @var{low-frame} and
+@var{high-frame} are not provided, list the arguments for the whole call
+stack.
+
+The @var{show-values} argument must have a value of 0 or 1. A value of
+0 means that only the names of the arguments are listed, a value of 1
+means that both names and values of the arguments are printed.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
+@samp{gdb_get_args} command which partially overlaps with the
+functionality of @samp{-stack-list-arguments}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames
+^done,
+stack=[
+frame=@{level="0",addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+frame=@{level="1",addr="0x0001076c",func="callee3",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+frame=@{level="2",addr="0x0001078c",func="callee2",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+frame=@{level="3",addr="0x000107b4",func="callee1",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+frame=@{level="4",addr="0x000107e0",func="main",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+(@value{GDBP})
+-stack-list-arguments 0
+^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=[]@}]
+(@value{GDBP})
+-stack-list-arguments 1
+^done,
+stack-args=[
+frame=@{level="0",args=[]@},
+frame=@{level="1",
+ args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
+frame=@{level="2",args=[
+@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
+@{frame=@{level="3",args=[
+@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@},
+@{name="fltarg",value="3.5"@}]@},
+frame=@{level="4",args=[]@}]
+(@value{GDBP})
+-stack-list-arguments 0 2 2
+^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
+(@value{GDBP})
+-stack-list-arguments 1 2 2
+^done,stack-args=[frame=@{level="2",
+args=[@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
+(@value{GDBP})
+@end smallexample
+
+@c @subheading -stack-list-exception-handlers
+
+
+@subheading The @code{-stack-list-frames} Command
+@findex -stack-list-frames
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-frames [ @var{low-frame} @var{high-frame} ]
+@end smallexample
+
+List the frames currently on the stack. For each frame it displays the
+following info:
+
+@table @samp
+@item @var{level}
+The frame number, 0 being the topmost frame, i.e. the innermost function.
+@item @var{addr}
+The @code{$pc} value for that frame.
+@item @var{func}
+Function name.
+@item @var{file}
+File name of the source file where the function lives.
+@item @var{line}
+Line number corresponding to the @code{$pc}.
+@end table
+
+If invoked without arguments, this command prints a backtrace for the
+whole stack. If given two integer arguments, it shows the frames whose
+levels are between the two arguments (inclusive). If the two arguments
+are equal, it shows the single frame at the corresponding level.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
+
+@subsubheading Example
+
+Full stack backtrace:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames
+^done,stack=
+[frame=@{level="0",addr="0x0001076c",func="foo",
+ file="recursive2.c",line="11"@},
+frame=@{level="1",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="2",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="4",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="5",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="6",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="7",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="8",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="9",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="10",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="11",addr="0x00010738",func="main",
+ file="recursive2.c",line="4"@}]
+(@value{GDBP})
+@end smallexample
+
+Show frames between @var{low_frame} and @var{high_frame}:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames 3 5
+^done,stack=
+[frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="4",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="5",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@}]
+(@value{GDBP})
+@end smallexample
+
+Show a single frame:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames 3 3
+^done,stack=
+[frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-stack-list-locals} Command
+@findex -stack-list-locals
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-locals @var{print-values}
+@end smallexample
+
+Display the local variable names for the current frame. With an
+argument of 0 prints only the names of the variables, with argument of 1
+prints also their values.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-list-locals 0
+^done,locals=[name="A",name="B",name="C"]
+(@value{GDBP})
+-stack-list-locals 1
+^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
+ @{name="C",value="3"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-stack-select-frame} Command
+@findex -stack-select-frame
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-select-frame @var{framenum}
+@end smallexample
+
+Change the current frame. Select a different frame @var{framenum} on
+the stack.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
+@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-select-frame 2
+^done
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Symbol Query
+@section @sc{gdb/mi} Symbol Query Commands
+
+
+@subheading The @code{-symbol-info-address} Command
+@findex -symbol-info-address
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-address @var{symbol}
+@end smallexample
+
+Describe where @var{symbol} is stored.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info address}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-file} Command
+@findex -symbol-info-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-file
+@end smallexample
+
+Show the file for the symbol.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command. @code{gdbtk} has
+@samp{gdb_find_file}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-function} Command
+@findex -symbol-info-function
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-function
+@end smallexample
+
+Show which function the symbol lives in.
+
+@subsubheading @value{GDBN} Command
+
+@samp{gdb_get_function} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-line} Command
+@findex -symbol-info-line
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-line
+@end smallexample
+
+Show the core addresses of the code for a source line.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} comamnd is @samp{info line}.
+@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-symbol} Command
+@findex -symbol-info-symbol
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-symbol @var{addr}
+@end smallexample
+
+Describe what symbol is at location @var{addr}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info symbol}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-functions} Command
+@findex -symbol-list-functions
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-functions
+@end smallexample
+
+List the functions in the executable.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
+@samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-types} Command
+@findex -symbol-list-types
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-types
+@end smallexample
+
+List all the type names.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding commands are @samp{info types} in @value{GDBN},
+@samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-variables} Command
+@findex -symbol-list-variables
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-variables
+@end smallexample
+
+List all the global and static variable names.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-locate} Command
+@findex -symbol-locate
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-locate
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+@samp{gdb_loc} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-type} Command
+@findex -symbol-type
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-type @var{variable}
+@end smallexample
+
+Show type of @var{variable}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
+@samp{gdb_obj_variable}.
+
+@subsubheading Example
+N.A.
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Target Manipulation
+@section @sc{gdb/mi} Target Manipulation Commands
+
+
+@subheading The @code{-target-attach} Command
+@findex -target-attach
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-attach @var{pid} | @var{file}
+@end smallexample
+
+Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{attach}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-compare-sections} Command
+@findex -target-compare-sections
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-compare-sections [ @var{section} ]
+@end smallexample
+
+Compare data of section @var{section} on target to the exec file.
+Without the argument, all sections are compared.
+
+@subsubheading @value{GDBN} Command
+
+The @value{GDBN} equivalent is @samp{compare-sections}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-detach} Command
+@findex -target-detach
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-detach
+@end smallexample
+
+Disconnect from the remote target. There's no output.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{detach}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-target-detach
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-target-download} Command
+@findex -target-download
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-download
+@end smallexample
+
+Loads the executable onto the remote target.
+It prints out an update message every half second, which includes the fields:
+
+@table @samp
+@item section
+The name of the section.
+@item section-sent
+The size of what has been sent so far for that section.
+@item section-size
+The size of the section.
+@item total-sent
+The total size of what was sent so far (the current and the previous sections).
+@item total-size
+The size of the overall executable to download.
+@end table
+
+@noindent
+Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
+@sc{gdb/mi} Output Syntax}).
+
+In addition, it prints the name and size of the sections, as they are
+downloaded. These messages include the following fields:
+
+@table @samp
+@item section
+The name of the section.
+@item section-size
+The size of the section.
+@item total-size
+The size of the overall executable to download.
+@end table
+
+@noindent
+At the end, a summary is printed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{load}.
+
+@subsubheading Example
+
+Note: each status message appears on a single line. Here the messages
+have been broken down so that they can fit onto a page.
+
+@smallexample
+(@value{GDBP})
+-target-download
++download,@{section=".text",section-size="6668",total-size="9880"@}
++download,@{section=".text",section-sent="512",section-size="6668",
+total-sent="512",total-size="9880"@}
++download,@{section=".text",section-sent="1024",section-size="6668",
+total-sent="1024",total-size="9880"@}
++download,@{section=".text",section-sent="1536",section-size="6668",
+total-sent="1536",total-size="9880"@}
++download,@{section=".text",section-sent="2048",section-size="6668",
+total-sent="2048",total-size="9880"@}
++download,@{section=".text",section-sent="2560",section-size="6668",
+total-sent="2560",total-size="9880"@}
++download,@{section=".text",section-sent="3072",section-size="6668",
+total-sent="3072",total-size="9880"@}
++download,@{section=".text",section-sent="3584",section-size="6668",
+total-sent="3584",total-size="9880"@}
++download,@{section=".text",section-sent="4096",section-size="6668",
+total-sent="4096",total-size="9880"@}
++download,@{section=".text",section-sent="4608",section-size="6668",
+total-sent="4608",total-size="9880"@}
++download,@{section=".text",section-sent="5120",section-size="6668",
+total-sent="5120",total-size="9880"@}
++download,@{section=".text",section-sent="5632",section-size="6668",
+total-sent="5632",total-size="9880"@}
++download,@{section=".text",section-sent="6144",section-size="6668",
+total-sent="6144",total-size="9880"@}
++download,@{section=".text",section-sent="6656",section-size="6668",
+total-sent="6656",total-size="9880"@}
++download,@{section=".init",section-size="28",total-size="9880"@}
++download,@{section=".fini",section-size="28",total-size="9880"@}
++download,@{section=".data",section-size="3156",total-size="9880"@}
++download,@{section=".data",section-sent="512",section-size="3156",
+total-sent="7236",total-size="9880"@}
++download,@{section=".data",section-sent="1024",section-size="3156",
+total-sent="7748",total-size="9880"@}
++download,@{section=".data",section-sent="1536",section-size="3156",
+total-sent="8260",total-size="9880"@}
++download,@{section=".data",section-sent="2048",section-size="3156",
+total-sent="8772",total-size="9880"@}
++download,@{section=".data",section-sent="2560",section-size="3156",
+total-sent="9284",total-size="9880"@}
++download,@{section=".data",section-sent="3072",section-size="3156",
+total-sent="9796",total-size="9880"@}
+^done,address="0x10004",load-size="9880",transfer-rate="6586",
+write-rate="429"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-target-exec-status} Command
+@findex -target-exec-status
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-exec-status
+@end smallexample
+
+Provide information on the state of the target (whether it is running or
+not, for instance).
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-available-targets} Command
+@findex -target-list-available-targets
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-available-targets
+@end smallexample
+
+List the possible targets to connect to.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{help target}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-current-targets} Command
+@findex -target-list-current-targets
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-current-targets
+@end smallexample
+
+Describe the current target.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding information is printed by @samp{info file} (among
+other things).
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-parameters} Command
+@findex -target-list-parameters
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-parameters
+@end smallexample
+
+@c ????
+
+@subsubheading @value{GDBN} Command
+
+No equivalent.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-select} Command
+@findex -target-select
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-select @var{type} @var{parameters @dots{}}
+@end smallexample
+
+Connect @value{GDBN} to the remote target. This command takes two args:
+
+@table @samp
+@item @var{type}
+The type of target, for instance @samp{async}, @samp{remote}, etc.
+@item @var{parameters}
+Device names, host names and the like. @xref{Target Commands, ,
+Commands for managing targets}, for more details.
+@end table
+
+The output is a connection notification, followed by the address at
+which the target program is, in the following form:
+
+@smallexample
+^connected,addr="@var{address}",func="@var{function name}",
+ args=[@var{arg list}]
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{target}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-target-select async /dev/ttya
+^connected,addr="0xfe00a300",func="??",args=[]
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Thread Commands
+@section @sc{gdb/mi} Thread Commands
+
+
+@subheading The @code{-thread-info} Command
+@findex -thread-info
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-info
+@end smallexample
+
+@subsubheading @value{GDBN} command
+
+No equivalent.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-thread-list-all-threads} Command
+@findex -thread-list-all-threads
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-list-all-threads
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The equivalent @value{GDBN} command is @samp{info threads}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-thread-list-ids} Command
+@findex -thread-list-ids
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-list-ids
+@end smallexample
+
+Produces a list of the currently known @value{GDBN} thread ids. At the
+end of the list it also prints the total number of such threads.
+
+@subsubheading @value{GDBN} Command
+
+Part of @samp{info threads} supplies the same information.
+
+@subsubheading Example
+
+No threads present, besides the main process:
+
+@smallexample
+(@value{GDBP})
+-thread-list-ids
+^done,thread-ids=@{@},number-of-threads="0"
+(@value{GDBP})
+@end smallexample
+
+
+Several threads:
+
+@smallexample
+(@value{GDBP})
+-thread-list-ids
+^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
+number-of-threads="3"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-thread-select} Command
+@findex -thread-select
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-select @var{threadnum}
+@end smallexample
+
+Make @var{threadnum} the current thread. It prints the number of the new
+current thread, and the topmost frame for that thread.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{thread}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-next
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",thread-id="2",line="187",
+file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
+(@value{GDBP})
+-thread-list-ids
+^done,
+thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
+number-of-threads="3"
+(@value{GDBP})
+-thread-select 3
+^done,new-thread-id="3",
+frame=@{level="0",func="vprintf",
+args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Tracepoint Commands
+@section @sc{gdb/mi} Tracepoint Commands
+
+The tracepoint commands are not yet implemented.
+
+@c @subheading -trace-actions
+
+@c @subheading -trace-delete
+
+@c @subheading -trace-disable
+
+@c @subheading -trace-dump
+
+@c @subheading -trace-enable
+
+@c @subheading -trace-exists
+
+@c @subheading -trace-find
+
+@c @subheading -trace-frame-number
+
+@c @subheading -trace-info
+
+@c @subheading -trace-insert
+
+@c @subheading -trace-list
+
+@c @subheading -trace-pass-count
+
+@c @subheading -trace-save
+
+@c @subheading -trace-start
+
+@c @subheading -trace-stop
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Variable Objects
+@section @sc{gdb/mi} Variable Objects
+
+
+@subheading Motivation for Variable Objects in @sc{gdb/mi}
+
+For the implementation of a variable debugger window (locals, watched
+expressions, etc.), we are proposing the adaptation of the existing code
+used by @code{Insight}.
+
+The two main reasons for that are:
+
+@enumerate 1
+@item
+It has been proven in practice (it is already on its second generation).
+
+@item
+It will shorten development time (needless to say how important it is
+now).
+@end enumerate
+
+The original interface was designed to be used by Tcl code, so it was
+slightly changed so it could be used through @sc{gdb/mi}. This section
+describes the @sc{gdb/mi} operations that will be available and gives some
+hints about their use.
+
+@emph{Note}: In addition to the set of operations described here, we
+expect the @sc{gui} implementation of a variable window to require, at
+least, the following operations:
+
+@itemize @bullet
+@item @code{-gdb-show} @code{output-radix}
+@item @code{-stack-list-arguments}
+@item @code{-stack-list-locals}
+@item @code{-stack-select-frame}
+@end itemize
+
+@subheading Introduction to Variable Objects in @sc{gdb/mi}
+
+@cindex variable objects in @sc{gdb/mi}
+The basic idea behind variable objects is the creation of a named object
+to represent a variable, an expression, a memory location or even a CPU
+register. For each object created, a set of operations is available for
+examining or changing its properties.
+
+Furthermore, complex data types, such as C structures, are represented
+in a tree format. For instance, the @code{struct} type variable is the
+root and the children will represent the struct members. If a child
+is itself of a complex type, it will also have children of its own.
+Appropriate language differences are handled for C, C@t{++} and Java.
+
+When returning the actual values of the objects, this facility allows
+for the individual selection of the display format used in the result
+creation. It can be chosen among: binary, decimal, hexadecimal, octal
+and natural. Natural refers to a default format automatically
+chosen based on the variable type (like decimal for an @code{int}, hex
+for pointers, etc.).
+
+The following is the complete set of @sc{gdb/mi} operations defined to
+access this functionality:
+
+@multitable @columnfractions .4 .6
+@item @strong{Operation}
+@tab @strong{Description}
+
+@item @code{-var-create}
+@tab create a variable object
+@item @code{-var-delete}
+@tab delete the variable object and its children
+@item @code{-var-set-format}
+@tab set the display format of this variable
+@item @code{-var-show-format}
+@tab show the display format of this variable
+@item @code{-var-info-num-children}
+@tab tells how many children this object has
+@item @code{-var-list-children}
+@tab return a list of the object's children
+@item @code{-var-info-type}
+@tab show the type of this variable object
+@item @code{-var-info-expression}
+@tab print what this variable object represents
+@item @code{-var-show-attributes}
+@tab is this variable editable? does it exist here?
+@item @code{-var-evaluate-expression}
+@tab get the value of this variable
+@item @code{-var-assign}
+@tab set the value of this variable
+@item @code{-var-update}
+@tab update the variable and its children
+@end multitable
+
+In the next subsection we describe each operation in detail and suggest
+how it can be used.
+
+@subheading Description And Use of Operations on Variable Objects
+
+@subheading The @code{-var-create} Command
+@findex -var-create
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-create @{@var{name} | "-"@}
+ @{@var{frame-addr} | "*"@} @var{expression}
+@end smallexample
+
+This operation creates a variable object, which allows the monitoring of
+a variable, the result of an expression, a memory cell or a CPU
+register.
+
+The @var{name} parameter is the string by which the object can be
+referenced. It must be unique. If @samp{-} is specified, the varobj
+system will generate a string ``varNNNNNN'' automatically. It will be
+unique provided that one does not specify @var{name} on that format.
+The command fails if a duplicate name is found.
+
+The frame under which the expression should be evaluated can be
+specified by @var{frame-addr}. A @samp{*} indicates that the current
+frame should be used.
+
+@var{expression} is any expression valid on the current language set (must not
+begin with a @samp{*}), or one of the following:
+
+@itemize @bullet
+@item
+@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
+
+@item
+@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
+
+@item
+@samp{$@var{regname}} --- a CPU register name
+@end itemize
+
+@subsubheading Result
+
+This operation returns the name, number of children and the type of the
+object created. Type is returned as a string as the ones generated by
+the @value{GDBN} CLI:
+
+@smallexample
+ name="@var{name}",numchild="N",type="@var{type}"
+@end smallexample
+
+
+@subheading The @code{-var-delete} Command
+@findex -var-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-delete @var{name}
+@end smallexample
+
+Deletes a previously created variable object and all of its children.
+
+Returns an error if the object @var{name} is not found.
+
+
+@subheading The @code{-var-set-format} Command
+@findex -var-set-format
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-set-format @var{name} @var{format-spec}
+@end smallexample
+
+Sets the output format for the value of the object @var{name} to be
+@var{format-spec}.
+
+The syntax for the @var{format-spec} is as follows:
+
+@smallexample
+ @var{format-spec} @expansion{}
+ @{binary | decimal | hexadecimal | octal | natural@}
+@end smallexample
+
+
+@subheading The @code{-var-show-format} Command
+@findex -var-show-format
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-show-format @var{name}
+@end smallexample
+
+Returns the format used to display the value of the object @var{name}.
+
+@smallexample
+ @var{format} @expansion{}
+ @var{format-spec}
+@end smallexample
+
+
+@subheading The @code{-var-info-num-children} Command
+@findex -var-info-num-children
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-num-children @var{name}
+@end smallexample
+
+Returns the number of children of a variable object @var{name}:
+
+@smallexample
+ numchild=@var{n}
+@end smallexample
+
+
+@subheading The @code{-var-list-children} Command
+@findex -var-list-children
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-list-children @var{name}
+@end smallexample
+
+Returns a list of the children of the specified variable object:
+
+@smallexample
+ numchild=@var{n},children=[@{name=@var{name},
+ numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
+@end smallexample
+
+
+@subheading The @code{-var-info-type} Command
+@findex -var-info-type
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-type @var{name}
+@end smallexample
+
+Returns the type of the specified variable @var{name}. The type is
+returned as a string in the same format as it is output by the
+@value{GDBN} CLI:
+
+@smallexample
+ type=@var{typename}
+@end smallexample
+
+
+@subheading The @code{-var-info-expression} Command
+@findex -var-info-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-expression @var{name}
+@end smallexample
+
+Returns what is represented by the variable object @var{name}:
+
+@smallexample
+ lang=@var{lang-spec},exp=@var{expression}
+@end smallexample
+
+@noindent
+where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
+
+@subheading The @code{-var-show-attributes} Command
+@findex -var-show-attributes
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-show-attributes @var{name}
+@end smallexample
+
+List attributes of the specified variable object @var{name}:
+
+@smallexample
+ status=@var{attr} [ ( ,@var{attr} )* ]
+@end smallexample
+
+@noindent
+where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
+
+@subheading The @code{-var-evaluate-expression} Command
+@findex -var-evaluate-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-evaluate-expression @var{name}
+@end smallexample
+
+Evaluates the expression that is represented by the specified variable
+object and returns its value as a string in the current format specified
+for the object:
+
+@smallexample
+ value=@var{value}
+@end smallexample
+
+Note that one must invoke @code{-var-list-children} for a variable
+before the value of a child variable can be evaluated.
+
+@subheading The @code{-var-assign} Command
+@findex -var-assign
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-assign @var{name} @var{expression}
+@end smallexample
+
+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
+subsequent @code{-var-update} list.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-var-assign var1 3
+^done,value="3"
+(@value{GDBP})
+-var-update *
+^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-var-update} Command
+@findex -var-update
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-update @{@var{name} | "*"@}
+@end smallexample
+
+Update the value of the variable object @var{name} by evaluating its
+expression after fetching all the new values from memory or registers.
+A @samp{*} causes all existing variable objects to be updated.
+
+
+@node Annotations
+@chapter @value{GDBN} Annotations
+
+This chapter describes annotations in @value{GDBN}. Annotations are
+designed to interface @value{GDBN} to graphical user interfaces or
+other similar programs which want to interact with @value{GDBN} at a
+relatively high level.
+
+@ignore
+This is Edition @value{EDITION}, @value{DATE}.
+@end ignore
+
+@menu
+* Annotations Overview:: What annotations are; the general syntax.
+* Server Prefix:: Issuing a command without affecting user state.
+* Value Annotations:: Values are marked as such.
+* Frame Annotations:: Stack frames are annotated.
+* Displays:: @value{GDBN} can be told to display something periodically.
+* Prompting:: Annotations marking @value{GDBN}'s need for input.
+* Errors:: Annotations for error messages.
+* Breakpoint Info:: Information on breakpoints.
+* Invalidation:: Some annotations describe things now invalid.
+* Annotations for Running::
+ Whether the program is running, how it stopped, etc.
+* Source Annotations:: Annotations describing source code.
+* TODO:: Annotations which might be added in the future.
+@end menu
+
+@node Annotations Overview
+@section What is an Annotation?
+@cindex annotations
+
+To produce annotations, start @value{GDBN} with the @code{--annotate=2} option.
+
+Annotations start with a newline character, two @samp{control-z}
+characters, and the name of the annotation. If there is no additional
+information associated with this annotation, the name of the annotation
+is followed immediately by a newline. If there is additional
+information, the name of the annotation is followed by a space, the
+additional information, and a newline. The additional information
+cannot contain newline characters.
+
+Any output not beginning with a newline and two @samp{control-z}
+characters denotes literal output from @value{GDBN}. Currently there is
+no need for @value{GDBN} to output a newline followed by two
+@samp{control-z} characters, but if there was such a need, the
+annotations could be extended with an @samp{escape} annotation which
+means those three characters as output.
+
+A simple example of starting up @value{GDBN} with annotations is:
+
+@smallexample
+$ gdb --annotate=2
+GNU GDB 5.0
+Copyright 2000 Free Software Foundation, Inc.
+GDB is free software, covered by the GNU General Public License,
+and you are welcome to change it and/or distribute copies of it
+under certain conditions.
+Type "show copying" to see the conditions.
+There is absolutely no warranty for GDB. Type "show warranty"
+for details.
+This GDB was configured as "sparc-sun-sunos4.1.3"
+
+^Z^Zpre-prompt
+(gdb)
+^Z^Zprompt
+quit
+
+^Z^Zpost-prompt
+$
+@end smallexample
+
+Here @samp{quit} is input to @value{GDBN}; the rest is output from
+@value{GDBN}. The three lines beginning @samp{^Z^Z} (where @samp{^Z}
+denotes a @samp{control-z} character) are annotations; the rest is
+output from @value{GDBN}.
+
+@node Server Prefix
+@section The Server Prefix
+@cindex server prefix for annotations
+
+To issue a command to @value{GDBN} without affecting certain aspects of
+the state which is seen by users, prefix it with @samp{server }. This
+means that this command will not affect the command history, nor will it
+affect @value{GDBN}'s notion of which command to repeat if @key{RET} is
+pressed on a line by itself.
+
+The server prefix does not affect the recording of values into the value
+history; to print a value without recording it into the value history,
+use the @code{output} command instead of the @code{print} command.
+
+@node Value Annotations
+@section Values
+
+@cindex annotations for values
+When a value is printed in various contexts, @value{GDBN} uses
+annotations to delimit the value from the surrounding text.
+
+@findex value-history-begin
+@findex value-history-value
+@findex value-history-end
+If a value is printed using @code{print} and added to the value history,
+the annotation looks like
+
+@smallexample
+^Z^Zvalue-history-begin @var{history-number} @var{value-flags}
+@var{history-string}
+^Z^Zvalue-history-value
+@var{the-value}
+^Z^Zvalue-history-end
+@end smallexample
+
+@noindent
+where @var{history-number} is the number it is getting in the value
+history, @var{history-string} is a string, such as @samp{$5 = }, which
+introduces the value to the user, @var{the-value} is the output
+corresponding to the value itself, and @var{value-flags} is @samp{*} for
+a value which can be dereferenced and @samp{-} for a value which cannot.
+
+@findex value-begin
+@findex value-end
+If the value is not added to the value history (it is an invalid float
+or it is printed with the @code{output} command), the annotation is similar:
+
+@smallexample
+^Z^Zvalue-begin @var{value-flags}
+@var{the-value}
+^Z^Zvalue-end
+@end smallexample
+
+@findex arg-begin
+@findex arg-name-end
+@findex arg-value
+@findex arg-end
+When @value{GDBN} prints an argument to a function (for example, in the output
+from the @code{backtrace} command), it annotates it as follows:
+
+@smallexample
+^Z^Zarg-begin
+@var{argument-name}
+^Z^Zarg-name-end
+@var{separator-string}
+^Z^Zarg-value @var{value-flags}
+@var{the-value}
+^Z^Zarg-end
+@end smallexample
+
+@noindent
+where @var{argument-name} is the name of the argument,
+@var{separator-string} is text which separates the name from the value
+for the user's benefit (such as @samp{=}), and @var{value-flags} and
+@var{the-value} have the same meanings as in a
+@code{value-history-begin} annotation.
+
+@findex field-begin
+@findex field-name-end
+@findex field-value
+@findex field-end
+When printing a structure, @value{GDBN} annotates it as follows:
+
+@smallexample
+^Z^Zfield-begin @var{value-flags}
+@var{field-name}
+^Z^Zfield-name-end
+@var{separator-string}
+^Z^Zfield-value
+@var{the-value}
+^Z^Zfield-end
+@end smallexample
+
+@noindent
+where @var{field-name} is the name of the field, @var{separator-string}
+is text which separates the name from the value for the user's benefit
+(such as @samp{=}), and @var{value-flags} and @var{the-value} have the
+same meanings as in a @code{value-history-begin} annotation.
+
+When printing an array, @value{GDBN} annotates it as follows:
+
+@smallexample
+^Z^Zarray-section-begin @var{array-index} @var{value-flags}
+@end smallexample
+
+@noindent
+where @var{array-index} is the index of the first element being
+annotated and @var{value-flags} has the same meaning as in a
+@code{value-history-begin} annotation. This is followed by any number
+of elements, where is element can be either a single element:
+
+@findex elt
+@smallexample
+@samp{,} @var{whitespace} ; @r{omitted for the first element}
+@var{the-value}
+^Z^Zelt
+@end smallexample
+
+or a repeated element
+
+@findex elt-rep
+@findex elt-rep-end
+@smallexample
+@samp{,} @var{whitespace} ; @r{omitted for the first element}
+@var{the-value}
+^Z^Zelt-rep @var{number-of-repetitions}
+@var{repetition-string}
+^Z^Zelt-rep-end
+@end smallexample
+
+In both cases, @var{the-value} is the output for the value of the
+element and @var{whitespace} can contain spaces, tabs, and newlines. In
+the repeated case, @var{number-of-repetitions} is the number of
+consecutive array elements which contain that value, and
+@var{repetition-string} is a string which is designed to convey to the
+user that repetition is being depicted.
+
+@findex array-section-end
+Once all the array elements have been output, the array annotation is
+ended with
+
+@smallexample
+^Z^Zarray-section-end
+@end smallexample
+
+@node Frame Annotations
+@section Frames
+
+@cindex annotations for frames
+Whenever @value{GDBN} prints a frame, it annotates it. For example, this applies
+to frames printed when @value{GDBN} stops, output from commands such as
+@code{backtrace} or @code{up}, etc.
+
+@findex frame-begin
+The frame annotation begins with
+
+@smallexample
+^Z^Zframe-begin @var{level} @var{address}
+@var{level-string}
+@end smallexample
+
+@noindent
+where @var{level} is the number of the frame (0 is the innermost frame,
+and other frames have positive numbers), @var{address} is the address of
+the code executing in that frame, and @var{level-string} is a string
+designed to convey the level to the user. @var{address} is in the form
+@samp{0x} followed by one or more lowercase hex digits (note that this
+does not depend on the language). The frame ends with
+
+@findex frame-end
+@smallexample
+^Z^Zframe-end
+@end smallexample
+
+Between these annotations is the main body of the frame, which can
+consist of
+
+@itemize @bullet
+@item
+@findex function-call
+@smallexample
+^Z^Zfunction-call
+@var{function-call-string}
+@end smallexample
+
+where @var{function-call-string} is text designed to convey to the user
+that this frame is associated with a function call made by @value{GDBN} to a
+function in the program being debugged.
+
+@item
+@findex signal-handler-caller
+@smallexample
+^Z^Zsignal-handler-caller
+@var{signal-handler-caller-string}
+@end smallexample
+
+where @var{signal-handler-caller-string} is text designed to convey to
+the user that this frame is associated with whatever mechanism is used
+by this operating system to call a signal handler (it is the frame which
+calls the signal handler, not the frame for the signal handler itself).
+
+@item
+A normal frame.
+
+@findex frame-address
+@findex frame-address-end
+This can optionally (depending on whether this is thought of as
+interesting information for the user to see) begin with
+
+@smallexample
+^Z^Zframe-address
+@var{address}
+^Z^Zframe-address-end
+@var{separator-string}
+@end smallexample
+
+where @var{address} is the address executing in the frame (the same
+address as in the @code{frame-begin} annotation, but printed in a form
+which is intended for user consumption---in particular, the syntax varies
+depending on the language), and @var{separator-string} is a string
+intended to separate this address from what follows for the user's
+benefit.
+
+@findex frame-function-name
+@findex frame-args
+Then comes
+
+@smallexample
+^Z^Zframe-function-name
+@var{function-name}
+^Z^Zframe-args
+@var{arguments}
+@end smallexample
+
+where @var{function-name} is the name of the function executing in the
+frame, or @samp{??} if not known, and @var{arguments} are the arguments
+to the frame, with parentheses around them (each argument is annotated
+individually as well, @pxref{Value Annotations}).
+
+@findex frame-source-begin
+@findex frame-source-file
+@findex frame-source-file-end
+@findex frame-source-line
+@findex frame-source-end
+If source information is available, a reference to it is then printed:
+
+@smallexample
+^Z^Zframe-source-begin
+@var{source-intro-string}
+^Z^Zframe-source-file
+@var{filename}
+^Z^Zframe-source-file-end
+:
+^Z^Zframe-source-line
+@var{line-number}
+^Z^Zframe-source-end
+@end smallexample
+
+where @var{source-intro-string} separates for the user's benefit the
+reference from the text which precedes it, @var{filename} is the name of
+the source file, and @var{line-number} is the line number within that
+file (the first line is line 1).
+
+@findex frame-where
+If @value{GDBN} prints some information about where the frame is from (which
+library, which load segment, etc.; currently only done on the RS/6000),
+it is annotated with
+
+@smallexample
+^Z^Zframe-where
+@var{information}
+@end smallexample
+
+Then, if source is to actually be displayed for this frame (for example,
+this is not true for output from the @code{backtrace} command), then a
+@code{source} annotation (@pxref{Source Annotations}) is displayed. Unlike
+most annotations, this is output instead of the normal text which would be
+output, not in addition.
+@end itemize
+
+@node Displays
+@section Displays
+
+@findex display-begin
+@findex display-number-end
+@findex display-format
+@findex display-expression
+@findex display-expression-end
+@findex display-value
+@findex display-end
+@cindex annotations for display
+When @value{GDBN} is told to display something using the @code{display} command,
+the results of the display are annotated:
+
+@smallexample
+^Z^Zdisplay-begin
+@var{number}
+^Z^Zdisplay-number-end
+@var{number-separator}
+^Z^Zdisplay-format
+@var{format}
+^Z^Zdisplay-expression
+@var{expression}
+^Z^Zdisplay-expression-end
+@var{expression-separator}
+^Z^Zdisplay-value
+@var{value}
+^Z^Zdisplay-end
+@end smallexample
+
+@noindent
+where @var{number} is the number of the display, @var{number-separator}
+is intended to separate the number from what follows for the user,
+@var{format} includes information such as the size, format, or other
+information about how the value is being displayed, @var{expression} is
+the expression being displayed, @var{expression-separator} is intended
+to separate the expression from the text that follows for the user,
+and @var{value} is the actual value being displayed.
+
+@node Prompting
+@section Annotation for @value{GDBN} Input
+
+@cindex annotations for prompts
+When @value{GDBN} prompts for input, it annotates this fact so it is possible
+to know when to send output, when the output from a given command is
+over, etc.
+
+Different kinds of input each have a different @dfn{input type}. Each
+input type has three annotations: a @code{pre-} annotation, which
+denotes the beginning of any prompt which is being output, a plain
+annotation, which denotes the end of the prompt, and then a @code{post-}
+annotation which denotes the end of any echo which may (or may not) be
+associated with the input. For example, the @code{prompt} input type
+features the following annotations:
+
+@smallexample
+^Z^Zpre-prompt
+^Z^Zprompt
+^Z^Zpost-prompt
+@end smallexample
+
+The input types are
+
+@table @code
+@findex pre-prompt
+@findex prompt
+@findex post-prompt
+@item prompt
+When @value{GDBN} is prompting for a command (the main @value{GDBN} prompt).
+
+@findex pre-commands
+@findex commands
+@findex post-commands
+@item commands
+When @value{GDBN} prompts for a set of commands, like in the @code{commands}
+command. The annotations are repeated for each command which is input.
+
+@findex pre-overload-choice
+@findex overload-choice
+@findex post-overload-choice
+@item overload-choice
+When @value{GDBN} wants the user to select between various overloaded functions.
+
+@findex pre-query
+@findex query
+@findex post-query
+@item query
+When @value{GDBN} wants the user to confirm a potentially dangerous operation.
+
+@findex pre-prompt-for-continue
+@findex prompt-for-continue
+@findex post-prompt-for-continue
+@item prompt-for-continue
+When @value{GDBN} is asking the user to press return to continue. Note: Don't
+expect this to work well; instead use @code{set height 0} to disable
+prompting. This is because the counting of lines is buggy in the
+presence of annotations.
+@end table
+
+@node Errors
+@section Errors
+@cindex annotations for errors, warnings and interrupts
+
+@findex quit
+@smallexample
+^Z^Zquit
+@end smallexample
+
+This annotation occurs right before @value{GDBN} responds to an interrupt.
+
+@findex error
+@smallexample
+^Z^Zerror
+@end smallexample
+
+This annotation occurs right before @value{GDBN} responds to an error.
+
+Quit and error annotations indicate that any annotations which @value{GDBN} was
+in the middle of may end abruptly. For example, if a
+@code{value-history-begin} annotation is followed by a @code{error}, one
+cannot expect to receive the matching @code{value-history-end}. One
+cannot expect not to receive it either, however; an error annotation
+does not necessarily mean that @value{GDBN} is immediately returning all the way
+to the top level.
+
+@findex error-begin
+A quit or error annotation may be preceded by
+
+@smallexample
+^Z^Zerror-begin
+@end smallexample
+
+Any output between that and the quit or error annotation is the error
+message.
+
+Warning messages are not yet annotated.
+@c If we want to change that, need to fix warning(), type_error(),
+@c range_error(), and possibly other places.
+
+@node Breakpoint Info
+@section Information on Breakpoints
+
+@cindex annotations for breakpoints
+The output from the @code{info breakpoints} command is annotated as follows:
+
+@findex breakpoints-headers
+@findex breakpoints-table
+@smallexample
+^Z^Zbreakpoints-headers
+@var{header-entry}
+^Z^Zbreakpoints-table
+@end smallexample
+
+@noindent
+where @var{header-entry} has the same syntax as an entry (see below) but
+instead of containing data, it contains strings which are intended to
+convey the meaning of each field to the user. This is followed by any
+number of entries. If a field does not apply for this entry, it is
+omitted. Fields may contain trailing whitespace. Each entry consists
+of:
+
+@findex record
+@findex field
+@smallexample
+^Z^Zrecord
+^Z^Zfield 0
+@var{number}
+^Z^Zfield 1
+@var{type}
+^Z^Zfield 2
+@var{disposition}
+^Z^Zfield 3
+@var{enable}
+^Z^Zfield 4
+@var{address}
+^Z^Zfield 5
+@var{what}
+^Z^Zfield 6
+@var{frame}
+^Z^Zfield 7
+@var{condition}
+^Z^Zfield 8
+@var{ignore-count}
+^Z^Zfield 9
+@var{commands}
+@end smallexample
+
+Note that @var{address} is intended for user consumption---the syntax
+varies depending on the language.
+
+The output ends with
+
+@findex breakpoints-table-end
+@smallexample
+^Z^Zbreakpoints-table-end
+@end smallexample
+
+@node Invalidation
+@section Invalidation Notices
+
+@cindex annotations for invalidation messages
+The following annotations say that certain pieces of state may have
+changed.
+
+@table @code
+@findex frames-invalid
+@item ^Z^Zframes-invalid
+
+The frames (for example, output from the @code{backtrace} command) may
+have changed.
+
+@findex breakpoints-invalid
+@item ^Z^Zbreakpoints-invalid
+
+The breakpoints may have changed. For example, the user just added or
+deleted a breakpoint.
+@end table
+
+@node Annotations for Running
+@section Running the Program
+@cindex annotations for running programs
+
+@findex starting
+@findex stopping
+When the program starts executing due to a @value{GDBN} command such as
+@code{step} or @code{continue},
+
+@smallexample
+^Z^Zstarting
+@end smallexample
+
+is output. When the program stops,
+
+@smallexample
+^Z^Zstopped
+@end smallexample
+
+is output. Before the @code{stopped} annotation, a variety of
+annotations describe how the program stopped.
+
+@table @code
+@findex exited
+@item ^Z^Zexited @var{exit-status}
+The program exited, and @var{exit-status} is the exit status (zero for
+successful exit, otherwise nonzero).
+
+@findex signalled
+@findex signal-name
+@findex signal-name-end
+@findex signal-string
+@findex signal-string-end
+@item ^Z^Zsignalled
+The program exited with a signal. After the @code{^Z^Zsignalled}, the
+annotation continues:
+
+@smallexample
+@var{intro-text}
+^Z^Zsignal-name
+@var{name}
+^Z^Zsignal-name-end
+@var{middle-text}
+^Z^Zsignal-string
+@var{string}
+^Z^Zsignal-string-end
+@var{end-text}
+@end smallexample
+
+@noindent
+where @var{name} is the name of the signal, such as @code{SIGILL} or
+@code{SIGSEGV}, and @var{string} is the explanation of the signal, such
+as @code{Illegal Instruction} or @code{Segmentation fault}.
+@var{intro-text}, @var{middle-text}, and @var{end-text} are for the
+user's benefit and have no particular format.
+
+@findex signal
+@item ^Z^Zsignal
+The syntax of this annotation is just like @code{signalled}, but @value{GDBN} is
+just saying that the program received the signal, not that it was
+terminated with it.
+
+@findex breakpoint
+@item ^Z^Zbreakpoint @var{number}
+The program hit breakpoint number @var{number}.
+
+@findex watchpoint
+@item ^Z^Zwatchpoint @var{number}
+The program hit watchpoint number @var{number}.
+@end table
+
+@node Source Annotations
+@section Displaying Source
+@cindex annotations for source display
+
+@findex source
+The following annotation is used instead of displaying source code:
+
+@smallexample
+^Z^Zsource @var{filename}:@var{line}:@var{character}:@var{middle}:@var{addr}
+@end smallexample
+
+where @var{filename} is an absolute file name indicating which source
+file, @var{line} is the line number within that file (where 1 is the
+first line in the file), @var{character} is the character position
+within the file (where 0 is the first character in the file) (for most
+debug formats this will necessarily point to the beginning of a line),
+@var{middle} is @samp{middle} if @var{addr} is in the middle of the
+line, or @samp{beg} if @var{addr} is at the beginning of the line, and
+@var{addr} is the address in the target program associated with the
+source which is being displayed. @var{addr} is in the form @samp{0x}
+followed by one or more lowercase hex digits (note that this does not
+depend on the language).
+
+@node TODO
+@section Annotations We Might Want in the Future
+
+@format
+ - target-invalid
+ the target might have changed (registers, heap contents, or
+ execution status). For performance, we might eventually want
+ to hit `registers-invalid' and `all-registers-invalid' with
+ greater precision
+
+ - systematic annotation for set/show parameters (including
+ invalidation notices).
+
+ - similarly, `info' returns a list of candidates for invalidation
+ notices.
+@end format
@node GDB Bugs
@chapter Reporting Bugs in @value{GDBN}
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 0522d72..9df6edf 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -3084,11 +3084,6 @@ custom breakpoint insertion and removal routines if
@code{BREAKPOINT_FROM_PC} needs to read the target's memory for some
reason.
-@item CALL_DUMMY_P
-@findex CALL_DUMMY_P
-A C expression that is non-zero when the target supports inferior function
-calls.
-
@item CALL_DUMMY_WORDS
@findex CALL_DUMMY_WORDS
Pointer to an array of @code{LONGEST} words of data containing
@@ -3101,8 +3096,8 @@ data.
@item SIZEOF_CALL_DUMMY_WORDS
@findex SIZEOF_CALL_DUMMY_WORDS
-The size of @code{CALL_DUMMY_WORDS}. When @code{CALL_DUMMY_P} this must
-return a positive value. See also @code{CALL_DUMMY_LENGTH}.
+The size of @code{CALL_DUMMY_WORDS}. This must return a positive value.
+See also @code{CALL_DUMMY_LENGTH}.
@item CALL_DUMMY
@findex CALL_DUMMY
@@ -3115,7 +3110,7 @@ See the file @file{inferior.h}.
@item DEPRECATED_CALL_DUMMY_STACK_ADJUST
@findex DEPRECATED_CALL_DUMMY_STACK_ADJUST
Stack adjustment needed when performing an inferior function call. This
-function is no longer needed. @xref{PUSH_ARGUMENTS}, which can handle
+function is no longer needed. @xref{push_dummy_call}, which can handle
all alignment directly.
@item CANNOT_FETCH_REGISTER (@var{regno})
@@ -3703,14 +3698,21 @@ definition is only used in generic code when parsing "$ps".)
If defined, used by @code{frame_pop} to remove a stack frame. This
method has been superseeded by generic code.
-@item PUSH_ARGUMENTS (@var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
-@findex PUSH_ARGUMENTS
-@anchor{PUSH_ARGUMENTS}
-Define this to push arguments onto the stack for inferior function
-call. Returns the updated stack pointer value.
+@item push_dummy_call (@var{gdbarch}, @var{regcache}, @var{dummy_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
+@findex push_dummy_call
+@findex DEPRECATED_PUSH_ARGUMENTS.
+@anchor{push_dummy_call}
+Define this to push the dummy frame's call to the inferior function onto
+the stack. In addition to pushing @var{nargs}, the code should push
+@var{struct_addr} (when @var{struct_return}), and the return value (in
+the call dummy at @var{dummy_addr}).
+
+Returns the updated top-of-stack pointer.
-@item PUSH_DUMMY_FRAME
-@findex PUSH_DUMMY_FRAME
+This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}.
+
+@item DEPRECATED_PUSH_DUMMY_FRAME
+@findex DEPRECATED_PUSH_DUMMY_FRAME
Used in @samp{call_function_by_hand} to create an artificial stack frame.
@item REGISTER_BYTES
@@ -3770,10 +3772,8 @@ that is at the start of the real function.
@item SP_REGNUM
@findex SP_REGNUM
If the stack-pointer is kept in a register, then define this macro to be
-the number (greater than or equal to zero) of that register.
-
-This should only need to be defined if @code{TARGET_WRITE_SP} and
-@code{TARGET_WRITE_SP} are not defined.
+the number (greater than or equal to zero) of that register, or -1 if
+there is no such register.
@item STAB_REG_TO_REGNUM
@findex STAB_REG_TO_REGNUM
@@ -3880,19 +3880,16 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}.
@findex TARGET_WRITE_PC
@itemx TARGET_READ_SP
@findex TARGET_READ_SP
-@itemx TARGET_WRITE_SP
-@findex TARGET_WRITE_SP
@itemx TARGET_READ_FP
@findex TARGET_READ_FP
@findex read_pc
@findex write_pc
@findex read_sp
-@findex write_sp
@findex read_fp
These change the behavior of @code{read_pc}, @code{write_pc},
-@code{read_sp}, @code{write_sp} and @code{read_fp}. For most targets,
-these may be left undefined. @value{GDBN} will call the read and write
-register functions with the relevant @code{_REGNUM} argument.
+@code{read_sp} and @code{read_fp}. For most targets, these may be left
+undefined. @value{GDBN} will call the read and write register functions
+with the relevant @code{_REGNUM} argument.
These macros are useful when a target keeps one of these registers in a
hard to get at place; for example, part in a segment register and part
diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index a967f32..de48a19 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -12,7 +12,7 @@ notifications, the observer attaches a callback to the subject.
One subject can have several observers.
@file{observer.c} implements an internal generic low-level event
-notification mechanism. This generic event notification mechansim is
+notification mechanism. This generic event notification mechanism is
then re-used to implement the exported high-level notification
management routines for all possible notifications.
@@ -27,7 +27,7 @@ as it lacks a mechanism that would deallocate this data when the
callback is detached. This is not a problem so far, as this contextual
data is only used internally to hold a function pointer. Later on, if
a certain observer needs to provide support for user-level contextual
-data, then the generic notification mechanism will need need to be
+data, then the generic notification mechanism will need to be
enhanced to allow the observer to provide a routine to deallocate the
data when attaching the callback.
@@ -39,10 +39,16 @@ or detach routines during a notification.
@cindex @code{normal_stop} observer
@cindex notification about inferior execution stop
-@value{GDBN} will notify all @code{normal_stop} observers when the
-inferior execution has just stopped, and all the associated internal
-processing (such as breakpoint commands, annotations, etc) is about to
-be performed before the @value{GDBN} prompt is returned to the user.
+@value{GDBN} notifies all @code{normal_stop} observers when the
+inferior execution has just stopped, the associated messages and
+annotations have been printed, and the control is about to be returned
+to the user.
+
+Note that the @code{normal_stop} notification is not emitted when
+the execution stops due to a breakpoint, and this breakpoint has
+a condition that is not met. If the breakpoint has any associated
+commands list, the commands are executed after the notification
+is emitted.
The following interface is available to manage @code{normal_stop}
observers:
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 3f7746f..f088405 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -294,17 +294,6 @@ generic_pop_dummy_frame (void)
discard_innermost_dummy (&dummy_frame_stack);
}
-/* Function: fix_call_dummy
- Stub function. Generic dummy frames typically do not need to fix
- the frame being created */
-
-void
-generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
- struct value **args, struct type *type, int gcc_p)
-{
- return;
-}
-
/* Given a call-dummy dummy-frame, return the registers. Here the
register value is taken from the local copy of the register buffer. */
@@ -368,7 +357,7 @@ dummy_frame_this_id (struct frame_info *next_frame,
just asking for trouble. */
if (gdbarch_unwind_dummy_id_p (current_gdbarch))
{
- /* Assume hand_function_call(), via SAVE_DUMMY_FRAME_TOS,
+ /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
previously saved the dummy frame's ID. Things only work if
the two return the same value. */
gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index d1a4bc8..bb41e8d 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -41,8 +41,8 @@ struct frame_id;
zero, and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember
to define PUSH_RETURN_ADDRESS, because no call instruction will be
being executed by the target. Also DEPRECATED_FRAME_CHAIN_VALID as
- generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as
- generic_fix_call_dummy. */
+ generic_{file,func}_frame_chain_valid and do not set
+ FIX_CALL_DUMMY. */
/* If the PC falls in a dummy frame, return a dummy frame
unwinder. */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 6d4e7f9..2a4eac3 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -473,6 +473,7 @@ const struct language_defn f_language_defn =
f_val_print, /* Print a value using appropriate syntax */
c_value_print, /* FIXME */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%o", "0", "o", ""}, /* Octal format info */
{"%d", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 7100940..beab9fb 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -508,7 +508,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
case LOC_ARG:
if (frame == NULL)
return 0;
- addr = FRAME_ARGS_ADDRESS (frame);
+ addr = get_frame_args_address (frame);
if (!addr)
return 0;
addr += SYMBOL_VALUE (var);
@@ -520,7 +520,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
CORE_ADDR argref;
if (frame == NULL)
return 0;
- argref = FRAME_ARGS_ADDRESS (frame);
+ argref = get_frame_args_address (frame);
if (!argref)
return 0;
argref += SYMBOL_VALUE (var);
diff --git a/gdb/frame-base.c b/gdb/frame-base.c
new file mode 100644
index 0000000..f7ba4be
--- /dev/null
+++ b/gdb/frame-base.c
@@ -0,0 +1,154 @@
+/* Definitions for frame address handler, for GDB, the GNU debugger.
+
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "frame-base.h"
+#include "frame.h"
+
+/* A default frame base implementations. If it wasn't for the old
+ FRAME_LOCALS_ADDRESS and FRAME_ARGS_ADDRESS, these could be
+ combined into a single function. All architectures really need to
+ override this. */
+
+static CORE_ADDR
+default_frame_base_address (struct frame_info *next_frame, void **this_cache)
+{
+ struct frame_info *this_frame = get_prev_frame (next_frame);
+ return get_frame_base (this_frame); /* sigh! */
+}
+
+static CORE_ADDR
+default_frame_locals_address (struct frame_info *next_frame, void **this_cache)
+{
+ struct frame_info *this_frame = get_prev_frame (next_frame);
+ return FRAME_LOCALS_ADDRESS (this_frame);
+}
+
+static CORE_ADDR
+default_frame_args_address (struct frame_info *next_frame, void **this_cache)
+{
+ struct frame_info *this_frame = get_prev_frame (next_frame);
+ /* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except
+ that if it is unsure about the answer, it returns 0 instead of
+ guessing (this happens on the VAX and i960, for example).
+
+ On most machines, we never have to guess about the args address,
+ so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */
+#ifdef FRAME_ARGS_ADDRESS_CORRECT
+ return FRAME_ARGS_ADDRESS_CORRECT (this_frame);
+#else
+ return FRAME_ARGS_ADDRESS (this_frame);
+#endif
+}
+
+const struct frame_base default_frame_base = {
+ NULL, /* No parent. */
+ default_frame_base_address,
+ default_frame_locals_address,
+ default_frame_args_address
+};
+
+static struct gdbarch_data *frame_base_data;
+
+struct frame_base_table
+{
+ frame_base_p_ftype **p;
+ const struct frame_base *default_base;
+ int nr;
+};
+
+static void *
+frame_base_init (struct gdbarch *gdbarch)
+{
+ struct frame_base_table *table = XCALLOC (1, struct frame_base_table);
+ table->default_base = &default_frame_base;
+ return table;
+}
+
+static void
+frame_base_free (struct gdbarch *gdbarch, void *data)
+{
+ struct frame_base_table *table =
+ gdbarch_data (gdbarch, frame_base_data);
+ xfree (table->p);
+ xfree (table);
+}
+
+static struct frame_base_table *
+frame_base_table (struct gdbarch *gdbarch)
+{
+ struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data);
+ if (table == NULL)
+ {
+ /* ULGH, called during architecture initialization. Patch
+ things up. */
+ table = frame_base_init (gdbarch);
+ set_gdbarch_data (gdbarch, frame_base_data, table);
+ }
+ return table;
+}
+
+/* Append a predicate to the end of the table. */
+static void
+append_predicate (struct frame_base_table *table, frame_base_p_ftype *p)
+{
+ table->p = xrealloc (table->p, ((table->nr + 1)
+ * sizeof (frame_base_p_ftype *)));
+ table->p[table->nr] = p;
+ table->nr++;
+}
+
+void
+frame_base_append_predicate (struct gdbarch *gdbarch,
+ frame_base_p_ftype *p)
+{
+ struct frame_base_table *table = frame_base_table (gdbarch);
+ append_predicate (table, p);
+}
+
+void
+frame_base_set_default (struct gdbarch *gdbarch,
+ const struct frame_base *default_base)
+{
+ struct frame_base_table *table = frame_base_table (gdbarch);
+ table->default_base = default_base;
+}
+
+const struct frame_base *
+frame_base_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ int i;
+ struct frame_base_table *table = frame_base_table (gdbarch);
+ for (i = 0; i < table->nr; i++)
+ {
+ const struct frame_base *desc = table->p[i] (pc);
+ if (desc != NULL)
+ return desc;
+ }
+ return table->default_base;
+}
+
+void
+_initialize_frame_base (void)
+{
+ frame_base_data = register_gdbarch_data (frame_base_init,
+ frame_base_free);
+}
diff --git a/gdb/frame-base.h b/gdb/frame-base.h
new file mode 100644
index 0000000..5e0d5db
--- /dev/null
+++ b/gdb/frame-base.h
@@ -0,0 +1,94 @@
+/* Definitions for a frame base, for GDB, the GNU debugger.
+
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined (FRAME_BASE_H)
+#define FRAME_BASE_H 1
+
+struct frame_info;
+struct frame_id;
+struct frame_unwind;
+struct frame_base;
+struct gdbarch;
+struct regcache;
+
+/* Return the frame base methods for the function that contains PC, or
+ NULL if it can't handle this frame. */
+
+typedef const struct frame_base *(frame_base_p_ftype) (CORE_ADDR pc);
+
+/* Add a frame base handler to the list. The predicates are polled in
+ the order that they are appended. */
+
+extern void frame_base_append_predicate (struct gdbarch *gdbarch,
+ frame_base_p_ftype *p);
+
+/* Set the default frame base. If all else fails, this one is
+ returned. If this isn't set, the default is to use legacy code
+ that uses things like the frame ID's base (ulgh!). */
+
+extern void frame_base_set_default (struct gdbarch *gdbarch,
+ const struct frame_base *def);
+
+/* Iterate through the list of frame base handlers until one returns
+ an implementation. */
+
+extern const struct frame_base *frame_base_find_by_pc (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+
+/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
+ and that this is a `normal frame'; use the NEXT frame, and its
+ register unwind method, to determine the address of THIS frame's
+ `base'.
+
+ The exact meaning of `base' is highly dependant on the type of the
+ debug info. It is assumed that dwarf2, stabs, ... will each
+ provide their own methods.
+
+ A typical implmentation will return the same value for base,
+ locals-base and args-base. That value, however, will likely be
+ different to the frame ID's stack address. */
+
+/* A generic base address. */
+
+typedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *next_frame,
+ void **this_base_cache);
+
+/* The base address of the frame's local variables. */
+
+typedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *next_frame,
+ void **this_base_cache);
+
+/* The base address of the frame's arguments / parameters. */
+
+typedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *next_frame,
+ void **this_base_cache);
+
+struct frame_base
+{
+ /* If non-NULL, a low-level unwinder that shares its implementation
+ with this high-level frame-base method. */
+ const struct frame_unwind *unwind;
+ frame_this_base_ftype *this_base;
+ frame_this_locals_ftype *this_locals;
+ frame_this_args_ftype *this_args;
+};
+
+#endif
diff --git a/gdb/frame.c b/gdb/frame.c
index 969ead3..09dea5e 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -58,13 +58,19 @@ get_frame_id (struct frame_info *fi)
{
return null_frame_id;
}
- else
+ if (!fi->id_p)
{
- struct frame_id id;
- id.base = fi->frame;
- id.pc = fi->pc;
- return id;
+ gdb_assert (!legacy_frame_p (current_gdbarch));
+ /* Find THIS frame's ID. */
+ fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->id);
+ fi->id_p = 1;
+ /* FIXME: cagney/2002-12-18: Instead of this hack, should only
+ store the frame ID in PREV_FRAME. Unfortunatly, some
+ architectures (HP/UX) still reply on EXTRA_FRAME_INFO and,
+ hence, still poke at the "struct frame_info" object directly. */
+ fi->frame = fi->id.base;
}
+ return frame_id_build (fi->frame, fi->pc);
}
const struct frame_id null_frame_id; /* All zeros. */
@@ -1039,6 +1045,9 @@ legacy_get_prev_frame (struct frame_info *this_frame)
problem. */
prev->type = NORMAL_FRAME;
+ /* A legacy frame's ID is always computed here. Mark it as valid. */
+ prev->id_p = 1;
+
/* Handle sentinel frame unwind as a special case. */
if (this_frame->level < 0)
{
@@ -1087,7 +1096,7 @@ legacy_get_prev_frame (struct frame_info *this_frame)
or some random address on the stack. Trying to use that
PC to apply standard frame ID unwind techniques is just
asking for trouble. */
- /* Assume hand_function_call(), via SAVE_DUMMY_FRAME_TOS,
+ /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
previously saved the dummy frame's ID. Things only work
if the two return the same value. */
gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
@@ -1420,6 +1429,7 @@ get_prev_frame (struct frame_info *this_frame)
return this_frame->prev;
this_frame->prev_p = 1;
+#if 0
/* If we're inside the entry file, it isn't valid. Don't apply this
test to a dummy frame - dummy frame PC's typically land in the
entry file. Don't apply this test to the sentinel frame.
@@ -1431,6 +1441,15 @@ get_prev_frame (struct frame_info *this_frame)
/* NOTE: cagney/2003-01-10: If there is a way of disabling this test
then it should probably be moved to before the ->prev_p test,
above. */
+ /* NOTE: vinschen/2003-04-01: Disabled. It turns out that the call to
+ inside_entry_file destroys a meaningful backtrace under some
+ conditions. E. g. the backtrace tests in the asm-source testcase
+ are broken for some targets. In this test the functions are all
+ implemented as part of one file and the testcase is not necessarily
+ linked with a start file (depending on the target). What happens is,
+ that the first frame is printed normaly and following frames are
+ treated as being inside the enttry file then. This way, only the
+ #0 frame is printed in the backtrace output. */
if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0
&& inside_entry_file (get_frame_pc (this_frame)))
{
@@ -1439,6 +1458,7 @@ get_prev_frame (struct frame_info *this_frame)
"Outermost frame - inside entry file\n");
return NULL;
}
+#endif
/* If we're already inside the entry function for the main objfile,
then it isn't valid. Don't apply this test to a dummy frame -
@@ -1547,24 +1567,7 @@ get_prev_frame (struct frame_info *this_frame)
prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
prev_frame->pc);
- /* Find the prev's frame's ID. */
-
- /* The callee expects to be invoked with:
-
- this->unwind->this_id (this->next, &this->cache, &this->id);
-
- The below is carefully shifted one frame `to the left' so that
- both the unwind->this_id and unwind->prev_register methods are
- consistently invoked with NEXT_FRAME and THIS_PROLOGUE_CACHE.
-
- Also note that, while the PC for this new previous frame was
- unwound first (see above), the below is the first call that
- [potentially] requires analysis of the new previous frame's
- prologue. Consequently, it is this call, that typically ends up
- initializing the previous frame's prologue cache. */
- prev_frame->unwind->this_id (this_frame,
- &prev_frame->prologue_cache,
- &prev_frame->id);
+ /* The prev's frame's ID is computed by demand in get_frame_id(). */
/* The unwound frame ID is validate at the start of this function,
as part of the logic to decide if that frame should be further
@@ -1578,12 +1581,6 @@ get_prev_frame (struct frame_info *this_frame)
return 0 (indicating we don't know the address of the arglist) if
we don't know what frame this frame calls. */
- /* FIXME: cagney/2002-12-18: Instead of this hack, should only store
- the frame ID in PREV_FRAME. Unfortunatly, some architectures
- (HP/UX) still reply on EXTRA_FRAME_INFO and, hence, still poke at
- the "struct frame_info" object directly. */
- prev_frame->frame = prev_frame->id.base;
-
/* Link it in. */
this_frame->prev = prev_frame;
prev_frame->next = this_frame;
@@ -1625,6 +1622,12 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
+ if (!fi->id_p)
+ {
+ /* HACK: Force the ID code to (indirectly) initialize the
+ ->frame pointer. */
+ get_frame_id (fi);
+ }
return fi->frame;
}
diff --git a/gdb/frame.h b/gdb/frame.h
index 28426a2..231aaad 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -202,17 +202,17 @@ extern struct frame_id get_frame_id (struct frame_info *fi);
meaningful to the frame's high-level debug info. */
extern CORE_ADDR get_frame_base_address (struct frame_info *);
-/* Assuming that a frame is `normal', return the address of the first
- local variable, or 0 if the information isn't available. NOTE:
+/* Assuming that a frame is `normal', return the base-address of the
+ local variables, or 0 if the information isn't available. NOTE:
This address is really only meaningful to the frame's high-level
debug info. Typically, the argument and locals share a single
base-address. */
extern CORE_ADDR get_frame_locals_address (struct frame_info *);
-/* Assuming that a frame is `normal', return the address of the first
- parameter, or 0 if that information isn't available. NOTE: This
- address is really only meaningful to the frame's high-level debug
- info. Typically, the argument and locals share a single
+/* Assuming that a frame is `normal', return the base-address of the
+ parameter list, or 0 if that information isn't available. NOTE:
+ This address is really only meaningful to the frame's high-level
+ debug info. Typically, the argument and locals share a single
base-address. */
extern CORE_ADDR get_frame_args_address (struct frame_info *);
@@ -410,6 +410,7 @@ struct frame_info
/* This frame's ID. Note that the frame's ID, base and PC contain
redundant information. */
+ int id_p;
struct frame_id id;
/* The frame's high-level base methods, and corresponding cache.
@@ -548,10 +549,6 @@ extern int generic_pc_in_call_dummy (CORE_ADDR pc,
extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
-extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
- int nargs, struct value **args,
- struct type *type, int gcc_p);
-
void generic_unwind_get_saved_register (char *raw_buffer,
int *optimizedp,
CORE_ADDR *addrp,
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index cb8dc55..42b471a 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -42,7 +42,6 @@ static gdbarch_use_struct_convention_ftype frv_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation;
static gdbarch_init_extra_frame_info_ftype stupid_useless_init_extra_frame_info;
static gdbarch_push_arguments_ftype frv_push_arguments;
-static gdbarch_push_return_address_ftype frv_push_return_address;
static gdbarch_saved_pc_after_call_ftype frv_saved_pc_after_call;
static void frv_pop_frame_regular (struct frame_info *frame);
@@ -1089,15 +1088,12 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address);
/* Settings for calling functions in the inferior. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, frv_push_arguments);
- set_gdbarch_push_return_address (gdbarch, frv_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, frv_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, frv_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, frv_pop_frame);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, frv_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (frv_call_dummy_words));
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, frv_init_extra_frame_info);
/* Settings that should be unnecessary. */
@@ -1107,13 +1103,9 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index c45a70f..d08f146 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -66,6 +66,7 @@
#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
+#include "symfile.h" /* For entry_point_address. */
/* Static function declarations */
@@ -148,7 +149,7 @@ struct gdbarch
gdbarch_write_pc_ftype *write_pc;
gdbarch_read_fp_ftype *read_fp;
gdbarch_read_sp_ftype *read_sp;
- gdbarch_write_sp_ftype *write_sp;
+ gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp;
gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
gdbarch_pseudo_register_read_ftype *pseudo_register_read;
gdbarch_pseudo_register_write_ftype *pseudo_register_write;
@@ -189,10 +190,8 @@ struct gdbarch
gdbarch_call_dummy_address_ftype *call_dummy_address;
CORE_ADDR call_dummy_start_offset;
CORE_ADDR call_dummy_breakpoint_offset;
- int call_dummy_breakpoint_offset_p;
int call_dummy_length;
gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy;
- int call_dummy_p;
LONGEST * call_dummy_words;
int sizeof_call_dummy_words;
int deprecated_call_dummy_stack_adjust;
@@ -212,9 +211,10 @@ struct gdbarch
gdbarch_address_to_pointer_ftype *address_to_pointer;
gdbarch_integer_to_address_ftype *integer_to_address;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
- gdbarch_push_arguments_ftype *push_arguments;
+ gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments;
+ gdbarch_push_dummy_call_ftype *push_dummy_call;
gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame;
- gdbarch_push_return_address_ftype *push_return_address;
+ gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address;
gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame;
gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
gdbarch_extract_return_value_ftype *extract_return_value;
@@ -356,7 +356,6 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
- 0,
generic_pc_in_call_dummy,
0,
0,
@@ -502,7 +501,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->write_pc = generic_target_write_pc;
current_gdbarch->read_fp = generic_target_read_fp;
current_gdbarch->read_sp = generic_target_read_sp;
- current_gdbarch->write_sp = generic_target_write_sp;
current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
current_gdbarch->num_regs = -1;
current_gdbarch->sp_regnum = -1;
@@ -528,12 +526,8 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->cannot_store_register = cannot_register_not;
current_gdbarch->deprecated_use_generic_dummy_frames = 1;
current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
- current_gdbarch->call_dummy_start_offset = -1;
- current_gdbarch->call_dummy_breakpoint_offset = -1;
- current_gdbarch->call_dummy_breakpoint_offset_p = -1;
- current_gdbarch->call_dummy_length = -1;
+ current_gdbarch->call_dummy_address = entry_point_address;
current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy;
- current_gdbarch->call_dummy_p = -1;
current_gdbarch->call_dummy_words = legacy_call_dummy_words;
current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
current_gdbarch->register_convertible = generic_register_convertible_not;
@@ -543,7 +537,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
- current_gdbarch->push_arguments = default_push_arguments;
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;
@@ -631,7 +624,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of write_pc, invalid_p == 0 */
/* Skip verify of read_fp, invalid_p == 0 */
/* Skip verify of read_sp, invalid_p == 0 */
- /* Skip verify of write_sp, invalid_p == 0 */
+ /* Skip verify of deprecated_dummy_write_sp, has predicate */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of pseudo_register_read, has predicate */
/* Skip verify of pseudo_register_write, has predicate */
@@ -675,31 +668,12 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of get_longjmp_target, has predicate */
/* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
/* Skip verify of call_dummy_location, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0))
- fprintf_unfiltered (log, "\n\tcall_dummy_address");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_start_offset == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_start_offset");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset");
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_breakpoint_offset_p == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset_p");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_length == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_length");
+ /* Skip verify of call_dummy_address, invalid_p == 0 */
/* Skip verify of deprecated_pc_in_call_dummy, has predicate */
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_p == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_p");
/* Skip verify of call_dummy_words, invalid_p == 0 */
/* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
/* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->fix_call_dummy == 0))
- fprintf_unfiltered (log, "\n\tfix_call_dummy");
+ /* Skip verify of fix_call_dummy, has predicate */
/* Skip verify of deprecated_init_frame_pc_first, has predicate */
/* Skip verify of deprecated_init_frame_pc, has predicate */
/* Skip verify of deprecated_get_saved_register, has predicate */
@@ -713,9 +687,10 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of address_to_pointer, invalid_p == 0 */
/* Skip verify of integer_to_address, has predicate */
/* Skip verify of return_value_on_stack, invalid_p == 0 */
- /* Skip verify of push_arguments, invalid_p == 0 */
+ /* Skip verify of deprecated_push_arguments, has predicate */
+ /* Skip verify of push_dummy_call, has predicate */
/* Skip verify of deprecated_push_dummy_frame, has predicate */
- /* Skip verify of push_return_address, has predicate */
+ /* Skip verify of deprecated_push_return_address, has predicate */
/* Skip verify of deprecated_pop_frame, has predicate */
/* Skip verify of deprecated_store_struct_return, has predicate */
/* Skip verify of extract_return_value, invalid_p == 0 */
@@ -953,27 +928,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET # %s\n",
XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET));
- if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
- (long) CALL_DUMMY_BREAKPOINT_OFFSET);
-#endif
-#ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P
fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P # %s\n",
- XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET_P));
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P = %d\n",
- CALL_DUMMY_BREAKPOINT_OFFSET_P);
+ "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = %ld\n",
+ (long) CALL_DUMMY_BREAKPOINT_OFFSET);
#endif
#ifdef CALL_DUMMY_LENGTH
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_LENGTH # %s\n",
XSTRING (CALL_DUMMY_LENGTH));
- if (gdbarch->call_dummy_length >= 0)
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n",
- CALL_DUMMY_LENGTH);
+ fprintf_unfiltered (file,
+ "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n",
+ CALL_DUMMY_LENGTH);
#endif
#ifdef CALL_DUMMY_LOCATION
fprintf_unfiltered (file,
@@ -983,20 +948,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: CALL_DUMMY_LOCATION = %d\n",
CALL_DUMMY_LOCATION);
#endif
-#ifdef CALL_DUMMY_P
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_P # %s\n",
- XSTRING (CALL_DUMMY_P));
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_P = %d\n",
- CALL_DUMMY_P);
-#endif
#ifdef CALL_DUMMY_START_OFFSET
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_START_OFFSET # %s\n",
XSTRING (CALL_DUMMY_START_OFFSET));
fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
+ "gdbarch_dump: CALL_DUMMY_START_OFFSET = %ld\n",
(long) CALL_DUMMY_START_OFFSET);
#endif
#ifdef CALL_DUMMY_WORDS
@@ -1125,6 +1082,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_do_registers_info
/*DEPRECATED_DO_REGISTERS_INFO ()*/);
#endif
+#ifdef DEPRECATED_DUMMY_WRITE_SP_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_DUMMY_WRITE_SP_P()",
+ XSTRING (DEPRECATED_DUMMY_WRITE_SP_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP_P() = %d\n",
+ DEPRECATED_DUMMY_WRITE_SP_P ());
+#endif
+#ifdef DEPRECATED_DUMMY_WRITE_SP
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_DUMMY_WRITE_SP(val)",
+ XSTRING (DEPRECATED_DUMMY_WRITE_SP (val)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_dummy_write_sp
+ /*DEPRECATED_DUMMY_WRITE_SP ()*/);
+#endif
#ifdef DEPRECATED_EXTRACT_RETURN_VALUE
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1413,6 +1393,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_pop_frame
/*DEPRECATED_POP_FRAME ()*/);
#endif
+#ifdef DEPRECATED_PUSH_ARGUMENTS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_ARGUMENTS_P()",
+ XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS_P() = %d\n",
+ DEPRECATED_PUSH_ARGUMENTS_P ());
+#endif
+#ifdef DEPRECATED_PUSH_ARGUMENTS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
+ XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_push_arguments
+ /*DEPRECATED_PUSH_ARGUMENTS ()*/);
+#endif
#ifdef DEPRECATED_PUSH_DUMMY_FRAME_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1436,6 +1436,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_push_dummy_frame
/*DEPRECATED_PUSH_DUMMY_FRAME ()*/);
#endif
+#ifdef DEPRECATED_PUSH_RETURN_ADDRESS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_RETURN_ADDRESS_P()",
+ XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS_P() = %d\n",
+ DEPRECATED_PUSH_RETURN_ADDRESS_P ());
+#endif
+#ifdef DEPRECATED_PUSH_RETURN_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp)",
+ XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS (pc, sp)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_push_return_address
+ /*DEPRECATED_PUSH_RETURN_ADDRESS ()*/);
+#endif
#ifdef DEPRECATED_STORE_RETURN_VALUE
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1585,6 +1605,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->extract_struct_value_address
/*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
#endif
+#ifdef FIX_CALL_DUMMY_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FIX_CALL_DUMMY_P()",
+ XSTRING (FIX_CALL_DUMMY_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FIX_CALL_DUMMY_P() = %d\n",
+ FIX_CALL_DUMMY_P ());
+#endif
#ifdef FIX_CALL_DUMMY
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1898,37 +1927,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: PS_REGNUM = %d\n",
PS_REGNUM);
#endif
-#ifdef PUSH_ARGUMENTS
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
- XSTRING (PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_ARGUMENTS = <0x%08lx>\n",
- (long) current_gdbarch->push_arguments
- /*PUSH_ARGUMENTS ()*/);
-#endif
-#ifdef PUSH_RETURN_ADDRESS_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_RETURN_ADDRESS_P()",
- XSTRING (PUSH_RETURN_ADDRESS_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_RETURN_ADDRESS_P() = %d\n",
- PUSH_RETURN_ADDRESS_P ());
-#endif
-#ifdef PUSH_RETURN_ADDRESS
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_RETURN_ADDRESS(pc, sp)",
- XSTRING (PUSH_RETURN_ADDRESS (pc, sp)));
+ "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
+ gdbarch_push_dummy_call_p (current_gdbarch));
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_RETURN_ADDRESS = <0x%08lx>\n",
- (long) current_gdbarch->push_return_address
- /*PUSH_RETURN_ADDRESS ()*/);
-#endif
+ "gdbarch_dump: push_dummy_call = 0x%08lx\n",
+ (long) current_gdbarch->push_dummy_call);
#ifdef REGISTER_BYTE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2236,8 +2242,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS # %s\n",
XSTRING (SIZEOF_CALL_DUMMY_WORDS));
fprintf_unfiltered (file,
- "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
- (long) SIZEOF_CALL_DUMMY_WORDS);
+ "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = %d\n",
+ SIZEOF_CALL_DUMMY_WORDS);
#endif
#ifdef SKIP_PROLOGUE
fprintf_unfiltered (file,
@@ -2557,20 +2563,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->write_pc
/*TARGET_WRITE_PC ()*/);
#endif
-#ifdef TARGET_WRITE_SP
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "TARGET_WRITE_SP(val)",
- XSTRING (TARGET_WRITE_SP (val)));
-#endif
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_WRITE_SP = <0x%08lx>\n",
- (long) current_gdbarch->write_sp
- /*TARGET_WRITE_SP ()*/);
-#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n",
@@ -2919,23 +2911,30 @@ set_gdbarch_read_sp (struct gdbarch *gdbarch,
gdbarch->read_sp = read_sp;
}
+int
+gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_dummy_write_sp != 0;
+}
+
void
-gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
+gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->write_sp == 0)
+ if (gdbarch->deprecated_dummy_write_sp == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_write_sp invalid");
+ "gdbarch: gdbarch_deprecated_dummy_write_sp invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n");
- gdbarch->write_sp (val);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n");
+ gdbarch->deprecated_dummy_write_sp (val);
}
void
-set_gdbarch_write_sp (struct gdbarch *gdbarch,
- gdbarch_write_sp_ftype write_sp)
+set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch,
+ gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp)
{
- gdbarch->write_sp = write_sp;
+ gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp;
}
void
@@ -3717,9 +3716,6 @@ CORE_ADDR
gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_start_offset == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_start_offset invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n");
return gdbarch->call_dummy_start_offset;
@@ -3736,9 +3732,6 @@ CORE_ADDR
gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_breakpoint_offset invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n");
return gdbarch->call_dummy_breakpoint_offset;
@@ -3752,31 +3745,9 @@ set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch,
}
int
-gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_breakpoint_offset_p == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n");
- return gdbarch->call_dummy_breakpoint_offset_p;
-}
-
-void
-set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch,
- int call_dummy_breakpoint_offset_p)
-{
- gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p;
-}
-
-int
gdbarch_call_dummy_length (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_length == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_length invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n");
return gdbarch->call_dummy_length;
@@ -3816,25 +3787,6 @@ set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch,
gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy;
}
-int
-gdbarch_call_dummy_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_p == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_p invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n");
- return gdbarch->call_dummy_p;
-}
-
-void
-set_gdbarch_call_dummy_p (struct gdbarch *gdbarch,
- int call_dummy_p)
-{
- gdbarch->call_dummy_p = call_dummy_p;
-}
-
LONGEST *
gdbarch_call_dummy_words (struct gdbarch *gdbarch)
{
@@ -3892,6 +3844,13 @@ set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch,
gdbarch->deprecated_call_dummy_stack_adjust = deprecated_call_dummy_stack_adjust;
}
+int
+gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->fix_call_dummy != 0;
+}
+
void
gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p)
{
@@ -4218,23 +4177,56 @@ set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
gdbarch->return_value_on_stack = return_value_on_stack;
}
+int
+gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_push_arguments != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->deprecated_push_arguments == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_deprecated_push_arguments invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n");
+ return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr);
+}
+
+void
+set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch,
+ gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)
+{
+ gdbarch->deprecated_push_arguments = deprecated_push_arguments;
+}
+
+int
+gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->push_dummy_call != 0;
+}
+
CORE_ADDR
-gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->push_arguments == 0)
+ if (gdbarch->push_dummy_call == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_push_arguments invalid");
+ "gdbarch: gdbarch_push_dummy_call invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n");
- return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
+ return gdbarch->push_dummy_call (gdbarch, regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr);
}
void
-set_gdbarch_push_arguments (struct gdbarch *gdbarch,
- gdbarch_push_arguments_ftype push_arguments)
+set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
+ gdbarch_push_dummy_call_ftype push_dummy_call)
{
- gdbarch->push_arguments = push_arguments;
+ gdbarch->push_dummy_call = push_dummy_call;
}
int
@@ -4264,29 +4256,29 @@ set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch,
}
int
-gdbarch_push_return_address_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->push_return_address != 0;
+ return gdbarch->deprecated_push_return_address != 0;
}
CORE_ADDR
-gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
+gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->push_return_address == 0)
+ if (gdbarch->deprecated_push_return_address == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_push_return_address invalid");
+ "gdbarch: gdbarch_deprecated_push_return_address invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n");
- return gdbarch->push_return_address (pc, sp);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n");
+ return gdbarch->deprecated_push_return_address (pc, sp);
}
void
-set_gdbarch_push_return_address (struct gdbarch *gdbarch,
- gdbarch_push_return_address_ftype push_return_address)
+set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch,
+ gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address)
{
- gdbarch->push_return_address = push_return_address;
+ gdbarch->deprecated_push_return_address = deprecated_push_return_address;
}
int
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index dd66773..596f131 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -39,6 +39,7 @@
#if !GDB_MULTI_ARCH
/* Pull in function declarations refered to, indirectly, via macros. */
#include "inferior.h" /* For unsigned_address_to_pointer(). */
+#include "symfile.h" /* For entry_point_address(). */
#endif
struct frame_info;
@@ -388,20 +389,42 @@ extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype
#endif
#endif
+/* The dummy call frame SP should be set by push_dummy_call. */
+
+#if defined (DEPRECATED_DUMMY_WRITE_SP)
+/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */
+#if !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (0)
+#endif
+
+extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_SP)
-#define TARGET_WRITE_SP(val) (generic_target_write_sp (val))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (internal_error (__FILE__, __LINE__, "DEPRECATED_DUMMY_WRITE_SP"), 0)
#endif
-typedef void (gdbarch_write_sp_ftype) (CORE_ADDR val);
-extern void gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
-extern void set_gdbarch_write_sp (struct gdbarch *gdbarch, gdbarch_write_sp_ftype *write_sp);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_WRITE_SP)
-#error "Non multi-arch definition of TARGET_WRITE_SP"
+typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val);
+extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
+extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_SP)
-#define TARGET_WRITE_SP(val) (gdbarch_write_sp (current_gdbarch, val))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val))
#endif
#endif
@@ -1118,6 +1141,11 @@ extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_d
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS)
+#define CALL_DUMMY_ADDRESS() (entry_point_address ())
+#endif
+
typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) (void);
extern CORE_ADDR gdbarch_call_dummy_address (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_address (struct gdbarch *gdbarch, gdbarch_call_dummy_address_ftype *call_dummy_address);
@@ -1135,44 +1163,27 @@ extern void set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_A
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_START_OFFSET)
#error "Non multi-arch definition of CALL_DUMMY_START_OFFSET"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_START_OFFSET)
+#if !defined (CALL_DUMMY_START_OFFSET)
#define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch))
#endif
-#endif
extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET)
#error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
+#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
#define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch))
#endif
-#endif
-
-extern int gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
-#error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET_P"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch))
-#endif
-#endif
extern int gdbarch_call_dummy_length (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dummy_length);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LENGTH)
#error "Non multi-arch definition of CALL_DUMMY_LENGTH"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LENGTH)
+#if !defined (CALL_DUMMY_LENGTH)
#define CALL_DUMMY_LENGTH (gdbarch_call_dummy_length (current_gdbarch))
#endif
-#endif
/* NOTE: cagney/2002-11-24: This function with predicate has a valid
(callable) initial value. As a consequence, even when the predicate
@@ -1217,17 +1228,6 @@ extern void set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gd
#endif
#endif
-extern int gdbarch_call_dummy_p (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, int call_dummy_p);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_P)
-#error "Non multi-arch definition of CALL_DUMMY_P"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P)
-#define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch))
-#endif
-#endif
-
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_WORDS)
#define CALL_DUMMY_WORDS (legacy_call_dummy_words)
@@ -1238,11 +1238,9 @@ extern void set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, LONGEST * cal
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_WORDS)
#error "Non multi-arch definition of CALL_DUMMY_WORDS"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_WORDS)
+#if !defined (CALL_DUMMY_WORDS)
#define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch))
#endif
-#endif
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (SIZEOF_CALL_DUMMY_WORDS)
@@ -1254,11 +1252,9 @@ extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int si
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIZEOF_CALL_DUMMY_WORDS)
#error "Non multi-arch definition of SIZEOF_CALL_DUMMY_WORDS"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIZEOF_CALL_DUMMY_WORDS)
+#if !defined (SIZEOF_CALL_DUMMY_WORDS)
#define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch))
#endif
-#endif
#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */
@@ -1296,6 +1292,31 @@ extern void set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdba
#endif
#endif
+#if defined (FIX_CALL_DUMMY)
+/* Legacy for systems yet to multi-arch FIX_CALL_DUMMY */
+#if !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (0)
+#endif
+
+extern int gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FIX_CALL_DUMMY_P)
+#error "Non multi-arch definition of FIX_CALL_DUMMY"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (gdbarch_fix_call_dummy_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY)
+#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0)
+#endif
+
typedef void (gdbarch_fix_call_dummy_ftype) (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
extern void gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_call_dummy_ftype *fix_call_dummy);
@@ -1629,23 +1650,51 @@ extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_
#endif
#endif
+/* Replaced by PUSH_DUMMY_CALL */
+
+#if defined (DEPRECATED_PUSH_ARGUMENTS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */
+#if !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS)
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0)
#endif
-typedef CORE_ADDR (gdbarch_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS)
-#error "Non multi-arch definition of PUSH_ARGUMENTS"
+typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS)
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
#endif
#endif
+extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
+
#if defined (DEPRECATED_PUSH_DUMMY_FRAME)
/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */
#if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
@@ -1683,40 +1732,42 @@ extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gd
#endif
#endif
-#if defined (PUSH_RETURN_ADDRESS)
-/* Legacy for systems yet to multi-arch PUSH_RETURN_ADDRESS */
-#if !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (1)
+/* NOTE: This can be handled directly in push_dummy_call. */
+
+#if defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */
+#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (0)
#endif
-extern int gdbarch_push_return_address_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS_P)
-#error "Non multi-arch definition of PUSH_RETURN_ADDRESS"
+extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (gdbarch_push_return_address_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS)
-#define PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "PUSH_RETURN_ADDRESS"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_RETURN_ADDRESS"), 0)
#endif
-typedef CORE_ADDR (gdbarch_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
-extern CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
-extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS)
-#error "Non multi-arch definition of PUSH_RETURN_ADDRESS"
+typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
+extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
+extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS)
-#define PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_push_return_address (current_gdbarch, pc, sp))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp))
#endif
#endif
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index a1122e1..fa91815 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -430,7 +430,8 @@ f:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc:
f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
f:2:TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
-f:2:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
+# The dummy call frame SP should be set by push_dummy_call.
+F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
# Function for getting target's idea of a frame pointer. FIXME: GDB's
# whole scheme for dealing with "frames" and "frame pointers" needs a
# serious shakedown.
@@ -519,22 +520,20 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0
# avoids any potential problems with moving beyond multi-arch partial.
v:1:DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
v:1:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
-f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0
-v:2:CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset::::0:-1:::0x%08lx
-v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1::gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1:0x%08lx::CALL_DUMMY_BREAKPOINT_OFFSET_P
-v:1:CALL_DUMMY_BREAKPOINT_OFFSET_P:int:call_dummy_breakpoint_offset_p::::0:-1
-v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::gdbarch->call_dummy_length >= 0
+f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
+v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset
+v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset
+v::CALL_DUMMY_LENGTH:int:call_dummy_length
# NOTE: cagney/2002-11-24: This function with predicate has a valid
# (callable) initial value. As a consequence, even when the predicate
# is false, the corresponding function works. This simplifies the
# migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(),
# doesn't need to be modified.
F:1:DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
-v:1:CALL_DUMMY_P:int:call_dummy_p::::0:-1
-v:2:CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
-v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0:0x%08lx
+v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
+v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
-f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
+F::FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
#
@@ -555,9 +554,12 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR
F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
#
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
-f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
+# Replaced by PUSH_DUMMY_CALL
+F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
+M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr
F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
-F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
+# NOTE: This can be handled directly in push_dummy_call.
+F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0
# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
@@ -802,6 +804,7 @@ cat <<EOF
#if !GDB_MULTI_ARCH
/* Pull in function declarations refered to, indirectly, via macros. */
#include "inferior.h" /* For unsigned_address_to_pointer(). */
+#include "symfile.h" /* For entry_point_address(). */
#endif
struct frame_info;
@@ -1302,6 +1305,7 @@ cat <<EOF
#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
+#include "symfile.h" /* For entry_point_address. */
/* Static function declarations */
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index e78bc0f..7bb2500 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1148,23 +1148,16 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, h8300_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, h8300_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, h8300_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments);
set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame);
set_gdbarch_deprecated_store_struct_return (gdbarch, h8300_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
@@ -1175,6 +1168,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 66b7b61..3d1ca88 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "arch-utils.h"
#include "gdbcore.h"
#include "osabi.h"
+#include "gdb_string.h"
/* Forward declarations. */
extern void _initialize_hppa_hpux_tdep (void);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 2f5412e..2e0c192 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -33,7 +33,7 @@
#include "language.h"
#include "osabi.h"
#include "gdb_assert.h"
-
+#include "infttrace.h"
/* For argument passing to the inferior */
#include "symtab.h"
@@ -886,7 +886,7 @@ hppa_frame_saved_pc (struct frame_info *frame)
{
CORE_ADDR pc = get_frame_pc (frame);
struct unwind_table_entry *u;
- CORE_ADDR old_pc;
+ CORE_ADDR old_pc = 0;
int spun_around_loop = 0;
int rp_offset = 0;
@@ -5003,9 +5003,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);
set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame);
set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
/* set_gdbarch_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
- set_gdbarch_push_arguments (gdbarch, hppa_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments);
set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_read_pc (gdbarch, hppa_target_read_pc);
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 51b74fc..b953d25 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -31,6 +31,7 @@
#include "gdbcore.h"
#include "gdb_wait.h"
#include "regcache.h"
+#include "gdb_string.h"
#include <signal.h>
extern CORE_ADDR text_end;
@@ -785,8 +786,6 @@ startup_semaphore_t;
static startup_semaphore_t startup_semaphore;
-extern int parent_attach_all (int, PTRACE_ARG3_TYPE, int);
-
#ifdef PT_SETTRC
/* This function causes the caller's process to be traced by its
parent. This is intended to be called after GDB forks itself,
@@ -907,14 +906,13 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
}
int
-hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
- enum bptype type)
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
{
error ("Hardware watchpoints not implemented on this platform.");
}
int
-hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
+hppa_can_use_hw_watchpoint (int type, int cnt, int ot)
{
return 0;
}
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 6acf576..606ccfe 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -35,6 +35,8 @@
#include "gdb-stabs.h"
#include "gdbtypes.h"
#include "demangle.h"
+#include "somsolib.h"
+#include "gdb_assert.h"
/* Private information attached to an objfile which we use to find
and internalize the HP C debug symbols within that objfile. */
@@ -1024,7 +1026,7 @@ hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
while (VALID_CURR_FILE || VALID_CURR_MODULE)
{
- char *mod_name_string;
+ char *mod_name_string = NULL;
char *full_name_string;
/* First check for modules like "version.c", which have no code
@@ -2321,7 +2323,7 @@ static unsigned long
hpread_get_textlow (int global, int index, struct objfile *objfile,
int symcount)
{
- union dnttentry *dn_bufp;
+ union dnttentry *dn_bufp = NULL;
struct minimal_symbol *msymbol;
/* Look for a DNTT_TYPE_FUNCTION symbol. */
@@ -2340,6 +2342,11 @@ hpread_get_textlow (int global, int index, struct objfile *objfile,
&& index < symcount);
}
+ /* NOTE: cagney/2003-03-29: If !(index < symcount), dn_bufp is left
+ undefined and that means that the test below is using a garbage
+ pointer from the stack. */
+ gdb_assert (dn_bufp != NULL);
+
/* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This
might happen when a sourcefile has no functions. */
if (dn_bufp->dblock.kind == DNTT_TYPE_END)
@@ -3359,10 +3366,10 @@ static struct type *
hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
struct objfile *objfile, int newblock)
{
- struct type *type, *type1;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
+ struct type *type;
dnttpointer param;
union dnttentry *paramp;
char *name;
@@ -3378,11 +3385,17 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
}
else
{
+ struct type *type1 = NULL;
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
objfile));
+ /* NOTE: cagney/2003-03-29: Oh, no not again. TYPE1 is
+ potentially left undefined here. Assert it isn't and hope
+ the assert never fails ... */
+ gdb_assert (type1 != NULL);
+
replace_type (type, type1);
/* Mark it -- in the middle of processing */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 02abc9e..7ef1f6e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -925,7 +925,7 @@ static CORE_ADDR
i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
- sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr);
+ sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr);
if (struct_return)
{
@@ -939,12 +939,6 @@ i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
return sp;
}
-static void
-i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- /* Do nothing. Everything was already done by i386_push_arguments. */
-}
-
/* These registers are used for returning integers (and on some
targets also for returning `struct' and `union' values when their
size and alignment match an integer type). */
@@ -1565,15 +1559,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, NULL);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_register_convertible (gdbarch, i386_register_convertible);
set_gdbarch_register_convert_to_virtual (gdbarch,
@@ -1586,10 +1573,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_parm_boundary (gdbarch, 32);
set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, i386_push_arguments);
- set_gdbarch_push_return_address (gdbarch, i386_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, i386_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, i386_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, i386_pop_frame);
- set_gdbarch_deprecated_store_struct_return (gdbarch, i386_store_struct_return);
set_gdbarch_store_return_value (gdbarch, i386_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch,
i386_extract_struct_value_address);
@@ -1630,6 +1616,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
i386_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 1b3d765..ecb4919 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -96,8 +96,6 @@ static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
-static gdbarch_push_arguments_ftype ia64_push_arguments;
-static gdbarch_push_return_address_ftype ia64_push_return_address;
static gdbarch_saved_pc_after_call_ftype ia64_saved_pc_after_call;
static void ia64_pop_frame_regular (struct frame_info *frame);
static struct type *is_float_or_hfa_type (struct type *t);
@@ -2215,15 +2213,12 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, ia64_write_pc);
/* Settings for calling functions in the inferior. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, ia64_push_arguments);
- set_gdbarch_push_return_address (gdbarch, ia64_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, ia64_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words));
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address);
@@ -2239,12 +2234,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
-
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 19077b4..3866690 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -986,50 +986,46 @@ run_stack_dummy (CORE_ADDR addr, struct regcache *buffer)
{
struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
int saved_async = 0;
+ struct breakpoint *bpt;
+ struct symtab_and_line sal;
/* Now proceed, having reached the desired place. */
clear_proceed_status ();
- if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
+ init_sal (&sal); /* initialize to zeroes */
+ if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
{
- struct breakpoint *bpt;
- struct symtab_and_line sal;
-
- init_sal (&sal); /* initialize to zeroes */
- if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
- {
- sal.pc = CALL_DUMMY_ADDRESS ();
- }
- else
- {
- /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need
- to put a breakpoint instruction. If not, the call dummy
- already has the breakpoint instruction in it.
-
- ADDR IS THE ADDRESS of the call dummy plus the
- CALL_DUMMY_START_OFFSET, so we need to subtract the
- CALL_DUMMY_START_OFFSET. */
- sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
- }
- sal.section = find_pc_overlay (sal.pc);
-
- {
- /* Set up a frame ID for the dummy frame so we can pass it to
- set_momentary_breakpoint. We need to give the breakpoint a
- frame ID so that the breakpoint code can correctly
- re-identify the dummy breakpoint. */
- struct frame_id frame = frame_id_build (read_fp (), sal.pc);
- /* Create a momentary breakpoint at the return address of the
- inferior. That way it breaks when it returns. */
- bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
- bpt->disposition = disp_del;
- }
-
- /* If all error()s out of proceed ended up calling normal_stop (and
- perhaps they should; it already does in the special case of error
- out of resume()), then we wouldn't need this. */
- make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
+ sal.pc = CALL_DUMMY_ADDRESS ();
+ }
+ else
+ {
+ /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to
+ put a breakpoint instruction. If not, the call dummy already
+ has the breakpoint instruction in it.
+
+ ADDR IS THE ADDRESS of the call dummy plus the
+ CALL_DUMMY_START_OFFSET, so we need to subtract the
+ CALL_DUMMY_START_OFFSET. */
+ sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
}
+ sal.section = find_pc_overlay (sal.pc);
+
+ {
+ /* Set up a frame ID for the dummy frame so we can pass it to
+ set_momentary_breakpoint. We need to give the breakpoint a
+ frame ID so that the breakpoint code can correctly re-identify
+ the dummy breakpoint. */
+ struct frame_id frame = frame_id_build (read_fp (), sal.pc);
+ /* Create a momentary breakpoint at the return address of the
+ inferior. That way it breaks when it returns. */
+ bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
+ bpt->disposition = disp_del;
+ }
+
+ /* If all error()s out of proceed ended up calling normal_stop (and
+ perhaps they should; it already does in the special case of error
+ out of resume()), then we wouldn't need this. */
+ make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
disable_watchpoints_before_interactive_call_start ();
proceed_to_finish = 1; /* We want stop_registers, please... */
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 10da8ee..ae041f2 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -178,8 +178,6 @@ extern CORE_ADDR read_sp (void);
extern CORE_ADDR generic_target_read_sp (void);
-extern void write_sp (CORE_ADDR);
-
extern void generic_target_write_sp (CORE_ADDR);
extern CORE_ADDR read_fp (void);
@@ -420,42 +418,13 @@ extern int attach_flag;
#define ON_STACK 1
#define AT_ENTRY_POINT 4
-#if !defined (CALL_DUMMY_ADDRESS)
-#define CALL_DUMMY_ADDRESS() (internal_error (__FILE__, __LINE__, "CALL_DUMMY_ADDRESS"), 0)
-#endif
-#if !defined (CALL_DUMMY_START_OFFSET)
-#define CALL_DUMMY_START_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_START_OFFSET"), 0)
-#endif
-#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_BREAKPOINT_OFFSET"), 0)
-#endif
-#if !defined CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (1)
-#endif
-#if !defined (CALL_DUMMY_LENGTH)
-#define CALL_DUMMY_LENGTH (internal_error (__FILE__, __LINE__, "CALL_DUMMY_LENGTH"), 0)
-#endif
-
/* FIXME: cagney/2000-04-17: gdbarch should manage this. The default
shouldn't be necessary. */
-#if !defined (CALL_DUMMY_P)
-#if defined (CALL_DUMMY)
-#define CALL_DUMMY_P 1
-#else
-#define CALL_DUMMY_P 0
-#endif
-#endif
-
#if !defined PUSH_DUMMY_FRAME
#define PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "PUSH_DUMMY_FRAME"), 0)
#endif
-#if !defined FIX_CALL_DUMMY
-#define FIX_CALL_DUMMY(a1,a2,a3,a4,a5,a6,a7) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0)
-#endif
-
#if !defined STORE_STRUCT_RETURN
#define STORE_STRUCT_RETURN(a1,a2) (internal_error (__FILE__, __LINE__, "STORE_STRUCT_RETURN"), 0)
#endif
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6da3394..74f1de1 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1153,6 +1153,11 @@ void
handle_inferior_event (struct execution_control_state *ecs)
{
CORE_ADDR real_stop_pc;
+ /* NOTE: cagney/2003-03-28: If you're looking at this code and
+ thinking that the variable stepped_after_stopped_by_watchpoint
+ isn't used, then you're wrong! The macro STOPPED_BY_WATCHPOINT,
+ defined in the file "config/pa/nm-hppah.h", accesses the variable
+ indirectly. Mutter something rude about the HP merge. */
int stepped_after_stopped_by_watchpoint;
int sw_single_step_trap_p = 0;
@@ -1165,7 +1170,15 @@ handle_inferior_event (struct execution_control_state *ecs)
case infwait_thread_hop_state:
/* Cancel the waiton_ptid. */
ecs->waiton_ptid = pid_to_ptid (-1);
- /* Fall thru to the normal_state case. */
+ /* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event
+ is serviced in this loop, below. */
+ if (ecs->enable_hw_watchpoints_after_wait)
+ {
+ TARGET_ENABLE_HW_WATCHPOINTS (PIDGET (inferior_ptid));
+ ecs->enable_hw_watchpoints_after_wait = 0;
+ }
+ stepped_after_stopped_by_watchpoint = 0;
+ break;
case infwait_normal_state:
/* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event
@@ -1179,6 +1192,7 @@ handle_inferior_event (struct execution_control_state *ecs)
break;
case infwait_nullified_state:
+ stepped_after_stopped_by_watchpoint = 0;
break;
case infwait_nonstep_watch_state:
@@ -1189,6 +1203,9 @@ handle_inferior_event (struct execution_control_state *ecs)
in combination correctly? */
stepped_after_stopped_by_watchpoint = 1;
break;
+
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
}
ecs->infwait_state = infwait_normal_state;
@@ -1795,26 +1812,30 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_print_frame = 1;
}
+ /* NOTE: cagney/2003-03-29: These two checks for a random signal
+ at one stage in the past included checks for an inferior
+ function call's call dummy's return breakpoint. The original
+ comment, that went with the test, read:
+
+ ``End of a stack dummy. Some systems (e.g. Sony news) give
+ another signal besides SIGTRAP, so check here as well as
+ above.''
+
+ 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
+ enabled when momentary breakpoints were not being used, I
+ suspect that it won't be the case. */
+
if (stop_signal == TARGET_SIGNAL_TRAP)
ecs->random_signal
= !(bpstat_explains_signal (stop_bpstat)
|| trap_expected
- || (!CALL_DUMMY_BREAKPOINT_OFFSET_P
- && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (),
- get_frame_base (get_current_frame ())))
|| (step_range_end && step_resume_breakpoint == NULL));
-
else
{
- ecs->random_signal = !(bpstat_explains_signal (stop_bpstat)
- /* End of a stack dummy. Some systems (e.g. Sony
- news) give another signal besides SIGTRAP, so
- check here as well as above. */
- || (!CALL_DUMMY_BREAKPOINT_OFFSET_P
- && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (),
- get_frame_base
- (get_current_frame
- ()))));
+ ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
if (!ecs->random_signal)
stop_signal = TARGET_SIGNAL_TRAP;
}
@@ -2156,31 +2177,6 @@ process_event_stop_test:
return;
}
- if (!CALL_DUMMY_BREAKPOINT_OFFSET_P)
- {
- /* This is the old way of detecting the end of the stack dummy.
- An architecture which defines CALL_DUMMY_BREAKPOINT_OFFSET gets
- handled above. As soon as we can test it on all of them, all
- architectures should define it. */
-
- /* If this is the breakpoint at the end of a stack dummy,
- just stop silently, unless the user was doing an si/ni, in which
- case she'd better know what she's doing. */
-
- if (CALL_DUMMY_HAS_COMPLETED (stop_pc, read_sp (),
- get_frame_base (get_current_frame ()))
- && !step_range_end)
- {
- stop_print_frame = 0;
- stop_stack_dummy = 1;
-#ifdef HP_OS_BUG
- trap_expected_after_continue = 1;
-#endif
- stop_stepping (ecs);
- return;
- }
- }
-
if (step_resume_breakpoint)
{
/* Having a step-resume breakpoint overrides anything
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index 02a5576..f86ab02 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -27,6 +27,7 @@
#include "gdb_string.h"
#include "gdb_wait.h"
#include "command.h"
+#include "gdbthread.h"
/* We need pstat functionality so that we can get the exec file
for a process we attach to.
@@ -2947,7 +2948,7 @@ ptrace_wait (ptid_t ptid, int *status)
child_acknowledge_created_inferior.)
*/
int
-parent_attach_all (void)
+parent_attach_all (int p1, PTRACE_ARG3_TYPE p2, int p3)
{
int tt_status;
@@ -3674,7 +3675,7 @@ call_ptrace (int pt_request, int gdb_tid, PTRACE_ARG3_TYPE addr, int data)
there's no need for any "break" statements.
*/
case PT_SETTRC:
- return parent_attach_all ();
+ return parent_attach_all (0, 0, 0);
case PT_RUREGS:
tt_status = read_from_register_save_state (gdb_tid,
@@ -5378,8 +5379,7 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
watchpoints.
*/
int
-hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
- enum bptype type)
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
{
CORE_ADDR page_start;
int dictionary_is_empty;
@@ -5439,7 +5439,7 @@ hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
hardware support.
*/
int
-hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
+hppa_can_use_hw_watchpoint (int type, int cnt, int ot)
{
return (type == bp_hardware_watchpoint);
}
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index f6bc2de..9e73030 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -34,6 +34,7 @@
#include "jv-lang.h"
#include "gdbcore.h"
#include "block.h"
+#include "demangle.h"
#include <ctype.h>
struct type *java_int_type;
@@ -996,6 +997,12 @@ java_create_fundamental_type (struct objfile *objfile, int typeid)
return c_create_fundamental_type (objfile, typeid);
}
+static char *java_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options | DMGL_JAVA);
+}
+
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
@@ -1055,6 +1062,7 @@ const struct language_defn java_language_defn =
java_val_print, /* Print a value using appropriate syntax */
java_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ java_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/language.c b/gdb/language.c
index 2b71d1f..0a65094 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -44,6 +44,7 @@
#include "target.h"
#include "parser-defs.h"
#include "jv-lang.h"
+#include "demangle.h"
extern void _initialize_language (void);
@@ -1361,6 +1362,21 @@ skip_language_trampoline (CORE_ADDR pc)
return 0;
}
+/* Return demangled language symbol, or NULL.
+ FIXME: Options are only useful for certain languages and ignored
+ by others, so it would be better to remove them here and have a
+ more flexible demangler for the languages that need it.
+ FIXME: Sometimes the demangler is invoked when we don't know the
+ language, so we can't use this everywhere. */
+char *
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options)
+{
+ if (current_language != NULL && current_language->la_demangle)
+ return current_language->la_demangle (mangled, options);
+ return NULL;
+}
+
/* Define the language that is no language. */
@@ -1428,6 +1444,13 @@ static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc)
return 0;
}
+/* Unknown languages just use the cplus demangler. */
+static char *unk_lang_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options);
+}
+
+
static struct type **const (unknown_builtin_types[]) =
{
0
@@ -1456,6 +1479,7 @@ const struct language_defn unknown_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1487,6 +1511,7 @@ const struct language_defn auto_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1517,6 +1542,7 @@ const struct language_defn local_language_defn =
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/language.h b/gdb/language.h
index 4b9f8ce..d926532 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -209,6 +209,9 @@ struct language_defn
if it isn't a language tramp for this language. */
CORE_ADDR (*skip_trampoline) (CORE_ADDR pc);
+ /* Return demangled language symbol, or NULL. */
+ char *(*la_demangle) (const char *mangled, int options);
+
/* Base 2 (binary) formats. */
struct language_format_info la_binary_format;
@@ -475,4 +478,8 @@ extern enum language get_frame_language (void); /* In stack.c */
extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc);
+/* Return demangled language symbol, or NULL. */
+extern char *language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options);
+
#endif /* defined (LANGUAGE_H) */
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 9f9dd81..c36394e 100644
--- a/gdb/lin-lwp.c
+++ b/gdb/lin-lwp.c
@@ -172,8 +172,7 @@ status_to_str (int status)
snprintf (buf, sizeof (buf), "%s (terminated)",
strsignal (WSTOPSIG (status)));
else
- snprintf (buf, sizeof (buf), "%d (exited)",
- WEXITSTATUS (status));
+ snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
return buf;
}
@@ -306,8 +305,8 @@ iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
int
lin_lwp_prepare_to_proceed (void)
{
- if (! ptid_equal (trap_ptid, null_ptid)
- && ! ptid_equal (inferior_ptid, trap_ptid))
+ if (!ptid_equal (trap_ptid, null_ptid)
+ && !ptid_equal (inferior_ptid, trap_ptid))
{
/* Switched over from TRAP_PID. */
CORE_ADDR stop_pc = read_pc ();
@@ -319,7 +318,7 @@ lin_lwp_prepare_to_proceed (void)
if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
{
/* User hasn't deleted the breakpoint. Return non-zero, and
- switch back to TRAP_PID. */
+ switch back to TRAP_PID. */
inferior_ptid = trap_ptid;
/* FIXME: Is this stuff really necessary? */
@@ -355,7 +354,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
/* Make sure SIGCHLD is blocked. We don't want SIGCHLD events
to interrupt either the ptrace() or waitpid() calls below. */
- if (! sigismember (&blocked_mask, SIGCHLD))
+ if (!sigismember (&blocked_mask, SIGCHLD))
{
sigaddset (&blocked_mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
@@ -380,8 +379,8 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
safe_strerror (errno));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
target_pid_to_str (ptid));
pid = waitpid (GET_LWP (ptid), &status, 0);
@@ -401,18 +400,18 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
{
fprintf_unfiltered (gdb_stdlog,
"LLAL: waitpid %s received %s\n",
- target_pid_to_str (ptid),
+ target_pid_to_str (ptid),
status_to_str (status));
}
}
else
{
/* We assume that the LWP representing the original process
- is already stopped. Mark it as stopped in the data structure
- that the lin-lwp layer uses to keep track of threads. Note
- that this won't have already been done since the main thread
- will have, we assume, been stopped by an attach from a
- different layer. */
+ is already stopped. Mark it as stopped in the data structure
+ that the lin-lwp layer uses to keep track of threads. Note
+ that this won't have already been done since the main thread
+ will have, we assume, been stopped by an attach from a
+ different layer. */
lp->stopped = 1;
}
}
@@ -455,8 +454,7 @@ lin_lwp_attach (char *args, int from_tty)
if (debug_lin_lwp)
{
fprintf_unfiltered (gdb_stdlog,
- "LLA: waitpid %ld, faking SIGSTOP\n",
- (long) pid);
+ "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
}
}
@@ -467,7 +465,7 @@ detach_callback (struct lwp_info *lp, void *data)
if (debug_lin_lwp && lp->status)
fprintf_unfiltered (gdb_stdlog, "DC: Pending %s for %s on detach.\n",
- strsignal (WSTOPSIG (lp->status)),
+ strsignal (WSTOPSIG (lp->status)),
target_pid_to_str (lp->ptid));
while (lp->signalled && lp->stopped)
@@ -479,10 +477,10 @@ detach_callback (struct lwp_info *lp, void *data)
safe_strerror (errno));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
target_pid_to_str (lp->ptid),
- status_to_str (lp->status));
+ status_to_str (lp->status));
lp->stopped = 0;
lp->signalled = 0;
@@ -505,7 +503,7 @@ detach_callback (struct lwp_info *lp, void *data)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"PTRACE_DETACH (%s, %s, 0) (OK)\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
strsignal (WSTOPSIG (lp->status)));
delete_lwp (lp->ptid);
@@ -547,7 +545,7 @@ resume_callback (struct lwp_info *lp, void *data)
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
target_pid_to_str (lp->ptid));
lp->stopped = 0;
@@ -606,13 +604,13 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
if (lp->status)
{
/* FIXME: What should we do if we are supposed to continue
- this thread with a signal? */
+ this thread with a signal? */
gdb_assert (signo == TARGET_SIGNAL_0);
return;
}
/* Mark LWP as not stopped to prevent it from being continued by
- resume_callback. */
+ resume_callback. */
lp->stopped = 0;
}
@@ -634,7 +632,7 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
static int
stop_callback (struct lwp_info *lp, void *data)
{
- if (! lp->stopped && ! lp->signalled)
+ if (!lp->stopped && !lp->signalled)
{
int ret;
@@ -662,7 +660,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
{
sigset_t *flush_mask = data;
- if (! lp->stopped && lp->signalled)
+ if (!lp->stopped && lp->signalled)
{
pid_t pid;
int status;
@@ -681,7 +679,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
{
fprintf_unfiltered (gdb_stdlog,
"SWC: waitpid %s received %s\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
status_to_str (status));
}
@@ -692,14 +690,14 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (in_thread_list (lp->ptid))
{
/* Core GDB cannot deal with us deleting the current
- thread. */
+ thread. */
if (!ptid_equal (lp->ptid, inferior_ptid))
delete_thread (lp->ptid);
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->ptid));
}
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n",
+ fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n",
target_pid_to_str (lp->ptid));
delete_lwp (lp->ptid);
@@ -727,29 +725,29 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (WSTOPSIG (status) == SIGTRAP)
{
/* If a LWP other than the LWP that we're reporting an
- event for has hit a GDB breakpoint (as opposed to
- some random trap signal), then just arrange for it to
- hit it again later. We don't keep the SIGTRAP status
- and don't forward the SIGTRAP signal to the LWP. We
- will handle the current event, eventually we will
- resume all LWPs, and this one will get its breakpoint
- trap again.
-
- If we do not do this, then we run the risk that the
- user will delete or disable the breakpoint, but the
- thread will have already tripped on it. */
+ event for has hit a GDB breakpoint (as opposed to
+ some random trap signal), then just arrange for it to
+ hit it again later. We don't keep the SIGTRAP status
+ and don't forward the SIGTRAP signal to the LWP. We
+ will handle the current event, eventually we will
+ resume all LWPs, and this one will get its breakpoint
+ trap again.
+
+ If we do not do this, then we run the risk that the
+ user will delete or disable the breakpoint, but the
+ thread will have already tripped on it. */
/* Now resume this LWP and get the SIGSTOP event. */
errno = 0;
ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"PTRACE_CONT %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: Candidate SIGTRAP event in %s\n",
target_pid_to_str (lp->ptid));
}
@@ -767,39 +765,39 @@ stop_wait_callback (struct lwp_info *lp, void *data)
else
{
/* The thread was stopped with a signal other than
- SIGSTOP, and didn't accidentally trip a breakpoint. */
+ SIGSTOP, and didn't accidentally trip a breakpoint. */
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: Pending event %s in %s\n",
- status_to_str ((int) status),
+ status_to_str ((int) status),
target_pid_to_str (lp->ptid));
}
/* Now resume this LWP and get the SIGSTOP event. */
errno = 0;
ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
/* Hold this event/waitstatus while we check to see if
- there are any more (we still want to get that SIGSTOP). */
+ there are any more (we still want to get that SIGSTOP). */
stop_wait_callback (lp, data);
/* If the lp->status field is still empty, use it to hold
- this event. If not, then this event must be returned
- to the event queue of the LWP. */
+ this event. If not, then this event must be returned
+ to the event queue of the LWP. */
if (lp->status == 0)
lp->status = status;
else
{
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: kill %s, %s\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
status_to_str ((int) status));
}
kill (GET_LWP (lp->ptid), WSTOPSIG (status));
@@ -810,7 +808,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
else
{
/* We caught the SIGSTOP that we intended to catch, so
- there's no SIGSTOP pending. */
+ there's no SIGSTOP pending. */
lp->stopped = 1;
lp->signalled = 0;
}
@@ -904,8 +902,8 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data)
tripped on it. */
if (lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
- && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
+ && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
+ && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
DECR_PC_AFTER_BREAK))
{
if (debug_lin_lwp)
@@ -948,7 +946,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
else
{
/* No single-stepping LWP. Select one at random, out of those
- which have had SIGTRAP events. */
+ which have had SIGTRAP events. */
/* First see how many SIGTRAP events we have. */
iterate_over_lwps (count_events_callback, &num_events);
@@ -958,8 +956,8 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
((num_events * (double) rand ()) / (RAND_MAX + 1.0));
if (debug_lin_lwp && num_events > 1)
- fprintf_unfiltered (gdb_stdlog,
- "SEL: Found %d SIGTRAP events, selecting #%d\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "SEL: Found %d SIGTRAP events, selecting #%d\n",
num_events, random_selector);
event_lp = iterate_over_lwps (select_event_lwp_callback,
@@ -970,7 +968,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
{
/* Switch the event LWP. */
*orig_lp = event_lp;
- *status = event_lp->status;
+ *status = event_lp->status;
}
/* Flush the wait status for the event LWP. */
@@ -1014,17 +1012,16 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"CW: waitpid %ld received %s\n",
- (long) pid,
- status_to_str (status));
+ (long) pid, status_to_str (status));
}
save_errno = errno;
/* Make sure we don't report an event for the exit of the
- original program, if we've detached from it. */
- if (pid != -1 && ! WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
+ original program, if we've detached from it. */
+ if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
{
pid = -1;
save_errno = EINTR;
@@ -1037,7 +1034,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (pid == -1)
{
- warning ("Child process unexpectedly missing: %s",
+ warning ("Child process unexpectedly missing: %s",
safe_strerror (errno));
/* Claim it exited with unknown signal. */
@@ -1064,13 +1061,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
sigemptyset (&flush_mask);
/* Make sure SIGCHLD is blocked. */
- if (! sigismember (&blocked_mask, SIGCHLD))
+ if (!sigismember (&blocked_mask, SIGCHLD))
{
sigaddset (&blocked_mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
}
- retry:
+retry:
/* Make sure there is at least one LWP that has been resumed, at
least if there are any LWPs at all. */
@@ -1089,7 +1086,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp && status)
fprintf_unfiltered (gdb_stdlog,
"LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
+ status_to_str (status),
target_pid_to_str (lp->ptid));
}
@@ -1101,7 +1098,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
else if (is_lwp (ptid))
{
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: Waiting for specific LWP %s.\n",
target_pid_to_str (ptid));
@@ -1114,7 +1111,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp && status)
fprintf_unfiltered (gdb_stdlog,
"LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
+ status_to_str (status),
target_pid_to_str (lp->ptid));
/* If we have to wait, take into account whether PID is a cloned
@@ -1127,19 +1124,19 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (status && lp->signalled)
{
/* A pending SIGSTOP may interfere with the normal stream of
- events. In a typical case where interference is a problem,
- we have a SIGSTOP signal pending for LWP A while
- single-stepping it, encounter an event in LWP B, and take the
- pending SIGSTOP while trying to stop LWP A. After processing
- the event in LWP B, LWP A is continued, and we'll never see
- the SIGTRAP associated with the last time we were
- single-stepping LWP A. */
+ events. In a typical case where interference is a problem,
+ we have a SIGSTOP signal pending for LWP A while
+ single-stepping it, encounter an event in LWP B, and take the
+ pending SIGSTOP while trying to stop LWP A. After processing
+ the event in LWP B, LWP A is continued, and we'll never see
+ the SIGTRAP associated with the last time we were
+ single-stepping LWP A. */
/* Resume the thread. It should halt immediately returning the
- pending SIGSTOP. */
+ pending SIGSTOP. */
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ TARGET_SIGNAL_0);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@@ -1152,8 +1149,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
stop_wait_callback (lp, NULL);
}
- set_sigint_trap (); /* Causes SIGINT to be passed on to the
- attached process. */
+ set_sigint_trap (); /* Causes SIGINT to be passed on to the
+ attached process. */
set_sigio_trap ();
while (status == 0)
@@ -1169,8 +1166,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
fprintf_unfiltered (gdb_stdlog,
"LLW: waitpid %ld received %s\n",
- (long) lwpid,
- status_to_str (status));
+ (long) lwpid, status_to_str (status));
}
lp = find_lwp_pid (pid_to_ptid (lwpid));
@@ -1179,13 +1175,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
our list, i.e. not part of the current process. This can happen
if we detach from a program we original forked and then it
exits. */
- if (! WIFSTOPPED (status) && ! lp)
+ if (!WIFSTOPPED (status) && !lp)
{
status = 0;
continue;
}
- if (! lp)
+ if (!lp)
{
lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
if (options & __WCLONE)
@@ -1197,10 +1193,10 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
&& WSTOPSIG (status) == SIGSTOP);
lp->signalled = 1;
- if (! in_thread_list (inferior_ptid))
+ if (!in_thread_list (inferior_ptid))
{
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
- GET_PID (inferior_ptid));
+ GET_PID (inferior_ptid));
add_thread (inferior_ptid);
}
@@ -1211,22 +1207,22 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
/* Make sure we don't report a TARGET_WAITKIND_EXITED or
- TARGET_WAITKIND_SIGNALLED event if there are still LWP's
- left in the process. */
+ TARGET_WAITKIND_SIGNALLED event if there are still LWP's
+ left in the process. */
if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
{
if (in_thread_list (lp->ptid))
{
/* Core GDB cannot deal with us deleting the current
- thread. */
- if (! ptid_equal (lp->ptid, inferior_ptid))
+ thread. */
+ if (!ptid_equal (lp->ptid, inferior_ptid))
delete_thread (lp->ptid);
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->ptid));
}
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s exited.\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s exited.\n",
target_pid_to_str (lp->ptid));
delete_lwp (lp->ptid);
@@ -1240,13 +1236,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
/* Make sure we don't report a SIGSTOP that we sent
- ourselves in an attempt to stop an LWP. */
+ ourselves in an attempt to stop an LWP. */
if (lp->signalled
- && WIFSTOPPED (status)
- && WSTOPSIG (status) == SIGSTOP)
+ && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
{
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: Delayed SIGSTOP caught for %s.\n",
target_pid_to_str (lp->ptid));
@@ -1255,11 +1250,11 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ TARGET_SIGNAL_0);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
- lp->step ?
+ lp->step ?
"PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid));
@@ -1309,16 +1304,17 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
&& signal_pass_state (signo) == 1)
{
/* FIMXE: kettenis/2001-06-06: Should we resume all threads
- here? It is not clear we should. GDB may not expect
- other threads to run. On the other hand, not resuming
- newly attached threads may cause an unwanted delay in
- getting them running. */
+ here? It is not clear we should. GDB may not expect
+ other threads to run. On the other hand, not resuming
+ newly attached threads may cause an unwanted delay in
+ getting them running. */
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ lp->step ?
+ "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid),
signo ? strsignal (signo) : "0");
lp->stopped = 0;
@@ -1326,13 +1322,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
goto retry;
}
- if (signo == TARGET_SIGNAL_INT
- && signal_pass_state (signo) == 0)
+ if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
{
/* If ^C/BREAK is typed at the tty/console, SIGINT gets
- forwarded to the entire process group, that is, all LWP's
- will receive it. Since we only want to report it once,
- we try to flush it from all LWPs except this one. */
+ forwarded to the entire process group, that is, all LWP's
+ will receive it. Since we only want to report it once,
+ we try to flush it from all LWPs except this one. */
sigaddset (&flush_mask, SIGINT);
}
}
@@ -1342,8 +1337,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
- status_to_str (status),
- target_pid_to_str (lp->ptid));
+ status_to_str (status), target_pid_to_str (lp->ptid));
/* Now stop all other LWP's ... */
iterate_over_lwps (stop_callback, NULL);
@@ -1370,7 +1364,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: trap_ptid is %s.\n",
target_pid_to_str (trap_ptid));
}
@@ -1387,7 +1381,7 @@ kill_callback (struct lwp_info *lp, void *data)
errno = 0;
ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"KC: PTRACE_KILL %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
@@ -1430,7 +1424,7 @@ kill_wait_callback (struct lwp_info *lp, void *data)
if (pid != (pid_t) -1 && debug_lin_lwp)
{
fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unk.\n",
+ "KWC: wait %s received unk.\n",
target_pid_to_str (lp->ptid));
}
}
@@ -1458,7 +1452,7 @@ lin_lwp_create_inferior (char *exec_file, char *allargs, char **env)
child_ops.to_create_inferior (exec_file, allargs, env);
}
-static void
+static void
lin_lwp_mourn_inferior (void)
{
trap_ptid = null_ptid;
@@ -1475,8 +1469,7 @@ lin_lwp_mourn_inferior (void)
static int
lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
+ struct mem_attrib *attrib, struct target_ops *target)
{
struct cleanup *old_chain = save_inferior_ptid ();
int xfer;
@@ -1502,7 +1495,7 @@ lin_lwp_thread_alive (ptid_t ptid)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
- target_pid_to_str (ptid),
+ target_pid_to_str (ptid),
errno ? safe_strerror (errno) : "OK");
if (errno)
return 0;
@@ -1586,11 +1579,9 @@ _initialize_lin_lwp (void)
sigemptyset (&blocked_mask);
add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
- (char *) &debug_lin_lwp,
+ (char *) &debug_lin_lwp,
"Set debugging of GNU/Linux lwp module.\n\
-Enables printf debugging output.\n",
- &setdebuglist),
- &showdebuglist);
+Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
}
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
index 00383e9..a951296 100644
--- a/gdb/linux-proc.c
+++ b/gdb/linux-proc.c
@@ -21,17 +21,17 @@
#include "defs.h"
#include "inferior.h"
-#include <sys/param.h> /* for MAXPATHLEN */
-#include <sys/procfs.h> /* for elf_gregset etc. */
-#include "gdb_stat.h" /* for struct stat */
-#include <ctype.h> /* for isdigit */
-#include <unistd.h> /* for open, pread64 */
-#include <fcntl.h> /* for O_RDONLY */
-#include "regcache.h" /* for registers_changed */
-#include "gregset.h" /* for gregset */
-#include "gdbcore.h" /* for get_exec_file */
-#include "gdbthread.h" /* for struct thread_info etc. */
-#include "elf-bfd.h" /* for elfcore_write_* */
+#include <sys/param.h> /* for MAXPATHLEN */
+#include <sys/procfs.h> /* for elf_gregset etc. */
+#include "gdb_stat.h" /* for struct stat */
+#include <ctype.h> /* for isdigit */
+#include <unistd.h> /* for open, pread64 */
+#include <fcntl.h> /* for O_RDONLY */
+#include "regcache.h" /* for registers_changed */
+#include "gregset.h" /* for gregset */
+#include "gdbcore.h" /* for get_exec_file */
+#include "gdbthread.h" /* for struct thread_info etc. */
+#include "elf-bfd.h" /* for elfcore_write_* */
#include "cli/cli-decode.h" /* for add_info */
#include "gdb_string.h"
@@ -69,28 +69,26 @@ child_pid_to_exec_file (int pid)
* Service function for corefiles and info proc.
*/
-static int
-read_mapping (FILE *mapfile,
- long long *addr,
- long long *endaddr,
- char *permissions,
- long long *offset,
- char *device,
- long long *inode,
- char *filename)
+static int
+read_mapping (FILE *mapfile,
+ long long *addr,
+ long long *endaddr,
+ char *permissions,
+ long long *offset,
+ char *device, long long *inode, char *filename)
{
- int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
+ int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
addr, endaddr, permissions, offset, device, inode);
if (ret > 0 && ret != EOF && *inode != 0)
{
/* Eat everything up to EOL for the filename. This will prevent
- weird filenames (such as one with embedded whitespace) from
- confusing this code. It also makes this code more robust
- in respect to annotations the kernel may add after the
- filename.
+ weird filenames (such as one with embedded whitespace) from
+ confusing this code. It also makes this code more robust
+ in respect to annotations the kernel may add after the
+ filename.
- Note the filename is used for informational purposes only. */
+ Note the filename is used for informational purposes only. */
ret += fscanf (mapfile, "%[^\n]\n", filename);
}
else
@@ -108,11 +106,9 @@ read_mapping (FILE *mapfile,
*/
static int
-linux_find_memory_regions (int (*func) (CORE_ADDR,
+linux_find_memory_regions (int (*func) (CORE_ADDR,
unsigned long,
- int, int, int,
- void *),
- void *obfd)
+ int, int, int, void *), void *obfd)
{
long long pid = PIDGET (inferior_ptid);
char mapsfilename[MAXPATHLEN];
@@ -128,31 +124,29 @@ linux_find_memory_regions (int (*func) (CORE_ADDR,
error ("Could not open %s\n", mapsfilename);
if (info_verbose)
- fprintf_filtered (gdb_stdout,
+ fprintf_filtered (gdb_stdout,
"Reading memory regions from %s\n", mapsfilename);
/* Now iterate until end-of-file. */
- while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
+ while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
&offset, &device[0], &inode, &filename[0]))
{
size = endaddr - addr;
/* Get the segment's permissions. */
- read = (strchr (permissions, 'r') != 0);
+ read = (strchr (permissions, 'r') != 0);
write = (strchr (permissions, 'w') != 0);
- exec = (strchr (permissions, 'x') != 0);
+ exec = (strchr (permissions, 'x') != 0);
if (info_verbose)
{
- fprintf_filtered (gdb_stdout,
- "Save segment, %lld bytes at 0x%s (%c%c%c)",
- size, paddr_nz (addr),
- read ? 'r' : ' ',
- write ? 'w' : ' ',
- exec ? 'x' : ' ');
+ fprintf_filtered (gdb_stdout,
+ "Save segment, %lld bytes at 0x%s (%c%c%c)",
+ size, paddr_nz (addr),
+ read ? 'r' : ' ',
+ write ? 'w' : ' ', exec ? 'x' : ' ');
if (filename && filename[0])
- fprintf_filtered (gdb_stdout,
- " for %s", filename);
+ fprintf_filtered (gdb_stdout, " for %s", filename);
fprintf_filtered (gdb_stdout, "\n");
}
@@ -169,7 +163,7 @@ linux_find_memory_regions (int (*func) (CORE_ADDR,
*/
static char *
-linux_do_thread_registers (bfd *obfd, ptid_t ptid,
+linux_do_thread_registers (bfd *obfd, ptid_t ptid,
char *note_data, int *note_size)
{
gdb_gregset_t gregs;
@@ -180,26 +174,23 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid,
unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
fill_gregset (&gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
- note_data,
- note_size,
- merged_pid,
- stop_signal,
- &gregs);
+ note_data = (char *) elfcore_write_prstatus (obfd,
+ note_data,
+ note_size,
+ merged_pid,
+ stop_signal, &gregs);
fill_fpregset (&fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
- note_data,
- note_size,
- &fpregs,
- sizeof (fpregs));
+ note_data = (char *) elfcore_write_prfpreg (obfd,
+ note_data,
+ note_size,
+ &fpregs, sizeof (fpregs));
#ifdef FILL_FPXREGSET
fill_fpxregset (&fpxregs, -1);
- note_data = (char *) elfcore_write_prxfpreg (obfd,
- note_data,
- note_size,
- &fpxregs,
- sizeof (fpxregs));
+ note_data = (char *) elfcore_write_prxfpreg (obfd,
+ note_data,
+ note_size,
+ &fpxregs, sizeof (fpxregs));
#endif
return note_data;
}
@@ -228,9 +219,9 @@ linux_corefile_thread_callback (struct thread_info *ti, void *data)
registers_changed ();
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,
- args->note_data,
+ args->note_data = linux_do_thread_registers (args->obfd,
+ ti->ptid,
+ args->note_data,
args->note_size);
args->num_notes++;
inferior_ptid = saved_ptid;
@@ -252,28 +243,24 @@ linux_make_note_section (bfd *obfd, int *note_size)
{
struct linux_corefile_thread_data thread_args;
struct cleanup *old_chain;
- char fname[16] = {'\0'};
- char psargs[80] = {'\0'};
+ char fname[16] = { '\0' };
+ char psargs[80] = { '\0' };
char *note_data = NULL;
ptid_t current_ptid = inferior_ptid;
if (get_exec_file (0))
{
strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
- strncpy (psargs, get_exec_file (0),
- sizeof (psargs));
+ strncpy (psargs, get_exec_file (0), sizeof (psargs));
if (get_inferior_args ())
{
- strncat (psargs, " ",
- sizeof (psargs) - strlen (psargs));
- strncat (psargs, get_inferior_args (),
+ strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
+ strncat (psargs, get_inferior_args (),
sizeof (psargs) - strlen (psargs));
}
- note_data = (char *) elfcore_write_prpsinfo (obfd,
- note_data,
- note_size,
- fname,
- psargs);
+ note_data = (char *) elfcore_write_prpsinfo (obfd,
+ note_data,
+ note_size, fname, psargs);
}
/* Dump information for threads. */
@@ -285,8 +272,8 @@ linux_make_note_section (bfd *obfd, int *note_size)
if (thread_args.num_notes == 0)
{
/* iterate_over_threads didn't come up with any threads;
- just use inferior_ptid. */
- note_data = linux_do_thread_registers (obfd, inferior_ptid,
+ just use inferior_ptid. */
+ note_data = linux_do_thread_registers (obfd, inferior_ptid,
note_data, note_size);
}
else
@@ -420,33 +407,30 @@ linux_info_proc_cmd (char *args, int from_tty)
if (TARGET_ADDR_BIT == 32)
{
header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
- data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
+ data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
}
else
{
header_fmt_string = " %18s %18s %10s %10s %7s\n";
- data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
+ data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
}
printf_filtered ("Mapped address spaces:\n\n");
- printf_filtered (header_fmt_string,
+ printf_filtered (header_fmt_string,
"Start Addr",
" End Addr",
- " Size",
- " Offset",
- "objfile");
-
- while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
+ " Size", " Offset", "objfile");
+
+ while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
&offset, &device[0], &inode, &filename[0]))
{
size = endaddr - addr;
- printf_filtered (data_fmt_string,
- (unsigned long) addr, /* FIXME: pr_addr */
- (unsigned long) endaddr,
- (int) size,
- (unsigned int) offset,
+ printf_filtered (data_fmt_string, (unsigned long) addr, /* FIXME: pr_addr */
+ (unsigned long) endaddr,
+ (int) size,
+ (unsigned int) offset,
filename[0] ? filename : "");
-
+
}
fclose (procfile);
@@ -463,7 +447,7 @@ linux_info_proc_cmd (char *args, int from_tty)
printf_filtered (buffer);
fclose (procfile);
}
- else
+ else
warning ("unable to open /proc file '%s'", fname1);
}
if (stat_f || all)
@@ -493,16 +477,16 @@ linux_info_proc_cmd (char *args, int from_tty)
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("Flags: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults (no memory page): %u\n",
+ printf_filtered ("Minor faults (no memory page): %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults, children: %u\n",
+ printf_filtered ("Minor faults, children: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults (memory page faults): %u\n",
+ printf_filtered ("Major faults (memory page faults): %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults, children: %u\n",
+ printf_filtered ("Major faults, children: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("utime: %d\n", itmp);
@@ -513,36 +497,34 @@ linux_info_proc_cmd (char *args, int from_tty)
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("stime, children: %d\n", itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("jiffies remaining in current time slice: %d\n",
+ printf_filtered ("jiffies remaining in current time slice: %d\n",
itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("'nice' value: %d\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next timeout: %u\n",
+ printf_filtered ("jiffies until next timeout: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next SIGALRM: %u\n",
+ printf_filtered ("jiffies until next SIGALRM: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("start time (jiffies since system boot): %d\n",
+ printf_filtered ("start time (jiffies since system boot): %d\n",
itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Virtual memory size: %u\n",
+ printf_filtered ("Virtual memory size: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Resident set size: %u\n",
- (unsigned int) itmp);
+ printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("rlim: %u\n",
- (unsigned int) itmp);
+ printf_filtered ("rlim: %u\n", (unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("Start of text: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
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...
- Anyway the signal bitmap info is available from "status". */
+#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);
if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
@@ -574,7 +556,7 @@ _initialize_linux_proc (void)
inftarg_set_find_memory_regions (linux_find_memory_regions);
inftarg_set_make_corefile_notes (linux_make_note_section);
- add_info ("proc", linux_info_proc_cmd,
+ add_info ("proc", linux_info_proc_cmd,
"Show /proc process information about any running process.\n\
Specify any process id, or use the program being debugged by default.\n\
Specify any of the following keywords for detailed info:\n\
@@ -584,9 +566,9 @@ Specify any of the following keywords for detailed info:\n\
all -- list all available /proc info.");
}
-int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
+int
+linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib, struct target_ops *target)
{
int fd, ret;
char filename[64];
@@ -616,8 +598,7 @@ int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
#ifdef HAVE_PREAD64
if (pread64 (fd, myaddr, len, addr) != len)
#else
- if (lseek (fd, addr, SEEK_SET) == -1
- || read (fd, myaddr, len) != len)
+ if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
#endif
ret = 0;
else
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 48c6931..4932cdf 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -427,6 +427,7 @@ const struct language_defn m2_language_defn =
m2_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"%loB", "", "o", "B"}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 02ba5c0..ef54821 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1369,7 +1369,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM);
set_gdbarch_fp_regnum (gdbarch, SOFT_FP_REGNUM);
@@ -1380,20 +1380,14 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_pseudo_register_read (gdbarch, m68hc11_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, m68hc11_pseudo_register_write);
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_call_dummy_address (gdbarch, m68hc11_call_dummy_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, m68hc11_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (m68hc11_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments);
- set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, m68hc11_push_return_address);
set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index a72ea53..7a9886b 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -1038,10 +1038,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 24);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_length (gdbarch, 28);
set_gdbarch_call_dummy_start_offset (gdbarch, 12);
@@ -1051,6 +1049,9 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_push_dummy_frame (gdbarch, m68k_push_dummy_frame);
set_gdbarch_deprecated_pop_frame (gdbarch, m68k_pop_frame);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/maint.c b/gdb/maint.c
index f2dfa68..166acdb 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -151,17 +151,8 @@ maintenance_demangle (char *args, int from_tty)
}
else
{
- switch (current_language->la_language)
- {
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /* demangled = objc_demangle (args); */
- /* break; */
- case language_cplus:
- default:
- demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
- break;
- }
+ demangled = language_demangle (current_language, args,
+ DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{
printf_unfiltered ("%s\n", demangled);
diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c
index e3070b3..21f3ce6 100644
--- a/gdb/mcore-tdep.c
+++ b/gdb/mcore-tdep.c
@@ -1116,22 +1116,15 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Call Dummies: */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc);
- set_gdbarch_push_return_address (gdbarch, mcore_push_return_address);
- set_gdbarch_push_arguments (gdbarch, mcore_push_arguments);
- set_gdbarch_call_dummy_length (gdbarch, 0);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mcore_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments);
/* Frames: */
@@ -1163,6 +1156,9 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
between registers and stack. */
set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 1785b9b..73b4975 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,17 @@
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * mi-cmd-file.c: New file to implement mi file commands.
+ * mi-getopt.c (mi_valid_noargs): Added mi_valid_noargs to verify
+ if a set of parameters passed to an MI function has no arguments
+ * mi-getopt.h (mi_valid_noargs): Declare.
+ * mi-cmds.c (mi_cmds): Added -file-list-exec-source-file command.
+ * mi-cmds.h (mi_cmd_file_list_exec_source_file): Declare.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * gdbmi.texinfo: Delete file. Contents moved to
+ ../doc/gdb.texinfo.
+
2003-03-12 Andrew Cagney <cagney@redhat.com>
* mi-main.c (get_register): Use frame_register instead of
diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo
deleted file mode 100644
index da8b77c..0000000
--- a/gdb/mi/gdbmi.texinfo
+++ /dev/null
@@ -1,3902 +0,0 @@
-@c \input texinfo @c -*-texinfo-*-
-@c @c %**start of header
-@c @setfilename gdbmi.info
-@c @settitle GDB/MI Machine Interface
-@c @setchapternewpage off
-@c @c %**end of header
-
-@c @ifinfo
-@c This file documents GDB/MI, a Machine Interface to GDB.
-
-@c Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-@c Contributed by Cygnus Solutions.
-
-@c Permission is granted to copy, distribute and/or modify this document
-@c under the terms of the GNU Free Documentation License, Version 1.1 or
-@c any later version published by the Free Software Foundation; with no
-@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
-@c and with the Back-Cover Texts as in (a) below.
-
-@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-@c this GNU Manual, like GNU software. Copies published by the Free
-@c Software Foundation raise funds for GNU development.''
-@c @end ifinfo
-
-@c @c This title page illustrates only one of the
-@c @c two methods of forming a title page.
-
-@c @titlepage
-@c @title GDB/MI
-@c @subtitle Version 0.3
-@c @subtitle Apr 2001
-@c @author Andrew Cagney, Fernando Nasser and Elena Zannoni
-
-@c @c The following two commands
-@c @c start the copyright page.
-@c @page
-@c @vskip 0pt plus 1filll
-
-@c Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
-
-@c Permission is granted to copy, distribute and/or modify this document
-@c under the terms of the GNU Free Documentation License, Version 1.1 or
-@c any later version published by the Free Software Foundation; with no
-@c Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
-@c and with the Back-Cover Texts as in (a) below.
-
-@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-@c this GNU Manual, like GNU software. Copies published by the Free
-@c Software Foundation raise funds for GNU development.''
-@c @end titlepage
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI
-@chapter The @sc{gdb/mi} Interface
-
-@unnumberedsec Function and Purpose
-
-@cindex @sc{gdb/mi}, its purpose
-@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
-specifically intended to support the development of systems which use
-the debugger as just one small component of a larger system.
-
-This chapter is a specification of the @sc{gdb/mi} interface. It is written
-in the form of a reference manual.
-
-Note that @sc{gdb/mi} is still under construction, so some of the
-features described below are incomplete and subject to change.
-
-@unnumberedsec Notation and Terminology
-
-@cindex notational conventions, for @sc{gdb/mi}
-This chapter uses the following notation:
-
-@itemize @bullet
-@item
-@code{|} separates two alternatives.
-
-@item
-@code{[ @var{something} ]} indicates that @var{something} is optional:
-it may or may not be given.
-
-@item
-@code{( @var{group} )*} means that @var{group} inside the parentheses
-may repeat zero or more times.
-
-@item
-@code{( @var{group} )+} means that @var{group} inside the parentheses
-may repeat one or more times.
-
-@item
-@code{"@var{string}"} means a literal @var{string}.
-@end itemize
-
-@ignore
-@heading Dependencies
-@end ignore
-
-@heading Acknowledgments
-
-In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
-Elena Zannoni.
-
-@menu
-* GDB/MI Command Syntax::
-* GDB/MI Compatibility with CLI::
-* GDB/MI Output Records::
-* GDB/MI Command Description Format::
-* GDB/MI Breakpoint Table Commands::
-* GDB/MI Data Manipulation::
-* GDB/MI Program Control::
-* GDB/MI Miscellaneous Commands::
-@ignore
-* GDB/MI Kod Commands::
-* GDB/MI Memory Overlay Commands::
-* GDB/MI Signal Handling Commands::
-@end ignore
-* GDB/MI Stack Manipulation::
-* GDB/MI Symbol Query::
-* GDB/MI Target Manipulation::
-* GDB/MI Thread Commands::
-* GDB/MI Tracepoint Commands::
-* GDB/MI Variable Objects::
-@end menu
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Command Syntax
-@section @sc{gdb/mi} Command Syntax
-
-@menu
-* GDB/MI Input Syntax::
-* GDB/MI Output Syntax::
-* GDB/MI Simple Examples::
-@end menu
-
-@node GDB/MI Input Syntax
-@subsection @sc{gdb/mi} Input Syntax
-
-@cindex input syntax for @sc{gdb/mi}
-@cindex @sc{gdb/mi}, input syntax
-@table @code
-@item @var{command} @expansion{}
-@code{@var{cli-command} | @var{mi-command}}
-
-@item @var{cli-command} @expansion{}
-@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
-@var{cli-command} is any existing @value{GDBN} CLI command.
-
-@item @var{mi-command} @expansion{}
-@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
-@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
-
-@item @var{token} @expansion{}
-"any sequence of digits"
-
-@item @var{option} @expansion{}
-@code{"-" @var{parameter} [ " " @var{parameter} ]}
-
-@item @var{parameter} @expansion{}
-@code{@var{non-blank-sequence} | @var{c-string}}
-
-@item @var{operation} @expansion{}
-@emph{any of the operations described in this chapter}
-
-@item @var{non-blank-sequence} @expansion{}
-@emph{anything, provided it doesn't contain special characters such as
-"-", @var{nl}, """ and of course " "}
-
-@item @var{c-string} @expansion{}
-@code{""" @var{seven-bit-iso-c-string-content} """}
-
-@item @var{nl} @expansion{}
-@code{CR | CR-LF}
-@end table
-
-@noindent
-Notes:
-
-@itemize @bullet
-@item
-The CLI commands are still handled by the @sc{mi} interpreter; their
-output is described below.
-
-@item
-The @code{@var{token}}, when present, is passed back when the command
-finishes.
-
-@item
-Some @sc{mi} commands accept optional arguments as part of the parameter
-list. Each option is identified by a leading @samp{-} (dash) and may be
-followed by an optional argument parameter. Options occur first in the
-parameter list and can be delimited from normal parameters using
-@samp{--} (this is useful when some parameters begin with a dash).
-@end itemize
-
-Pragmatics:
-
-@itemize @bullet
-@item
-We want easy access to the existing CLI syntax (for debugging).
-
-@item
-We want it to be easy to spot a @sc{mi} operation.
-@end itemize
-
-@node GDB/MI Output Syntax
-@subsection @sc{gdb/mi} Output Syntax
-
-@cindex output syntax of @sc{gdb/mi}
-@cindex @sc{gdb/mi}, output syntax
-The output from @sc{gdb/mi} consists of zero or more out-of-band records
-followed, optionally, by a single result record. This result record
-is for the most recent command. The sequence of output records is
-terminated by @samp{(@value{GDBP})}.
-
-If an input command was prefixed with a @code{@var{token}} then the
-corresponding output for that command will also be prefixed by that same
-@var{token}.
-
-@table @code
-@item @var{output} @expansion{}
-@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
-
-@item @var{result-record} @expansion{}
-@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
-
-@item @var{out-of-band-record} @expansion{}
-@code{@var{async-record} | @var{stream-record}}
-
-@item @var{async-record} @expansion{}
-@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
-
-@item @var{exec-async-output} @expansion{}
-@code{[ @var{token} ] "*" @var{async-output}}
-
-@item @var{status-async-output} @expansion{}
-@code{[ @var{token} ] "+" @var{async-output}}
-
-@item @var{notify-async-output} @expansion{}
-@code{[ @var{token} ] "=" @var{async-output}}
-
-@item @var{async-output} @expansion{}
-@code{@var{async-class} ( "," @var{result} )* @var{nl}}
-
-@item @var{result-class} @expansion{}
-@code{"done" | "running" | "connected" | "error" | "exit"}
-
-@item @var{async-class} @expansion{}
-@code{"stopped" | @var{others}} (where @var{others} will be added
-depending on the needs---this is still in development).
-
-@item @var{result} @expansion{}
-@code{ @var{variable} "=" @var{value}}
-
-@item @var{variable} @expansion{}
-@code{ @var{string} }
-
-@item @var{value} @expansion{}
-@code{ @var{const} | @var{tuple} | @var{list} }
-
-@item @var{const} @expansion{}
-@code{@var{c-string}}
-
-@item @var{tuple} @expansion{}
-@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
-
-@item @var{list} @expansion{}
-@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
-@var{result} ( "," @var{result} )* "]" }
-
-@item @var{stream-record} @expansion{}
-@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
-
-@item @var{console-stream-output} @expansion{}
-@code{"~" @var{c-string}}
-
-@item @var{target-stream-output} @expansion{}
-@code{"@@" @var{c-string}}
-
-@item @var{log-stream-output} @expansion{}
-@code{"&" @var{c-string}}
-
-@item @var{nl} @expansion{}
-@code{CR | CR-LF}
-
-@item @var{token} @expansion{}
-@emph{any sequence of digits}.
-@end table
-
-@noindent
-Notes:
-
-@itemize @bullet
-@item
-All output sequences end in a single line containing a period.
-
-@item
-The @code{@var{token}} is from the corresponding request. If an execution
-command is interrupted by the @samp{-exec-interrupt} command, the
-@var{token} associated with the @samp{*stopped} message is the one of the
-original execution command, not the one of the interrupt command.
-
-@item
-@cindex status output in @sc{gdb/mi}
-@var{status-async-output} contains on-going status information about the
-progress of a slow operation. It can be discarded. All status output is
-prefixed by @samp{+}.
-
-@item
-@cindex async output in @sc{gdb/mi}
-@var{exec-async-output} contains asynchronous state change on the target
-(stopped, started, disappeared). All async output is prefixed by
-@samp{*}.
-
-@item
-@cindex notify output in @sc{gdb/mi}
-@var{notify-async-output} contains supplementary information that the
-client should handle (e.g., a new breakpoint information). All notify
-output is prefixed by @samp{=}.
-
-@item
-@cindex console output in @sc{gdb/mi}
-@var{console-stream-output} is output that should be displayed as is in the
-console. It is the textual response to a CLI command. All the console
-output is prefixed by @samp{~}.
-
-@item
-@cindex target output in @sc{gdb/mi}
-@var{target-stream-output} is the output produced by the target program.
-All the target output is prefixed by @samp{@@}.
-
-@item
-@cindex log output in @sc{gdb/mi}
-@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
-instance messages that should be displayed as part of an error log. All
-the log output is prefixed by @samp{&}.
-
-@item
-@cindex list output in @sc{gdb/mi}
-New @sc{gdb/mi} commands should only output @var{lists} containing
-@var{values}.
-
-
-@end itemize
-
-@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
-details about the various output records.
-
-@node GDB/MI Simple Examples
-@subsection Simple Examples of @sc{gdb/mi} Interaction
-@cindex @sc{gdb/mi}, simple examples
-
-This subsection presents several simple examples of interaction using
-the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
-following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
-the output received from @sc{gdb/mi}.
-
-@subsubheading Target Stop
-@c Ummm... There is no "-stop" command. This assumes async, no?
-Here's an example of stopping the inferior process:
-
-@example
--> -stop
-<- (@value{GDBP})
-@end example
-
-@noindent
-and later:
-
-@example
-<- *stop,reason="stop",address="0x123",source="a.c:123"
-<- (@value{GDBP})
-@end example
-
-@subsubheading Simple CLI Command
-
-Here's an example of a simple CLI command being passed through
-@sc{gdb/mi} and on to the CLI.
-
-@example
--> print 1+2
-<- &"print 1+2\n"
-<- ~"$1 = 3\n"
-<- ^done
-<- (@value{GDBP})
-@end example
-
-@subsubheading Command With Side Effects
-
-@example
--> -symbol-file xyz.exe
-<- *breakpoint,nr="3",address="0x123",source="a.c:123"
-<- (@value{GDBP})
-@end example
-
-@subsubheading A Bad Command
-
-Here's what happens if you pass a non-existent command:
-
-@example
--> -rubbish
-<- ^error,msg="Undefined MI command: rubbish"
-<- (@value{GDBP})
-@end example
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Compatibility with CLI
-@section @sc{gdb/mi} Compatibility with CLI
-
-@cindex compatibility, @sc{gdb/mi} and CLI
-@cindex @sc{gdb/mi}, compatibility with CLI
-To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
-accepts existing CLI commands. As specified by the syntax, such
-commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
-respond.
-
-This mechanism is provided as an aid to developers of @sc{gdb/mi}
-clients and not as a reliable interface into the CLI. Since the command
-is being interpreteted in an environment that assumes @sc{gdb/mi}
-behaviour, the exact output of such commands is likely to end up being
-an un-supported hybrid of @sc{gdb/mi} and CLI output.
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Output Records
-@section @sc{gdb/mi} Output Records
-
-@menu
-* GDB/MI Result Records::
-* GDB/MI Stream Records::
-* GDB/MI Out-of-band Records::
-@end menu
-
-@node GDB/MI Result Records
-@subsection @sc{gdb/mi} Result Records
-
-@cindex result records in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, result records
-In addition to a number of out-of-band notifications, the response to a
-@sc{gdb/mi} command includes one of the following result indications:
-
-@table @code
-@findex ^done
-@item "^done" [ "," @var{results} ]
-The synchronous operation was successful, @code{@var{results}} are the return
-values.
-
-@item "^running"
-@findex ^running
-@c Is this one correct? Should it be an out-of-band notification?
-The asynchronous operation was successfully started. The target is
-running.
-
-@item "^error" "," @var{c-string}
-@findex ^error
-The operation failed. The @code{@var{c-string}} contains the corresponding
-error message.
-@end table
-
-@node GDB/MI Stream Records
-@subsection @sc{gdb/mi} Stream Records
-
-@cindex @sc{gdb/mi}, stream records
-@cindex stream records in @sc{gdb/mi}
-@value{GDBN} internally maintains a number of output streams: the console, the
-target, and the log. The output intended for each of these streams is
-funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
-
-Each stream record begins with a unique @dfn{prefix character} which
-identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
-Syntax}). In addition to the prefix, each stream record contains a
-@code{@var{string-output}}. This is either raw text (with an implicit new
-line) or a quoted C string (which does not contain an implicit newline).
-
-@table @code
-@item "~" @var{string-output}
-The console output stream contains text that should be displayed in the
-CLI console window. It contains the textual responses to CLI commands.
-
-@item "@@" @var{string-output}
-The target output stream contains any textual output from the running
-target.
-
-@item "&" @var{string-output}
-The log stream contains debugging messages being produced by @value{GDBN}'s
-internals.
-@end table
-
-@node GDB/MI Out-of-band Records
-@subsection @sc{gdb/mi} Out-of-band Records
-
-@cindex out-of-band records in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, out-of-band records
-@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
-additional changes that have occurred. Those changes can either be a
-consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
-target activity (e.g., target stopped).
-
-The following is a preliminary list of possible out-of-band records.
-
-@table @code
-@item "*" "stop"
-@end table
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Command Description Format
-@section @sc{gdb/mi} Command Description Format
-
-The remaining sections describe blocks of commands. Each block of
-commands is laid out in a fashion similar to this section.
-
-Note the the line breaks shown in the examples are here only for
-readability. They don't appear in the real output.
-Also note that the commands with a non-available example (N.A.@:) are
-not yet implemented.
-
-@subheading Motivation
-
-The motivation for this collection of commands.
-
-@subheading Introduction
-
-A brief introduction to this collection of commands as a whole.
-
-@subheading Commands
-
-For each command in the block, the following is described:
-
-@subsubheading Synopsis
-
-@example
- -command @var{args}@dots{}
-@end example
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} CLI command.
-
-@subsubheading Result
-
-@subsubheading Out-of-band
-
-@subsubheading Notes
-
-@subsubheading Example
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Breakpoint Table Commands
-@section @sc{gdb/mi} Breakpoint table commands
-
-@cindex breakpoint commands for @sc{gdb/mi}
-@cindex @sc{gdb/mi}, breakpoint commands
-This section documents @sc{gdb/mi} commands for manipulating
-breakpoints.
-
-@subheading The @code{-break-after} Command
-@findex -break-after
-
-@subsubheading Synopsis
-
-@example
- -break-after @var{number} @var{count}
-@end example
-
-The breakpoint number @var{number} is not in effect until it has been
-hit @var{count} times. To see how this is reflected in the output of
-the @samp{-break-list} command, see the description of the
-@samp{-break-list} command below.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{ignore}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
-(@value{GDBP})
--break-after 1 3
-~
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
-ignore="3"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@subheading The @code{-break-catch} Command
-@findex -break-catch
-
-@subheading The @code{-break-commands} Command
-@findex -break-commands
-@end ignore
-
-
-@subheading The @code{-break-condition} Command
-@findex -break-condition
-
-@subsubheading Synopsis
-
-@example
- -break-condition @var{number} @var{expr}
-@end example
-
-Breakpoint @var{number} will stop the program only if the condition in
-@var{expr} is true. The condition becomes part of the
-@samp{-break-list} output (see the description of the @samp{-break-list}
-command below).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{condition}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-condition 1 1
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
-times="0",ignore="3"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-delete} Command
-@findex -break-delete
-
-@subsubheading Synopsis
-
-@example
- -break-delete ( @var{breakpoint} )+
-@end example
-
-Delete the breakpoint(s) whose number(s) are specified in the argument
-list. This is obviously reflected in the breakpoint list.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{delete}.
-
-@subsubheading Example
-
-@example
-(@value{GDBP})
--break-delete 1
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[]@}
-(@value{GDBP})
-@end example
-
-@subheading The @code{-break-disable} Command
-@findex -break-disable
-
-@subsubheading Synopsis
-
-@example
- -break-disable ( @var{breakpoint} )+
-@end example
-
-Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
-break list is now set to @samp{n} for the named @var{breakpoint}(s).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{disable}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-disable 2
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-enable} Command
-@findex -break-enable
-
-@subsubheading Synopsis
-
-@example
- -break-enable ( @var{breakpoint} )+
-@end example
-
-Enable (previously disabled) @var{breakpoint}(s).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{enable}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-enable 2
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-info} Command
-@findex -break-info
-
-@subsubheading Synopsis
-
-@example
- -break-info @var{breakpoint}
-@end example
-
-@c REDUNDANT???
-Get information about a single breakpoint.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
-
-@subsubheading Example
-N.A.
-
-@subheading The @code{-break-insert} Command
-@findex -break-insert
-
-@subsubheading Synopsis
-
-@example
- -break-insert [ -t ] [ -h ] [ -r ]
- [ -c @var{condition} ] [ -i @var{ignore-count} ]
- [ -p @var{thread} ] [ @var{line} | @var{addr} ]
-@end example
-
-@noindent
-If specified, @var{line}, can be one of:
-
-@itemize @bullet
-@item function
-@c @item +offset
-@c @item -offset
-@c @item linenum
-@item filename:linenum
-@item filename:function
-@item *address
-@end itemize
-
-The possible optional parameters of this command are:
-
-@table @samp
-@item -t
-Insert a tempoary breakpoint.
-@item -h
-Insert a hardware breakpoint.
-@item -c @var{condition}
-Make the breakpoint conditional on @var{condition}.
-@item -i @var{ignore-count}
-Initialize the @var{ignore-count}.
-@item -r
-Insert a regular breakpoint in all the functions whose names match the
-given regular expression. Other flags are not applicable to regular
-expresson.
-@end table
-
-@subsubheading Result
-
-The result is in the form:
-
-@example
- ^done,bkptno="@var{number}",func="@var{funcname}",
- file="@var{filename}",line="@var{lineno}"
-@end example
-
-@noindent
-where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
-is the name of the function where the breakpoint was inserted,
-@var{filename} is the name of the source file which contains this
-function, and @var{lineno} is the source line number within that file.
-
-Note: this format is open to change.
-@c An out-of-band breakpoint instead of part of the result?
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
-@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(@value{GDBP})
--break-insert -t foo
-^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
-bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
-addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
-(@value{GDBP})
--break-insert -r foo.*
-~int foo(int, int);
-^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-list} Command
-@findex -break-list
-
-@subsubheading Synopsis
-
-@example
- -break-list
-@end example
-
-Displays the list of inserted breakpoints, showing the following fields:
-
-@table @samp
-@item Number
-number of the breakpoint
-@item Type
-type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
-@item Disposition
-should the breakpoint be deleted or disabled when it is hit: @samp{keep}
-or @samp{nokeep}
-@item Enabled
-is the breakpoint enabled or no: @samp{y} or @samp{n}
-@item Address
-memory location at which the breakpoint is set
-@item What
-logical location of the breakpoint, expressed by function name, file
-name, line number
-@item Times
-number of times the breakpoint has been hit
-@end table
-
-If there are no breakpoints or watchpoints, the @code{BreakpointTable}
-@code{body} field is an empty list.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info break}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
-bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-Here's an example of the result when there are no breakpoints:
-
-@smallexample
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-watch} Command
-@findex -break-watch
-
-@subsubheading Synopsis
-
-@example
- -break-watch [ -a | -r ]
-@end example
-
-Create a watchpoint. With the @samp{-a} option it will create an
-@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
-read from or on a write to the memory location. With the @samp{-r}
-option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
-trigger only when the memory location is accessed for reading. Without
-either of the options, the watchpoint created is a regular watchpoint,
-i.e. it will trigger when the memory location is accessed for writing.
-@xref{Set Watchpoints, , Setting watchpoints}.
-
-Note that @samp{-break-list} will report a single list of watchpoints and
-breakpoints inserted.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
-@samp{rwatch}.
-
-@subsubheading Example
-
-Setting a watchpoint on a variable in the @code{main} function:
-
-@smallexample
-(@value{GDBP})
--break-watch x
-^done,wpt=@{number="2",exp="x"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
-value=@{old="-268439212",new="55"@},
-frame=@{func="main",args=[],file="recursive2.c",line="5"@}
-(@value{GDBP})
-@end smallexample
-
-Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
-the program execution twice: first for the variable changing value, then
-for the watchpoint going out of scope.
-
-@smallexample
-(@value{GDBP})
--break-watch C
-^done,wpt=@{number="5",exp="C"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",
-wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-scope",wpnum="5",
-frame=@{func="callee3",args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
-@end smallexample
-
-Listing breakpoints and watchpoints, at different points in the program
-execution. Note that once the watchpoint goes out of scope, it is
-deleted.
-
-@smallexample
-(@value{GDBP})
--break-watch C
-^done,wpt=@{number="2",exp="C"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
-bkpt=@{number="2",type="watchpoint",disp="keep",
-enabled="y",addr="",what="C",times="0"@}]@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
-value=@{old="-276895068",new="3"@},
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
-bkpt=@{number="2",type="watchpoint",disp="keep",
-enabled="y",addr="",what="C",times="-5"@}]@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-scope",wpnum="2",
-frame=@{func="callee3",args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Data Manipulation
-@section @sc{gdb/mi} Data Manipulation
-
-@cindex data manipulation, in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, data manipulation
-This section describes the @sc{gdb/mi} commands that manipulate data:
-examine memory and registers, evaluate expressions, etc.
-
-@c REMOVED FROM THE INTERFACE.
-@c @subheading -data-assign
-@c Change the value of a program variable. Plenty of side effects.
-@c @subsubheading GDB command
-@c set variable
-@c @subsubheading Example
-@c N.A.
-
-@subheading The @code{-data-disassemble} Command
-@findex -data-disassemble
-
-@subsubheading Synopsis
-
-@example
- -data-disassemble
- [ -s @var{start-addr} -e @var{end-addr} ]
- | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
- -- @var{mode}
-@end example
-
-@noindent
-Where:
-
-@table @samp
-@item @var{start-addr}
-is the beginning address (or @code{$pc})
-@item @var{end-addr}
-is the end address
-@item @var{filename}
-is the name of the file to disassemble
-@item @var{linenum}
-is the line number to disassemble around
-@item @var{lines}
-is the the number of disassembly lines to be produced. If it is -1,
-the whole function will be disassembled, in case no @var{end-addr} is
-specified. If @var{end-addr} is specified as a non-zero value, and
-@var{lines} is lower than the number of disassembly lines between
-@var{start-addr} and @var{end-addr}, only @var{lines} lines are
-displayed; if @var{lines} is higher than the number of lines between
-@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
-are displayed.
-@item @var{mode}
-is either 0 (meaning only disassembly) or 1 (meaning mixed source and
-disassembly).
-@end table
-
-@subsubheading Result
-
-The output for each instruction is composed of four fields:
-
-@itemize @bullet
-@item Address
-@item Func-name
-@item Offset
-@item Instruction
-@end itemize
-
-Note that whatever included in the instruction field, is not manipulated
-directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
-
-@subsubheading @value{GDBN} Command
-
-There's no direct mapping from this command to the CLI.
-
-@subsubheading Example
-
-Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -s $pc -e "$pc + 20" -- 0
-^done,
-asm_insns=[
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@},
-@{address="0x000107c8",func-name="main",offset="12",
-inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
-@{address="0x000107cc",func-name="main",offset="16",
-inst="sethi %hi(0x11800), %o2"@},
-@{address="0x000107d0",func-name="main",offset="20",
-inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble the whole @code{main} function. Line 32 is part of
-@code{main}.
-
-@smallexample
--data-disassemble -f basics.c -l 32 -- 0
-^done,asm_insns=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@},
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@},
-[@dots{}]
-@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
-@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble 3 instructions from the start of @code{main}:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -f basics.c -l 32 -n 3 -- 0
-^done,asm_insns=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@},
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble 3 instructions from the start of @code{main} in mixed mode:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -f basics.c -l 32 -n 3 -- 1
-^done,asm_insns=[
-src_and_asm_line=@{line="31",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
- testsuite/gdb.mi/basics.c",line_asm_insn=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@}]@},
-src_and_asm_line=@{line="32",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
- testsuite/gdb.mi/basics.c",line_asm_insn=[
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@}]@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-evaluate-expression} Command
-@findex -data-evaluate-expression
-
-@subsubheading Synopsis
-
-@example
- -data-evaluate-expression @var{expr}
-@end example
-
-Evaluate @var{expr} as an expression. The expression could contain an
-inferior function call. The function call will execute synchronously.
-If the expression contains spaces, it must be enclosed in double quotes.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
-@samp{call}. In @code{gdbtk} only, there's a corresponding
-@samp{gdb_eval} command.
-
-@subsubheading Example
-
-In the following example, the numbers that precede the commands are the
-@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
-Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
-output.
-
-@smallexample
-211-data-evaluate-expression A
-211^done,value="1"
-(@value{GDBP})
-311-data-evaluate-expression &A
-311^done,value="0xefffeb7c"
-(@value{GDBP})
-411-data-evaluate-expression A+3
-411^done,value="4"
-(@value{GDBP})
-511-data-evaluate-expression "A + 3"
-511^done,value="4"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-list-changed-registers} Command
-@findex -data-list-changed-registers
-
-@subsubheading Synopsis
-
-@example
- -data-list-changed-registers
-@end example
-
-Display a list of the registers that have changed.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
-has the corresponding command @samp{gdb_changed_register_list}.
-
-@subsubheading Example
-
-On a PPC MBX board:
-
-@smallexample
-(@value{GDBP})
--exec-continue
-^running
-
-(@value{GDBP})
-*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
-args=[],file="try.c",line="5"@}
-(@value{GDBP})
--data-list-changed-registers
-^done,changed-registers=["0","1","2","4","5","6","7","8","9",
-"10","11","13","14","15","16","17","18","19","20","21","22","23",
-"24","25","26","27","28","30","31","64","65","66","67","69"]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-list-register-names} Command
-@findex -data-list-register-names
-
-@subsubheading Synopsis
-
-@example
- -data-list-register-names [ ( @var{regno} )+ ]
-@end example
-
-Show a list of register names for the current target. If no arguments
-are given, it shows a list of the names of all the registers. If
-integer numbers are given as arguments, it will print a list of the
-names of the registers corresponding to the arguments. To ensure
-consistency between a register name and its number, the output list may
-include empty register names.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} does not have a command which corresponds to
-@samp{-data-list-register-names}. In @code{gdbtk} there is a
-corresponding command @samp{gdb_regnames}.
-
-@subsubheading Example
-
-For the PPC MBX board:
-@smallexample
-(@value{GDBP})
--data-list-register-names
-^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
-"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
-"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
-"r30","r31","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",
-"", "pc","ps","cr","lr","ctr","xer"]
-(@value{GDBP})
--data-list-register-names 1 2 3
-^done,register-names=["r1","r2","r3"]
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-data-list-register-values} Command
-@findex -data-list-register-values
-
-@subsubheading Synopsis
-
-@example
- -data-list-register-values @var{fmt} [ ( @var{regno} )*]
-@end example
-
-Display the registers' contents. @var{fmt} is the format according to
-which the registers' contents are to be returned, followed by an optional
-list of numbers specifying the registers to display. A missing list of
-numbers indicates that the contents of all the registers must be returned.
-
-Allowed formats for @var{fmt} are:
-
-@table @code
-@item x
-Hexadecimal
-@item o
-Octal
-@item t
-Binary
-@item d
-Decimal
-@item r
-Raw
-@item N
-Natural
-@end table
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
-all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
-
-@subsubheading Example
-
-For a PPC MBX board (note: line breaks are for readability only, they
-don't appear in the actual output):
-
-@smallexample
-(@value{GDBP})
--data-list-register-values r 64 65
-^done,register-values=[@{number="64",value="0xfe00a300"@},
-@{number="65",value="0x00029002"@}]
-(@value{GDBP})
--data-list-register-values x
-^done,register-values=[@{number="0",value="0xfe0043c8"@},
-@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
-@{number="3",value="0x0"@},@{number="4",value="0xa"@},
-@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
-@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
-@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
-@{number="11",value="0x1"@},@{number="12",value="0x0"@},
-@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
-@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
-@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
-@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
-@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
-@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
-@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
-@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
-@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
-@{number="31",value="0x0"@},@{number="32",value="0x0"@},
-@{number="33",value="0x0"@},@{number="34",value="0x0"@},
-@{number="35",value="0x0"@},@{number="36",value="0x0"@},
-@{number="37",value="0x0"@},@{number="38",value="0x0"@},
-@{number="39",value="0x0"@},@{number="40",value="0x0"@},
-@{number="41",value="0x0"@},@{number="42",value="0x0"@},
-@{number="43",value="0x0"@},@{number="44",value="0x0"@},
-@{number="45",value="0x0"@},@{number="46",value="0x0"@},
-@{number="47",value="0x0"@},@{number="48",value="0x0"@},
-@{number="49",value="0x0"@},@{number="50",value="0x0"@},
-@{number="51",value="0x0"@},@{number="52",value="0x0"@},
-@{number="53",value="0x0"@},@{number="54",value="0x0"@},
-@{number="55",value="0x0"@},@{number="56",value="0x0"@},
-@{number="57",value="0x0"@},@{number="58",value="0x0"@},
-@{number="59",value="0x0"@},@{number="60",value="0x0"@},
-@{number="61",value="0x0"@},@{number="62",value="0x0"@},
-@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
-@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
-@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
-@{number="69",value="0x20002b03"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-read-memory} Command
-@findex -data-read-memory
-
-@subsubheading Synopsis
-
-@example
- -data-read-memory [ -o @var{byte-offset} ]
- @var{address} @var{word-format} @var{word-size}
- @var{nr-rows} @var{nr-cols} [ @var{aschar} ]
-@end example
-
-@noindent
-where:
-
-@table @samp
-@item @var{address}
-An expression specifying the address of the first memory word to be
-read. Complex expressions containing embedded white space should be
-quoted using the C convention.
-
-@item @var{word-format}
-The format to be used to print the memory words. The notation is the
-same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
-,Output formats}).
-
-@item @var{word-size}
-The size of each memory word in bytes.
-
-@item @var{nr-rows}
-The number of rows in the output table.
-
-@item @var{nr-cols}
-The number of columns in the output table.
-
-@item @var{aschar}
-If present, indicates that each row should include an @sc{ascii} dump. The
-value of @var{aschar} is used as a padding character when a byte is not a
-member of the printable @sc{ascii} character set (printable @sc{ascii}
-characters are those whose code is between 32 and 126, inclusively).
-
-@item @var{byte-offset}
-An offset to add to the @var{address} before fetching memory.
-@end table
-
-This command displays memory contents as a table of @var{nr-rows} by
-@var{nr-cols} words, each word being @var{word-size} bytes. In total,
-@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
-(returned as @samp{total-bytes}). Should less than the requested number
-of bytes be returned by the target, the missing words are identified
-using @samp{N/A}. The number of bytes read from the target is returned
-in @samp{nr-bytes} and the starting address used to read memory in
-@samp{addr}.
-
-The address of the next/previous row or page is available in
-@samp{next-row} and @samp{prev-row}, @samp{next-page} and
-@samp{prev-page}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
-@samp{gdb_get_mem} memory read command.
-
-@subsubheading Example
-
-Read six bytes of memory starting at @code{bytes+6} but then offset by
-@code{-6} bytes. Format as three rows of two columns. One byte per
-word. Display each word in hex.
-
-@smallexample
-(@value{GDBP})
-9-data-read-memory -o -6 -- bytes+6 x 1 3 2
-9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
-next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
-prev-page="0x0000138a",memory=[
-@{addr="0x00001390",data=["0x00","0x01"]@},
-@{addr="0x00001392",data=["0x02","0x03"]@},
-@{addr="0x00001394",data=["0x04","0x05"]@}]
-(@value{GDBP})
-@end smallexample
-
-Read two bytes of memory starting at address @code{shorts + 64} and
-display as a single word formatted in decimal.
-
-@smallexample
-(@value{GDBP})
-5-data-read-memory shorts+64 d 2 1 1
-5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
-next-row="0x00001512",prev-row="0x0000150e",
-next-page="0x00001512",prev-page="0x0000150e",memory=[
-@{addr="0x00001510",data=["128"]@}]
-(@value{GDBP})
-@end smallexample
-
-Read thirty two bytes of memory starting at @code{bytes+16} and format
-as eight rows of four columns. Include a string encoding with @samp{x}
-used as the non-printable character.
-
-@smallexample
-(@value{GDBP})
-4-data-read-memory bytes+16 x 1 8 4 x
-4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
-next-row="0x000013c0",prev-row="0x0000139c",
-next-page="0x000013c0",prev-page="0x00001380",memory=[
-@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
-@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
-@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
-@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
-@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
-@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
-@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
-@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-display-delete} Command
-@findex -display-delete
-
-@subsubheading Synopsis
-
-@example
- -display-delete @var{number}
-@end example
-
-Delete the display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{delete display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-disable} Command
-@findex -display-disable
-
-@subsubheading Synopsis
-
-@example
- -display-disable @var{number}
-@end example
-
-Disable display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{disable display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-enable} Command
-@findex -display-enable
-
-@subsubheading Synopsis
-
-@example
- -display-enable @var{number}
-@end example
-
-Enable display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{enable display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-insert} Command
-@findex -display-insert
-
-@subsubheading Synopsis
-
-@example
- -display-insert @var{expression}
-@end example
-
-Display @var{expression} every time the program stops.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-list} Command
-@findex -display-list
-
-@subsubheading Synopsis
-
-@example
- -display-list
-@end example
-
-List the displays. Do not show the current values.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-environment-cd} Command
-@findex -environment-cd
-
-@subsubheading Synopsis
-
-@example
- -environment-cd @var{pathdir}
-@end example
-
-Set @value{GDBN}'s working directory.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{cd}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-directory} Command
-@findex -environment-directory
-
-@subsubheading Synopsis
-
-@example
- -environment-directory [ -r ] [ @var{pathdir} ]+
-@end example
-
-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
-@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 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
-character must not be used
-in any directory name.
-If no directories are specified, the current search path is displayed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{dir}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
-^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
-(@value{GDBP})
--environment-directory ""
-^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
-(@value{GDBP})
--environment-directory -r /home/jjohnstn/src/gdb /usr/src
-^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
-(@value{GDBP})
--environment-directory -r
-^done,source-path="$cdir:$cwd"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-path} Command
-@findex -environment-path
-
-@subsubheading Synopsis
-
-@example
- -environment-path [ -r ] [ @var{pathdir} ]+
-@end example
-
-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
-@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 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
-character must not be used
-in any directory name.
-If no directories are specified, the current path is displayed.
-
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{path}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-path
-^done,path="/usr/bin"
-(@value{GDBP})
--environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
-^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
-(@value{GDBP})
--environment-path -r /usr/local/bin
-^done,path="/usr/local/bin:/usr/bin"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-pwd} Command
-@findex -environment-pwd
-
-@subsubheading Synopsis
-
-@example
- -environment-pwd
-@end example
-
-Show the current working directory.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{pwd}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-pwd
-^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Program Control
-@section @sc{gdb/mi} Program control
-
-@subsubheading Program termination
-
-As a result of execution, the inferior program can run to completion, if
-it doesn't encounter any breakpoints. In this case the output will
-include an exit code, if the program has exited exceptionally.
-
-@subsubheading Examples
-
-@noindent
-Program exited normally:
-
-@smallexample
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="exited-normally"
-(@value{GDBP})
-@end smallexample
-
-@noindent
-Program exited exceptionally:
-
-@smallexample
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="exited",exit-code="01"
-(@value{GDBP})
-@end smallexample
-
-Another way the program can terminate is if it receives a signal such as
-@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
-
-@smallexample
-(@value{GDBP})
-*stopped,reason="exited-signalled",signal-name="SIGINT",
-signal-meaning="Interrupt"
-@end smallexample
-
-
-@subheading The @code{-exec-abort} Command
-@findex -exec-abort
-
-@subsubheading Synopsis
-
-@example
- -exec-abort
-@end example
-
-Kill the inferior running program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{kill}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-exec-arguments} Command
-@findex -exec-arguments
-
-@subsubheading Synopsis
-
-@example
- -exec-arguments @var{args}
-@end example
-
-Set the inferior program arguments, to be used in the next
-@samp{-exec-run}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{set args}.
-
-@subsubheading Example
-
-@c FIXME!
-Don't have one around.
-
-
-@subheading The @code{-exec-continue} Command
-@findex -exec-continue
-
-@subsubheading Synopsis
-
-@example
- -exec-continue
-@end example
-
-Asynchronous command. Resumes the execution of the inferior program
-until a breakpoint is encountered, or until the inferior exits.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} corresponding is @samp{continue}.
-
-@subsubheading Example
-
-@smallexample
--exec-continue
-^running
-(@value{GDBP})
-@@Hello world
-*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
-file="hello.c",line="13"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-finish} Command
-@findex -exec-finish
-
-@subsubheading Synopsis
-
-@example
- -exec-finish
-@end example
-
-Asynchronous command. Resumes the execution of the inferior program
-until the current function is exited. Displays the results returned by
-the function.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{finish}.
-
-@subsubheading Example
-
-Function returning @code{void}.
-
-@smallexample
--exec-finish
-^running
-(@value{GDBP})
-@@hello from foo
-*stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",line="7"@}
-(@value{GDBP})
-@end smallexample
-
-Function returning other than @code{void}. The name of the internal
-@value{GDBN} variable storing the result is printed, together with the
-value itself.
-
-@smallexample
--exec-finish
-^running
-(@value{GDBP})
-*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
-args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",line="14"@},
-gdb-result-var="$1",return-value="0"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-interrupt} Command
-@findex -exec-interrupt
-
-@subsubheading Synopsis
-
-@example
- -exec-interrupt
-@end example
-
-Asynchronous command. Interrupts the background execution of the target.
-Note how the token associated with the stop message is the one for the
-execution command that has been interrupted. The token for the interrupt
-itself only appears in the @samp{^done} output. If the user is trying to
-interrupt a non-running program, an error message will be printed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{interrupt}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
-111-exec-continue
-111^running
-
-(@value{GDBP})
-222-exec-interrupt
-222^done
-(@value{GDBP})
-111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
-frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
-(@value{GDBP})
-
-(@value{GDBP})
--exec-interrupt
-^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-next} Command
-@findex -exec-next
-
-@subsubheading Synopsis
-
-@example
- -exec-next
-@end example
-
-Asynchronous command. Resumes execution of the inferior program, stopping
-when the beginning of the next source line is reached.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{next}.
-
-@subsubheading Example
-
-@smallexample
--exec-next
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",line="8",file="hello.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-next-instruction} Command
-@findex -exec-next-instruction
-
-@subsubheading Synopsis
-
-@example
- -exec-next-instruction
-@end example
-
-Asynchronous command. Executes one machine instruction. If the
-instruction is a function call continues until the function returns. If
-the program stops at an instruction in the middle of a source line, the
-address will be printed as well.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{nexti}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-next-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-addr="0x000100d4",line="5",file="hello.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-return} Command
-@findex -exec-return
-
-@subsubheading Synopsis
-
-@example
- -exec-return
-@end example
-
-Makes current function return immediately. Doesn't execute the inferior.
-Displays the new current frame.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{return}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
-200-break-insert callee4
-200^done,bkpt=@{number="1",addr="0x00010734",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(@value{GDBP})
-000-exec-run
-000^running
-(@value{GDBP})
-000*stopped,reason="breakpoint-hit",bkptno="1",
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(@value{GDBP})
-205-break-delete
-205^done
-(@value{GDBP})
-111-exec-return
-111^done,frame=@{level="0",func="callee3",
-args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-run} Command
-@findex -exec-run
-
-@subsubheading Synopsis
-
-@example
- -exec-run
-@end example
-
-Asynchronous command. Starts execution of the inferior from the
-beginning. The inferior executes until either a breakpoint is
-encountered or the program exits.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{run}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-*stopped,reason="breakpoint-hit",bkptno="1",
-frame=@{func="main",args=[],file="recursive2.c",line="4"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-show-arguments} Command
-@findex -exec-show-arguments
-
-@subsubheading Synopsis
-
-@example
- -exec-show-arguments
-@end example
-
-Print the arguments of the program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{show args}.
-
-@subsubheading Example
-N.A.
-
-@c @subheading -exec-signal
-
-@subheading The @code{-exec-step} Command
-@findex -exec-step
-
-@subsubheading Synopsis
-
-@example
- -exec-step
-@end example
-
-Asynchronous command. Resumes execution of the inferior program, stopping
-when the beginning of the next source line is reached, if the next
-source line is not a function call. If it is, stop at the first
-instruction of the called function.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{step}.
-
-@subsubheading Example
-
-Stepping into a function:
-
-@smallexample
--exec-step
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{func="foo",args=[@{name="a",value="10"@},
-@{name="b",value="0"@}],file="recursive2.c",line="11"@}
-(@value{GDBP})
-@end smallexample
-
-Regular stepping:
-
-@smallexample
--exec-step
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-step-instruction} Command
-@findex -exec-step-instruction
-
-@subsubheading Synopsis
-
-@example
- -exec-step-instruction
-@end example
-
-Asynchronous command. Resumes the inferior which executes one machine
-instruction. The output, once @value{GDBN} has stopped, will vary depending on
-whether we have stopped in the middle of a source line or not. In the
-former case, the address at which the program stopped will be printed as
-well.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{stepi}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-step-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{func="foo",args=[],file="try.c",line="10"@}
-(@value{GDBP})
--exec-step-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-until} Command
-@findex -exec-until
-
-@subsubheading Synopsis
-
-@example
- -exec-until [ @var{location} ]
-@end example
-
-Asynchronous command. Executes the inferior until the @var{location}
-specified in the argument is reached. If there is no argument, the inferior
-executes until a source line greater than the current one is reached.
-The reason for stopping in this case will be @samp{location-reached}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{until}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-until recursive2.c:6
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",line="6"@}
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@subheading -file-clear
-Is this going away????
-@end ignore
-
-
-@subheading The @code{-file-exec-and-symbols} Command
-@findex -file-exec-and-symbols
-
-@subsubheading Synopsis
-
-@example
- -file-exec-and-symbols @var{file}
-@end example
-
-Specify the executable file to be debugged. This file is the one from
-which the symbol table is also read. If no file is specified, the
-command clears the executable and symbol information. If breakpoints
-are set when using this command with no arguments, @value{GDBN} will produce
-error messages. Otherwise, no output is produced, except a completion
-notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-file-exec-file} Command
-@findex -file-exec-file
-
-@subsubheading Synopsis
-
-@example
- -file-exec-file @var{file}
-@end example
-
-Specify the executable file to be debugged. Unlike
-@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
-from this file. If used without argument, @value{GDBN} clears the information
-about the executable file. No output is produced, except a completion
-notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{exec-file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-file-list-exec-sections} Command
-@findex -file-list-exec-sections
-
-@subsubheading Synopsis
-
-@example
- -file-list-exec-sections
-@end example
-
-List the sections of the current executable file.
-
-@subsubheading @value{GDBN} Command
-
-The @value{GDBN} command @samp{info file} shows, among the rest, the same
-information as this command. @code{gdbtk} has a corresponding command
-@samp{gdb_load_info}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-exec-source-files} Command
-@findex -file-list-exec-source-files
-
-@subsubheading Synopsis
-
-@example
- -file-list-exec-source-files
-@end example
-
-List the source files for the current executable.
-
-@subsubheading @value{GDBN} Command
-
-There's no @value{GDBN} command which directly corresponds to this one.
-@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-shared-libraries} Command
-@findex -file-list-shared-libraries
-
-@subsubheading Synopsis
-
-@example
- -file-list-shared-libraries
-@end example
-
-List the shared libraries in the program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info shared}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-symbol-files} Command
-@findex -file-list-symbol-files
-
-@subsubheading Synopsis
-
-@example
- -file-list-symbol-files
-@end example
-
-List symbol files.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info file} (part of it).
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-symbol-file} Command
-@findex -file-symbol-file
-
-@subsubheading Synopsis
-
-@example
- -file-symbol-file @var{file}
-@end example
-
-Read symbol table info from the specified @var{file} argument. When
-used without arguments, clears @value{GDBN}'s symbol table info. No output is
-produced, except for a completion notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{symbol-file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Miscellaneous Commands
-@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
-
-@c @subheading -gdb-complete
-
-@subheading The @code{-gdb-exit} Command
-@findex -gdb-exit
-
-@subsubheading Synopsis
-
-@example
- -gdb-exit
-@end example
-
-Exit @value{GDBN} immediately.
-
-@subsubheading @value{GDBN} Command
-
-Approximately corresponds to @samp{quit}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-exit
-@end smallexample
-
-@subheading The @code{-gdb-set} Command
-@findex -gdb-set
-
-@subsubheading Synopsis
-
-@example
- -gdb-set
-@end example
-
-Set an internal @value{GDBN} variable.
-@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{set}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-set $foo=3
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-gdb-show} Command
-@findex -gdb-show
-
-@subsubheading Synopsis
-
-@example
- -gdb-show
-@end example
-
-Show the current value of a @value{GDBN} variable.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{show}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-show annotate
-^done,value="0"
-(@value{GDBP})
-@end smallexample
-
-@c @subheading -gdb-source
-
-
-@subheading The @code{-gdb-version} Command
-@findex -gdb-version
-
-@subsubheading Synopsis
-
-@example
- -gdb-version
-@end example
-
-Show version information for @value{GDBN}. Used mostly in testing.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
-information when you start an interactive session.
-
-@subsubheading Example
-
-@c This example modifies the actual output from GDB to avoid overfull
-@c box in TeX.
-@smallexample
-(@value{GDBP})
--gdb-version
-~GNU gdb 5.2.1
-~Copyright 2000 Free Software Foundation, Inc.
-~GDB is free software, covered by the GNU General Public License, and
-~you are welcome to change it and/or distribute copies of it under
-~ certain conditions.
-~Type "show copying" to see the conditions.
-~There is absolutely no warranty for GDB. Type "show warranty" for
-~ details.
-~This GDB was configured as
- "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
-^done
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-interpreter-exec} Command
-@findex -interpreter-exec
-
-@subheading Synopsis
-
-@smallexample
--interpreter-exec @var{interpreter} @var{command}
-@end smallexample
-
-Execute the specified @var{command} in the given @var{interpreter}.
-
-@subheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{interpreter-exec}.
-
-@subheading Example
-
-@smallexample
-(@value{GDBP})
--interpreter-exec console "break main"
-&"During symbol reading, couldn't parse type; debugger out of date?.\n"
-&"During symbol reading, bad structure-type format.\n"
-~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
-^done
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Kod Commands
-@section @sc{gdb/mi} Kod Commands
-
-The Kod commands are not implemented.
-
-@c @subheading -kod-info
-
-@c @subheading -kod-list
-
-@c @subheading -kod-list-object-types
-
-@c @subheading -kod-show
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Memory Overlay Commands
-@section @sc{gdb/mi} Memory Overlay Commands
-
-The memory overlay commands are not implemented.
-
-@c @subheading -overlay-auto
-
-@c @subheading -overlay-list-mapping-state
-
-@c @subheading -overlay-list-overlays
-
-@c @subheading -overlay-map
-
-@c @subheading -overlay-off
-
-@c @subheading -overlay-on
-
-@c @subheading -overlay-unmap
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Signal Handling Commands
-@section @sc{gdb/mi} Signal Handling Commands
-
-Signal handling commands are not implemented.
-
-@c @subheading -signal-handle
-
-@c @subheading -signal-list-handle-actions
-
-@c @subheading -signal-list-signal-types
-@end ignore
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Stack Manipulation
-@section @sc{gdb/mi} Stack Manipulation Commands
-
-
-@subheading The @code{-stack-info-frame} Command
-@findex -stack-info-frame
-
-@subsubheading Synopsis
-
-@example
- -stack-info-frame
-@end example
-
-Get info on the current frame.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
-(without arguments).
-
-@subsubheading Example
-N.A.
-
-@subheading The @code{-stack-info-depth} Command
-@findex -stack-info-depth
-
-@subsubheading Synopsis
-
-@example
- -stack-info-depth [ @var{max-depth} ]
-@end example
-
-Return the depth of the stack. If the integer argument @var{max-depth}
-is specified, do not count beyond @var{max-depth} frames.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command.
-
-@subsubheading Example
-
-For a stack with frame levels 0 through 11:
-
-@smallexample
-(@value{GDBP})
--stack-info-depth
-^done,depth="12"
-(@value{GDBP})
--stack-info-depth 4
-^done,depth="4"
-(@value{GDBP})
--stack-info-depth 12
-^done,depth="12"
-(@value{GDBP})
--stack-info-depth 11
-^done,depth="11"
-(@value{GDBP})
--stack-info-depth 13
-^done,depth="12"
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-stack-list-arguments} Command
-@findex -stack-list-arguments
-
-@subsubheading Synopsis
-
-@example
- -stack-list-arguments @var{show-values}
- [ @var{low-frame} @var{high-frame} ]
-@end example
-
-Display a list of the arguments for the frames between @var{low-frame}
-and @var{high-frame} (inclusive). If @var{low-frame} and
-@var{high-frame} are not provided, list the arguments for the whole call
-stack.
-
-The @var{show-values} argument must have a value of 0 or 1. A value of
-0 means that only the names of the arguments are listed, a value of 1
-means that both names and values of the arguments are printed.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
-@samp{gdb_get_args} command which partially overlaps with the
-functionality of @samp{-stack-list-arguments}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-list-frames
-^done,
-stack=[
-frame=@{level="0",addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
-frame=@{level="1",addr="0x0001076c",func="callee3",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
-frame=@{level="2",addr="0x0001078c",func="callee2",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
-frame=@{level="3",addr="0x000107b4",func="callee1",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
-frame=@{level="4",addr="0x000107e0",func="main",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
-(@value{GDBP})
--stack-list-arguments 0
-^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=[]@}]
-(@value{GDBP})
--stack-list-arguments 1
-^done,
-stack-args=[
-frame=@{level="0",args=[]@},
-frame=@{level="1",
- args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
-frame=@{level="2",args=[
-@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
-@{frame=@{level="3",args=[
-@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@},
-@{name="fltarg",value="3.5"@}]@},
-frame=@{level="4",args=[]@}]
-(@value{GDBP})
--stack-list-arguments 0 2 2
-^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
-(@value{GDBP})
--stack-list-arguments 1 2 2
-^done,stack-args=[frame=@{level="2",
-args=[@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
-(@value{GDBP})
-@end smallexample
-
-@c @subheading -stack-list-exception-handlers
-
-
-@subheading The @code{-stack-list-frames} Command
-@findex -stack-list-frames
-
-@subsubheading Synopsis
-
-@example
- -stack-list-frames [ @var{low-frame} @var{high-frame} ]
-@end example
-
-List the frames currently on the stack. For each frame it displays the
-following info:
-
-@table @samp
-@item @var{level}
-The frame number, 0 being the topmost frame, i.e. the innermost function.
-@item @var{addr}
-The @code{$pc} value for that frame.
-@item @var{func}
-Function name.
-@item @var{file}
-File name of the source file where the function lives.
-@item @var{line}
-Line number corresponding to the @code{$pc}.
-@end table
-
-If invoked without arguments, this command prints a backtrace for the
-whole stack. If given two integer arguments, it shows the frames whose
-levels are between the two arguments (inclusive). If the two arguments
-are equal, it shows the single frame at the corresponding level.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
-
-@subsubheading Example
-
-Full stack backtrace:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames
-^done,stack=
-[frame=@{level="0",addr="0x0001076c",func="foo",
- file="recursive2.c",line="11"@},
-frame=@{level="1",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="2",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="4",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="5",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="6",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="7",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="8",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="9",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="10",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="11",addr="0x00010738",func="main",
- file="recursive2.c",line="4"@}]
-(@value{GDBP})
-@end smallexample
-
-Show frames between @var{low_frame} and @var{high_frame}:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames 3 5
-^done,stack=
-[frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="4",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="5",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@}]
-(@value{GDBP})
-@end smallexample
-
-Show a single frame:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames 3 3
-^done,stack=
-[frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-stack-list-locals} Command
-@findex -stack-list-locals
-
-@subsubheading Synopsis
-
-@example
- -stack-list-locals @var{print-values}
-@end example
-
-Display the local variable names for the current frame. With an
-argument of 0 prints only the names of the variables, with argument of 1
-prints also their values.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-list-locals 0
-^done,locals=[name="A",name="B",name="C"]
-(@value{GDBP})
--stack-list-locals 1
-^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
- @{name="C",value="3"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-stack-select-frame} Command
-@findex -stack-select-frame
-
-@subsubheading Synopsis
-
-@example
- -stack-select-frame @var{framenum}
-@end example
-
-Change the current frame. Select a different frame @var{framenum} on
-the stack.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
-@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-select-frame 2
-^done
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Symbol Query
-@section @sc{gdb/mi} Symbol Query Commands
-
-
-@subheading The @code{-symbol-info-address} Command
-@findex -symbol-info-address
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-address @var{symbol}
-@end example
-
-Describe where @var{symbol} is stored.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info address}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-file} Command
-@findex -symbol-info-file
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-file
-@end example
-
-Show the file for the symbol.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command. @code{gdbtk} has
-@samp{gdb_find_file}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-function} Command
-@findex -symbol-info-function
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-function
-@end example
-
-Show which function the symbol lives in.
-
-@subsubheading @value{GDBN} Command
-
-@samp{gdb_get_function} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-line} Command
-@findex -symbol-info-line
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-line
-@end example
-
-Show the core addresses of the code for a source line.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} comamnd is @samp{info line}.
-@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-symbol} Command
-@findex -symbol-info-symbol
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-symbol @var{addr}
-@end example
-
-Describe what symbol is at location @var{addr}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info symbol}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-functions} Command
-@findex -symbol-list-functions
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-functions
-@end example
-
-List the functions in the executable.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
-@samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-types} Command
-@findex -symbol-list-types
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-types
-@end example
-
-List all the type names.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding commands are @samp{info types} in @value{GDBN},
-@samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-variables} Command
-@findex -symbol-list-variables
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-variables
-@end example
-
-List all the global and static variable names.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-locate} Command
-@findex -symbol-locate
-
-@subsubheading Synopsis
-
-@example
- -symbol-locate
-@end example
-
-@subsubheading @value{GDBN} Command
-
-@samp{gdb_loc} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-type} Command
-@findex -symbol-type
-
-@subsubheading Synopsis
-
-@example
- -symbol-type @var{variable}
-@end example
-
-Show type of @var{variable}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
-@samp{gdb_obj_variable}.
-
-@subsubheading Example
-N.A.
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Target Manipulation
-@section @sc{gdb/mi} Target Manipulation Commands
-
-
-@subheading The @code{-target-attach} Command
-@findex -target-attach
-
-@subsubheading Synopsis
-
-@example
- -target-attach @var{pid} | @var{file}
-@end example
-
-Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{attach}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-compare-sections} Command
-@findex -target-compare-sections
-
-@subsubheading Synopsis
-
-@example
- -target-compare-sections [ @var{section} ]
-@end example
-
-Compare data of section @var{section} on target to the exec file.
-Without the argument, all sections are compared.
-
-@subsubheading @value{GDBN} Command
-
-The @value{GDBN} equivalent is @samp{compare-sections}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-detach} Command
-@findex -target-detach
-
-@subsubheading Synopsis
-
-@example
- -target-detach
-@end example
-
-Disconnect from the remote target. There's no output.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{detach}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--target-detach
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-target-download} Command
-@findex -target-download
-
-@subsubheading Synopsis
-
-@example
- -target-download
-@end example
-
-Loads the executable onto the remote target.
-It prints out an update message every half second, which includes the fields:
-
-@table @samp
-@item section
-The name of the section.
-@item section-sent
-The size of what has been sent so far for that section.
-@item section-size
-The size of the section.
-@item total-sent
-The total size of what was sent so far (the current and the previous sections).
-@item total-size
-The size of the overall executable to download.
-@end table
-
-@noindent
-Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
-@sc{gdb/mi} Output Syntax}).
-
-In addition, it prints the name and size of the sections, as they are
-downloaded. These messages include the following fields:
-
-@table @samp
-@item section
-The name of the section.
-@item section-size
-The size of the section.
-@item total-size
-The size of the overall executable to download.
-@end table
-
-@noindent
-At the end, a summary is printed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{load}.
-
-@subsubheading Example
-
-Note: each status message appears on a single line. Here the messages
-have been broken down so that they can fit onto a page.
-
-@smallexample
-(@value{GDBP})
--target-download
-+download,@{section=".text",section-size="6668",total-size="9880"@}
-+download,@{section=".text",section-sent="512",section-size="6668",
-total-sent="512",total-size="9880"@}
-+download,@{section=".text",section-sent="1024",section-size="6668",
-total-sent="1024",total-size="9880"@}
-+download,@{section=".text",section-sent="1536",section-size="6668",
-total-sent="1536",total-size="9880"@}
-+download,@{section=".text",section-sent="2048",section-size="6668",
-total-sent="2048",total-size="9880"@}
-+download,@{section=".text",section-sent="2560",section-size="6668",
-total-sent="2560",total-size="9880"@}
-+download,@{section=".text",section-sent="3072",section-size="6668",
-total-sent="3072",total-size="9880"@}
-+download,@{section=".text",section-sent="3584",section-size="6668",
-total-sent="3584",total-size="9880"@}
-+download,@{section=".text",section-sent="4096",section-size="6668",
-total-sent="4096",total-size="9880"@}
-+download,@{section=".text",section-sent="4608",section-size="6668",
-total-sent="4608",total-size="9880"@}
-+download,@{section=".text",section-sent="5120",section-size="6668",
-total-sent="5120",total-size="9880"@}
-+download,@{section=".text",section-sent="5632",section-size="6668",
-total-sent="5632",total-size="9880"@}
-+download,@{section=".text",section-sent="6144",section-size="6668",
-total-sent="6144",total-size="9880"@}
-+download,@{section=".text",section-sent="6656",section-size="6668",
-total-sent="6656",total-size="9880"@}
-+download,@{section=".init",section-size="28",total-size="9880"@}
-+download,@{section=".fini",section-size="28",total-size="9880"@}
-+download,@{section=".data",section-size="3156",total-size="9880"@}
-+download,@{section=".data",section-sent="512",section-size="3156",
-total-sent="7236",total-size="9880"@}
-+download,@{section=".data",section-sent="1024",section-size="3156",
-total-sent="7748",total-size="9880"@}
-+download,@{section=".data",section-sent="1536",section-size="3156",
-total-sent="8260",total-size="9880"@}
-+download,@{section=".data",section-sent="2048",section-size="3156",
-total-sent="8772",total-size="9880"@}
-+download,@{section=".data",section-sent="2560",section-size="3156",
-total-sent="9284",total-size="9880"@}
-+download,@{section=".data",section-sent="3072",section-size="3156",
-total-sent="9796",total-size="9880"@}
-^done,address="0x10004",load-size="9880",transfer-rate="6586",
-write-rate="429"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-target-exec-status} Command
-@findex -target-exec-status
-
-@subsubheading Synopsis
-
-@example
- -target-exec-status
-@end example
-
-Provide information on the state of the target (whether it is running or
-not, for instance).
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-available-targets} Command
-@findex -target-list-available-targets
-
-@subsubheading Synopsis
-
-@example
- -target-list-available-targets
-@end example
-
-List the possible targets to connect to.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{help target}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-current-targets} Command
-@findex -target-list-current-targets
-
-@subsubheading Synopsis
-
-@example
- -target-list-current-targets
-@end example
-
-Describe the current target.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding information is printed by @samp{info file} (among
-other things).
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-parameters} Command
-@findex -target-list-parameters
-
-@subsubheading Synopsis
-
-@example
- -target-list-parameters
-@end example
-
-@c ????
-
-@subsubheading @value{GDBN} Command
-
-No equivalent.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-select} Command
-@findex -target-select
-
-@subsubheading Synopsis
-
-@example
- -target-select @var{type} @var{parameters @dots{}}
-@end example
-
-Connect @value{GDBN} to the remote target. This command takes two args:
-
-@table @samp
-@item @var{type}
-The type of target, for instance @samp{async}, @samp{remote}, etc.
-@item @var{parameters}
-Device names, host names and the like. @xref{Target Commands, ,
-Commands for managing targets}, for more details.
-@end table
-
-The output is a connection notification, followed by the address at
-which the target program is, in the following form:
-
-@smallexample
-^connected,addr="@var{address}",func="@var{function name}",
- args=[@var{arg list}]
-@end smallexample
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{target}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--target-select async /dev/ttya
-^connected,addr="0xfe00a300",func="??",args=[]
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Thread Commands
-@section @sc{gdb/mi} Thread Commands
-
-
-@subheading The @code{-thread-info} Command
-@findex -thread-info
-
-@subsubheading Synopsis
-
-@example
- -thread-info
-@end example
-
-@subsubheading @value{GDBN} command
-
-No equivalent.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-thread-list-all-threads} Command
-@findex -thread-list-all-threads
-
-@subsubheading Synopsis
-
-@example
- -thread-list-all-threads
-@end example
-
-@subsubheading @value{GDBN} Command
-
-The equivalent @value{GDBN} command is @samp{info threads}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-thread-list-ids} Command
-@findex -thread-list-ids
-
-@subsubheading Synopsis
-
-@example
- -thread-list-ids
-@end example
-
-Produces a list of the currently known @value{GDBN} thread ids. At the
-end of the list it also prints the total number of such threads.
-
-@subsubheading @value{GDBN} Command
-
-Part of @samp{info threads} supplies the same information.
-
-@subsubheading Example
-
-No threads present, besides the main process:
-
-@smallexample
-(@value{GDBP})
--thread-list-ids
-^done,thread-ids=@{@},number-of-threads="0"
-(@value{GDBP})
-@end smallexample
-
-
-Several threads:
-
-@smallexample
-(@value{GDBP})
--thread-list-ids
-^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
-number-of-threads="3"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-thread-select} Command
-@findex -thread-select
-
-@subsubheading Synopsis
-
-@example
- -thread-select @var{threadnum}
-@end example
-
-Make @var{threadnum} the current thread. It prints the number of the new
-current thread, and the topmost frame for that thread.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{thread}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-next
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",thread-id="2",line="187",
-file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
-(@value{GDBP})
--thread-list-ids
-^done,
-thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
-number-of-threads="3"
-(@value{GDBP})
--thread-select 3
-^done,new-thread-id="3",
-frame=@{level="0",func="vprintf",
-args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Tracepoint Commands
-@section @sc{gdb/mi} Tracepoint Commands
-
-The tracepoint commands are not yet implemented.
-
-@c @subheading -trace-actions
-
-@c @subheading -trace-delete
-
-@c @subheading -trace-disable
-
-@c @subheading -trace-dump
-
-@c @subheading -trace-enable
-
-@c @subheading -trace-exists
-
-@c @subheading -trace-find
-
-@c @subheading -trace-frame-number
-
-@c @subheading -trace-info
-
-@c @subheading -trace-insert
-
-@c @subheading -trace-list
-
-@c @subheading -trace-pass-count
-
-@c @subheading -trace-save
-
-@c @subheading -trace-start
-
-@c @subheading -trace-stop
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Variable Objects
-@section @sc{gdb/mi} Variable Objects
-
-
-@subheading Motivation for Variable Objects in @sc{gdb/mi}
-
-For the implementation of a variable debugger window (locals, watched
-expressions, etc.), we are proposing the adaptation of the existing code
-used by @code{Insight}.
-
-The two main reasons for that are:
-
-@enumerate 1
-@item
-It has been proven in practice (it is already on its second generation).
-
-@item
-It will shorten development time (needless to say how important it is
-now).
-@end enumerate
-
-The original interface was designed to be used by Tcl code, so it was
-slightly changed so it could be used through @sc{gdb/mi}. This section
-describes the @sc{gdb/mi} operations that will be available and gives some
-hints about their use.
-
-@emph{Note}: In addition to the set of operations described here, we
-expect the @sc{gui} implementation of a variable window to require, at
-least, the following operations:
-
-@itemize @bullet
-@item @code{-gdb-show} @code{output-radix}
-@item @code{-stack-list-arguments}
-@item @code{-stack-list-locals}
-@item @code{-stack-select-frame}
-@end itemize
-
-@subheading Introduction to Variable Objects in @sc{gdb/mi}
-
-@cindex variable objects in @sc{gdb/mi}
-The basic idea behind variable objects is the creation of a named object
-to represent a variable, an expression, a memory location or even a CPU
-register. For each object created, a set of operations is available for
-examining or changing its properties.
-
-Furthermore, complex data types, such as C structures, are represented
-in a tree format. For instance, the @code{struct} type variable is the
-root and the children will represent the struct members. If a child
-is itself of a complex type, it will also have children of its own.
-Appropriate language differences are handled for C, C@t{++} and Java.
-
-When returning the actual values of the objects, this facility allows
-for the individual selection of the display format used in the result
-creation. It can be chosen among: binary, decimal, hexadecimal, octal
-and natural. Natural refers to a default format automatically
-chosen based on the variable type (like decimal for an @code{int}, hex
-for pointers, etc.).
-
-The following is the complete set of @sc{gdb/mi} operations defined to
-access this functionality:
-
-@multitable @columnfractions .4 .6
-@item @strong{Operation}
-@tab @strong{Description}
-
-@item @code{-var-create}
-@tab create a variable object
-@item @code{-var-delete}
-@tab delete the variable object and its children
-@item @code{-var-set-format}
-@tab set the display format of this variable
-@item @code{-var-show-format}
-@tab show the display format of this variable
-@item @code{-var-info-num-children}
-@tab tells how many children this object has
-@item @code{-var-list-children}
-@tab return a list of the object's children
-@item @code{-var-info-type}
-@tab show the type of this variable object
-@item @code{-var-info-expression}
-@tab print what this variable object represents
-@item @code{-var-show-attributes}
-@tab is this variable editable? does it exist here?
-@item @code{-var-evaluate-expression}
-@tab get the value of this variable
-@item @code{-var-assign}
-@tab set the value of this variable
-@item @code{-var-update}
-@tab update the variable and its children
-@end multitable
-
-In the next subsection we describe each operation in detail and suggest
-how it can be used.
-
-@subheading Description And Use of Operations on Variable Objects
-
-@subheading The @code{-var-create} Command
-@findex -var-create
-
-@subsubheading Synopsis
-
-@example
- -var-create @{@var{name} | "-"@}
- @{@var{frame-addr} | "*"@} @var{expression}
-@end example
-
-This operation creates a variable object, which allows the monitoring of
-a variable, the result of an expression, a memory cell or a CPU
-register.
-
-The @var{name} parameter is the string by which the object can be
-referenced. It must be unique. If @samp{-} is specified, the varobj
-system will generate a string ``varNNNNNN'' automatically. It will be
-unique provided that one does not specify @var{name} on that format.
-The command fails if a duplicate name is found.
-
-The frame under which the expression should be evaluated can be
-specified by @var{frame-addr}. A @samp{*} indicates that the current
-frame should be used.
-
-@var{expression} is any expression valid on the current language set (must not
-begin with a @samp{*}), or one of the following:
-
-@itemize @bullet
-@item
-@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
-
-@item
-@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
-
-@item
-@samp{$@var{regname}} --- a CPU register name
-@end itemize
-
-@subsubheading Result
-
-This operation returns the name, number of children and the type of the
-object created. Type is returned as a string as the ones generated by
-the @value{GDBN} CLI:
-
-@example
- name="@var{name}",numchild="N",type="@var{type}"
-@end example
-
-
-@subheading The @code{-var-delete} Command
-@findex -var-delete
-
-@subsubheading Synopsis
-
-@example
- -var-delete @var{name}
-@end example
-
-Deletes a previously created variable object and all of its children.
-
-Returns an error if the object @var{name} is not found.
-
-
-@subheading The @code{-var-set-format} Command
-@findex -var-set-format
-
-@subsubheading Synopsis
-
-@example
- -var-set-format @var{name} @var{format-spec}
-@end example
-
-Sets the output format for the value of the object @var{name} to be
-@var{format-spec}.
-
-The syntax for the @var{format-spec} is as follows:
-
-@example
- @var{format-spec} @expansion{}
- @{binary | decimal | hexadecimal | octal | natural@}
-@end example
-
-
-@subheading The @code{-var-show-format} Command
-@findex -var-show-format
-
-@subsubheading Synopsis
-
-@example
- -var-show-format @var{name}
-@end example
-
-Returns the format used to display the value of the object @var{name}.
-
-@example
- @var{format} @expansion{}
- @var{format-spec}
-@end example
-
-
-@subheading The @code{-var-info-num-children} Command
-@findex -var-info-num-children
-
-@subsubheading Synopsis
-
-@example
- -var-info-num-children @var{name}
-@end example
-
-Returns the number of children of a variable object @var{name}:
-
-@example
- numchild=@var{n}
-@end example
-
-
-@subheading The @code{-var-list-children} Command
-@findex -var-list-children
-
-@subsubheading Synopsis
-
-@example
- -var-list-children @var{name}
-@end example
-
-Returns a list of the children of the specified variable object:
-
-@example
- numchild=@var{n},children=[@{name=@var{name},
- numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
-@end example
-
-
-@subheading The @code{-var-info-type} Command
-@findex -var-info-type
-
-@subsubheading Synopsis
-
-@example
- -var-info-type @var{name}
-@end example
-
-Returns the type of the specified variable @var{name}. The type is
-returned as a string in the same format as it is output by the
-@value{GDBN} CLI:
-
-@example
- type=@var{typename}
-@end example
-
-
-@subheading The @code{-var-info-expression} Command
-@findex -var-info-expression
-
-@subsubheading Synopsis
-
-@example
- -var-info-expression @var{name}
-@end example
-
-Returns what is represented by the variable object @var{name}:
-
-@example
- lang=@var{lang-spec},exp=@var{expression}
-@end example
-
-@noindent
-where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
-
-@subheading The @code{-var-show-attributes} Command
-@findex -var-show-attributes
-
-@subsubheading Synopsis
-
-@example
- -var-show-attributes @var{name}
-@end example
-
-List attributes of the specified variable object @var{name}:
-
-@example
- status=@var{attr} [ ( ,@var{attr} )* ]
-@end example
-
-@noindent
-where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
-
-@subheading The @code{-var-evaluate-expression} Command
-@findex -var-evaluate-expression
-
-@subsubheading Synopsis
-
-@example
- -var-evaluate-expression @var{name}
-@end example
-
-Evaluates the expression that is represented by the specified variable
-object and returns its value as a string in the current format specified
-for the object:
-
-@example
- value=@var{value}
-@end example
-
-Note that one must invoke @code{-var-list-children} for a variable
-before the value of a child variable can be evaluated.
-
-@subheading The @code{-var-assign} Command
-@findex -var-assign
-
-@subsubheading Synopsis
-
-@example
- -var-assign @var{name} @var{expression}
-@end example
-
-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
-subsequent @code{-var-update} list.
-
-@subsubheading Example
-
-@example
-(@value{GDBP})
--var-assign var1 3
-^done,value="3"
-(@value{GDBP})
--var-update *
-^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
-(@value{GDBP})
-@end example
-
-@subheading The @code{-var-update} Command
-@findex -var-update
-
-@subsubheading Synopsis
-
-@example
- -var-update @{@var{name} | "*"@}
-@end example
-
-Update the value of the variable object @var{name} by evaluating its
-expression after fetching all the new values from memory or registers.
-A @samp{*} causes all existing variable objects to be updated.
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
new file mode 100644
index 0000000..eb1d67a
--- /dev/null
+++ b/gdb/mi/mi-cmd-file.c
@@ -0,0 +1,67 @@
+/* MI Command Set - breakpoint and watchpoint commands.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Cygnus Solutions (a Red Hat company).
+
+ 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 "mi-cmds.h"
+#include "mi-getopt.h"
+#include "ui-out.h"
+#include "symtab.h"
+#include "source.h"
+
+/* Return to the client the absolute path and line number of the
+ current file being executed. */
+
+enum mi_cmd_result
+mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc)
+{
+ struct symtab_and_line st;
+ int optind = 0;
+ char *optarg;
+
+ if ( !mi_valid_noargs("mi_cmd_file_list_exec_source_file", argc, argv) )
+ error ("mi_cmd_file_list_exec_source_file: Usage: No args");
+
+
+ /* Set the default file and line, also get them */
+ set_default_source_symtab_and_line();
+ st = get_current_source_symtab_and_line();
+
+ /* We should always get a symtab.
+ Apparently, filename does not need to be tested for NULL.
+ The documentation in symtab.h suggests it will always be correct */
+ if (!st.symtab)
+ error ("mi_cmd_file_list_exec_source_file: No symtab");
+
+ /* Extract the fullname if it is not known yet */
+ if (st.symtab->fullname == NULL)
+ symtab_to_filename (st.symtab);
+
+ /* We may not be able to open the file (not available). */
+ if (st.symtab->fullname == NULL)
+ error ("mi_cmd_file_list_exec_source_file: File not found");
+
+ /* Print to the user the line, filename and fullname */
+ ui_out_field_int (uiout, "line", st.line);
+ ui_out_field_string (uiout, "file", st.symtab->filename);
+ ui_out_field_string (uiout, "fullname", st.symtab->fullname);
+
+ return MI_CMD_DONE;
+}
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 5a0bf50..d677842 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -80,6 +80,7 @@ struct mi_cmd mi_cmds[] =
{"file-exec-and-symbols", "file %s", 0},
{"file-exec-file", "exec-file %s", 0},
{"file-list-exec-sections", 0, 0},
+ {"file-list-exec-source-file", 0, 0, mi_cmd_file_list_exec_source_file},
{"file-list-exec-source-files", 0, 0},
{"file-list-shared-libraries", 0, 0},
{"file-list-symbol-files", 0, 0},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 3eb6153..47e1bbf 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -80,6 +80,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_step;
extern mi_cmd_args_ftype mi_cmd_exec_step_instruction;
extern mi_cmd_args_ftype mi_cmd_exec_until;
extern mi_cmd_args_ftype mi_cmd_exec_interrupt;
+extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
extern mi_cmd_argv_ftype mi_cmd_stack_info_depth;
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 59ccdf3..3f2a902 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -74,3 +74,19 @@ mi_getopt (const char *prefix,
}
error ("%s: Unknown option ``%s''", prefix, arg + 1);
}
+
+int
+mi_valid_noargs (const char *prefix, int argc, char **argv)
+{
+ int optind = 0;
+ char *optarg;
+ static struct mi_opt opts[] =
+ {
+ 0
+ };
+
+ if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h
index 6b31adf..17d66fb 100644
--- a/gdb/mi/mi-getopt.h
+++ b/gdb/mi/mi-getopt.h
@@ -57,4 +57,24 @@ struct mi_opt
struct mi_opt;
+/* mi_valid_noargs
+
+ Determines if ARGC/ARGV are a valid set of parameters to satisfy
+ an MI function that is not supposed to recieve any arguments.
+
+ An MI function that should not recieve arguments can still be
+ passed parameters after the special option '--' such as below.
+
+ Example: The MI function -exec-run takes no args.
+ However, the client may pass '-exec-run -- -a ...'
+ See PR-783
+
+ PREFIX is passed to mi_getopt for an error message.
+
+ This function Returns 1 if the parameter pair ARGC/ARGV are valid
+ for an MI function that takes no arguments. Otherwise, it returns 0
+ and the appropriate error message is displayed by mi_getopt. */
+
+extern int mi_valid_noargs (const char *prefix, int argc, char **argv);
+
#endif
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 2a63d22..f9424d7 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -5573,6 +5573,10 @@ mips_stab_reg_to_regnum (int num)
return num;
else if (num >= 38 && num < 70)
return num + FP0_REGNUM - 38;
+ else if (num == 70)
+ return HI_REGNUM;
+ else if (num == 71)
+ return LO_REGNUM;
else
{
/* This will hopefully (eventually) provoke a warning. Should
@@ -5591,6 +5595,10 @@ mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
return num;
else if (num >= 32 && num < 64)
return num + FP0_REGNUM - 32;
+ else if (num == 64)
+ return HI_REGNUM;
+ else if (num == 65)
+ return LO_REGNUM;
else
{
/* This will hopefully (eventually) provoke a warning. Should
@@ -5806,7 +5814,7 @@ mips_gdbarch_init (struct gdbarch_info info,
switch (mips_abi)
{
case MIPS_ABI_O32:
- set_gdbarch_push_arguments (gdbarch, mips_o32_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_o32_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value);
tdep->mips_default_saved_regsize = 4;
@@ -5825,7 +5833,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_o32_use_struct_convention);
break;
case MIPS_ABI_O64:
- set_gdbarch_push_arguments (gdbarch, mips_o64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_o64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_o64_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_o64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5844,7 +5852,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_o32_use_struct_convention);
break;
case MIPS_ABI_EABI32:
- set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
tdep->mips_default_saved_regsize = 4;
@@ -5863,7 +5871,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_eabi_use_struct_convention);
break;
case MIPS_ABI_EABI64:
- set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5882,7 +5890,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_eabi_use_struct_convention);
break;
case MIPS_ABI_N32:
- set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5913,7 +5921,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_n32n64_reg_struct_has_addr);
break;
case MIPS_ABI_N64:
- set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -6003,7 +6011,7 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */
set_gdbarch_read_sp (gdbarch, mips_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_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. */
@@ -6026,18 +6034,13 @@ mips_gdbarch_init (struct gdbarch_info info,
/* MIPS version of CALL_DUMMY */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
- set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, mips_fix_call_dummy);
set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
- set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
set_gdbarch_frame_align (gdbarch, mips_frame_align);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 087c9df..960e83e 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1185,25 +1185,21 @@ mn10300_gdbarch_init (struct gdbarch_info info,
set_gdbarch_read_fp (gdbarch, generic_target_read_sp);
/* Calling functions in the inferior from GDB. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_call_dummy_words (gdbarch, mn10300_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (mn10300_call_dummy_words));
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments);
set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr);
- set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mn10300_push_return_address);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_use_struct_convention (gdbarch, mn10300_use_struct_convention);
tdep->am33_mode = am33_mode;
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 323cade..c451ed9 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -595,12 +595,11 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
set_gdbarch_deprecated_pop_frame (gdbarch, ns32k_pop_frame);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words);
set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy);
set_gdbarch_call_dummy_start_offset (gdbarch, 3);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
+ set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 15);
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
@@ -611,6 +610,9 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Misc info */
set_gdbarch_function_start_offset (gdbarch, 0);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 8e52fc0..002600d 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -247,9 +247,11 @@ exp1 : exp
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@ -569,6 +571,7 @@ exp : SELECTOR
write_exp_elt_opcode (OP_OBJC_SELECTOR);
write_exp_string ($1);
write_exp_elt_opcode (OP_OBJC_SELECTOR); }
+ ;
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 911831e..6fbbaa7 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -237,7 +237,7 @@ value_nsstring (char *ptr, int len)
/* Objective-C name demangling. */
char *
-objc_demangle (const char *mangled)
+objc_demangle (const char *mangled, int options)
{
char *demangled, *cp;
@@ -700,6 +700,7 @@ const struct language_defn objc_language_defn = {
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
objc_skip_trampoline, /* Language specific skip_trampoline */
+ objc_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 02688c7..0c49bac 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -41,7 +41,7 @@ extern int c_value_print (struct value *, struct ui_file *,
extern CORE_ADDR lookup_objc_class (char *classname);
extern int lookup_child_selector (char *methodname);
-extern char *objc_demangle (const char *mangled);
+extern char *objc_demangle (const char *mangled, int options);
extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 40019a4..827fa0e 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -462,6 +462,7 @@ const struct language_defn pascal_language_defn =
pascal_val_print, /* Print a value using appropriate syntax */
pascal_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "%", "b", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index b38968d..ae87bd7 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1956,28 +1956,13 @@ print_frame_nameless_args (struct frame_info *fi, long start, int num,
for (i = 0; i < num; i++)
{
QUIT;
-#ifdef NAMELESS_ARG_VALUE
- NAMELESS_ARG_VALUE (fi, start, &arg_value);
-#else
argsaddr = get_frame_args_address (fi);
if (!argsaddr)
return;
-
arg_value = read_memory_integer (argsaddr + start, sizeof (int));
-#endif
-
if (!first)
fprintf_filtered (stream, ", ");
-
-#ifdef PRINT_NAMELESS_INTEGER
- PRINT_NAMELESS_INTEGER (stream, arg_value);
-#else
-#ifdef PRINT_TYPELESS_INTEGER
- PRINT_TYPELESS_INTEGER (stream, builtin_type_int, (LONGEST) arg_value);
-#else
fprintf_filtered (stream, "%ld", arg_value);
-#endif /* PRINT_TYPELESS_INTEGER */
-#endif /* PRINT_NAMELESS_INTEGER */
first = 0;
start += sizeof (int);
}
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c669017..70af06f 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1328,16 +1328,16 @@ regcache_collect (int regnum, void *buf)
}
-/* read_pc, write_pc, read_sp, write_sp, read_fp, etc. Special
- handling for registers PC, SP, and FP. */
+/* read_pc, write_pc, read_sp, read_fp, etc. Special handling for
+ registers PC, SP, and FP. */
/* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(),
read_pc_pid(), read_pc(), generic_target_write_pc(),
write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(),
- generic_target_write_sp(), write_sp(), generic_target_read_fp() and
- read_fp(), will eventually be moved out of the reg-cache into
- either frame.[hc] or to the multi-arch framework. The are not part
- of the raw register cache. */
+ generic_target_write_sp(), generic_target_read_fp() and read_fp(),
+ will eventually be moved out of the reg-cache into either
+ frame.[hc] or to the multi-arch framework. The are not part of the
+ raw register cache. */
/* This routine is getting awfully cluttered with #if's. It's probably
time to turn this into READ_PC and define it in the tm.h file.
@@ -1456,12 +1456,6 @@ generic_target_write_sp (CORE_ADDR val)
"generic_target_write_sp");
}
-void
-write_sp (CORE_ADDR val)
-{
- TARGET_WRITE_SP (val);
-}
-
CORE_ADDR
generic_target_read_fp (void)
{
diff --git a/gdb/remote.h b/gdb/remote.h
index e2171b2..4477148 100644
--- a/gdb/remote.h
+++ b/gdb/remote.h
@@ -54,4 +54,7 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off,
extern void async_remote_interrupt_twice (void *arg);
+extern void (*target_resume_hook) (void);
+extern void (*target_wait_loop_hook) (void);
+
#endif
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 539905e..ef33028 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2076,10 +2076,10 @@ rs6000_extract_struct_value_address (struct regcache *regcache)
/* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior
function call GDB knows the address of the struct return value
and hence, should not need to call this function. Unfortunately,
- the current hand_function_call() code only saves the most recent
- struct address leading to occasional calls. The code should
- instead maintain a stack of such addresses (in the dummy frame
- object). */
+ the current call_function_by_hand() code only saves the most
+ recent struct address leading to occasional calls. The code
+ should instead maintain a stack of such addresses (in the dummy
+ frame object). */
/* NOTE: cagney/2002-09-26: Return 0 which indicates that we've
really got no idea where the return value is being stored. While
r3, on function entry, contained the address it will have since
@@ -2876,7 +2876,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_num_regs (gdbarch, v->nregs);
set_gdbarch_num_pseudo_regs (gdbarch, v->npregs);
@@ -2900,16 +2900,10 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible);
@@ -2924,9 +2918,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
64-bit code. At some point in the future, this matter needs to be
revisited. */
if (sysv_abi && wordsize == 4)
- set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
else
- set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, rs6000_push_arguments);
set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return);
set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 18b7d10..deff25d 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1861,17 +1861,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
(gdbarch, generic_cannot_extract_struct_value_address);
/* Parameters for inferior function calls. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_push_arguments (gdbarch, s390_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_push_return_address (gdbarch, s390_push_return_address);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (s390_call_dummy_words));
set_gdbarch_call_dummy_words (gdbarch, s390_call_dummy_words);
@@ -1907,6 +1899,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
}
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 746e599..99a1fd5 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -251,6 +251,7 @@ const struct language_defn scm_language_defn =
scm_val_print, /* Print a value using appropriate syntax */
scm_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"#o%lo", "#o", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 7649c62..804b34a 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -4375,7 +4375,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh_push_arguments);
set_gdbarch_deprecated_store_struct_return (gdbarch, sh_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
@@ -4617,7 +4617,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain);
set_gdbarch_deprecated_get_saved_register (gdbarch, sh64_get_saved_register);
set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh64_push_arguments);
/*set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);*/
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
@@ -4641,7 +4641,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_register_name (gdbarch, sh_register_name);
set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type);
@@ -4653,17 +4653,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, sh_push_return_address);
set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value);
set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c
index ba5e7ea..ca46a9e 100644
--- a/gdb/signals/signals.c
+++ b/gdb/signals/signals.c
@@ -518,6 +518,8 @@ static int
do_target_signal_to_host (enum target_signal oursig,
int *oursig_ok)
{
+ int retsig;
+
*oursig_ok = 1;
switch (oursig)
{
@@ -742,36 +744,31 @@ do_target_signal_to_host (enum target_signal oursig,
default:
#if defined (REALTIME_LO)
- if (oursig < REALTIME_LO || oursig >= REALTIME_HI)
- {
- *oursig_ok = 0;
- return 0;
- }
+ retsig = 0;
if (oursig >= TARGET_SIGNAL_REALTIME_33
&& oursig <= TARGET_SIGNAL_REALTIME_63)
{
/* This block of signals is continuous, and
TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
- return retsig;
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
}
else if (oursig == TARGET_SIGNAL_REALTIME_32)
{
/* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
- return 32;
+ retsig = 32;
}
else if (oursig >= TARGET_SIGNAL_REALTIME_64
&& oursig <= TARGET_SIGNAL_REALTIME_127)
{
/* This block of signals is continuous, and
TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
- return retsig;
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
}
+
+ if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
+ return retsig;
#endif
*oursig_ok = 0;
diff --git a/gdb/somread.c b/gdb/somread.c
index 85d4f0a..654ae06 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -37,6 +37,8 @@
/* Various things we might complain about... */
+static int init_import_symbols (struct objfile *objfile);
+
static void som_symfile_init (struct objfile *);
static void som_new_init (struct objfile *);
@@ -466,7 +468,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
not defined there. (Variables that are imported are dealt
with as "loc_indirect" vars.)
Return value = number of import symbols read in. */
-int
+static int
init_import_symbols (struct objfile *objfile)
{
unsigned int import_list;
diff --git a/gdb/somsolib.h b/gdb/somsolib.h
index 0840067..c241411 100644
--- a/gdb/somsolib.h
+++ b/gdb/somsolib.h
@@ -23,6 +23,9 @@
Written by the Center for Software Science at the Univerity of Utah
and by Cygnus Support. */
+#ifndef SOMSOLIB_H
+#define SOMSOLIB_H
+
/* Forward decl's for prototypes */
struct target_ops;
struct objfile;
@@ -164,3 +167,12 @@ extern char *som_solib_address (CORE_ADDR); /* somsolib.c */
/* If ADDR lies in a shared library, return its name. */
#define PC_SOLIB(addr) som_solib_address (addr)
+
+extern CORE_ADDR som_solib_get_solib_by_pc (CORE_ADDR addr);
+
+struct so_list;
+extern CORE_ADDR so_lib_thread_start_addr (struct so_list *so);
+
+extern void no_shared_libraries (char *ignored, int from_tty);
+
+#endif
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index e9daad8..0e57aef 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1040,7 +1040,7 @@ sparc_push_dummy_frame (void)
sp -= DUMMY_STACK_SIZE;
- write_sp (sp);
+ DEPRECATED_DUMMY_WRITE_SP (sp);
write_memory (sp + DUMMY_REG_SAVE_OFFSET, &register_temp[0],
DUMMY_STACK_REG_BUF_SIZE);
@@ -1310,7 +1310,7 @@ sparc_pop_frame (void)
read_memory_integer (fsr[O0_REGNUM + 7],
SPARC_INTREG_SIZE));
- write_sp (get_frame_base (frame));
+ DEPRECATED_DUMMY_WRITE_SP (get_frame_base (frame));
}
else if (fsr[I0_REGNUM])
{
@@ -3137,8 +3137,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* First set settings that are common for all sparc architectures. */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address);
@@ -3161,7 +3159,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
set_gdbarch_deprecated_pop_frame (gdbarch, sparc_pop_frame);
- set_gdbarch_push_return_address (gdbarch, sparc_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, sparc_push_return_address);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
set_gdbarch_register_convert_to_raw (gdbarch, sparc_convert_to_raw);
@@ -3246,20 +3244,16 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_words (gdbarch, call_dummy_32);
#else
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
#endif
set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 68);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_frame_args_skip (gdbarch, 68);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_npc_regnum (gdbarch, SPARC32_NPC_REGNUM);
set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM);
set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_push_arguments (gdbarch, sparc32_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
@@ -3279,7 +3273,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch,
generic_use_struct_convention);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
tdep->y_regnum = SPARC32_Y_REGNUM;
tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32;
tdep->intreg_size = 4;
@@ -3302,10 +3296,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_words (gdbarch, call_dummy_64);
#else
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
#endif
set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 128);
@@ -3315,7 +3305,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_npc_regnum (gdbarch, SPARC64_NPC_REGNUM);
set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM);
set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_push_arguments (gdbarch, sparc64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sparc64_push_arguments);
/* NOTE different for at_entry */
set_gdbarch_read_fp (gdbarch, sparc64_read_fp);
set_gdbarch_read_sp (gdbarch, sparc64_read_sp);
@@ -3337,7 +3327,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_store_struct_return (gdbarch, sparc64_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch,
sparc64_use_struct_convention);
- set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, sparc64_write_sp);
tdep->y_regnum = SPARC64_Y_REGNUM;
tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;
tdep->intreg_size = 8;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 8380b27..7d7886a 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3573,7 +3573,7 @@ symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
all sections begin at 0. */
bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL);
- return bfd_simple_get_relocated_section_contents (abfd, sectp, buf);
+ return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
}
void
diff --git a/gdb/symtab.h b/gdb/symtab.h
index f2f2d24..79705fe 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -402,8 +402,8 @@ enum address_class
/* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER
except this is an argument. Probably the cleaner way to handle
this would be to separate address_class (which would include
- separate ARG and LOCAL to deal with get_frame_args_address()
- versus get_frame_locals_address()), and an is_argument flag.
+ separate ARG and LOCAL to deal with FRAME_ARGS_ADDRESS versus
+ FRAME_LOCALS_ADDRESS), and an is_argument flag.
For some symbol formats (stabs, for some compilers at least),
the compiler generates two symbols, an argument and a register.
@@ -447,9 +447,9 @@ enum address_class
/* Value is arg at SYMBOL_VALUE offset in stack frame. Differs from
LOC_LOCAL in that symbol is an argument; differs from LOC_ARG in
- that we find it in the frame (get_frame_locals_address()), not in
- the arglist (get_frame_args_address()). Added for i960, which
- passes args in regs then copies to frame. */
+ that we find it in the frame (FRAME_LOCALS_ADDRESS), not in the
+ arglist (FRAME_ARGS_ADDRESS). Added for i960, which passes args
+ in regs then copies to frame. */
LOC_LOCAL_ARG,
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4337088..0cadc56 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,47 @@
+2003-04-02 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/callfuncs.exp: Make "print add" messages unique.
+ * gdb.base/ending-run.exp: Put spaces around "breakpoint" to stop
+ matching directories by the name breakpoint.
+ * gdb.base/pointers.exp: Make "ptype pppC" message consistent.
+ Make "continue to marker1" consistent.
+ * gdb.base/call-rt-st.exp: Make "finish out from loop_count"
+ message consistent.
+ * lib/gdb.exp: Put "the program is no longer running", and "the
+ program exited" in parenthesis.
+ * lib/mi-support.exp: Ditto.
+
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * gdb.mi/mi-file.exp: New file for -file-list-exec-source-file.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/sizeof.c (main): Print the value of '\377'.
+ * gdb.base/sizeof.exp: Check the sign of '\377'.
+
+2003-03-27 Michael Chastain <mec@shout.net>
+
+ * gdb.base/gdb1090.exp: New file.
+ * gdb.base/gdb1090.cc: New file.
+
+2003-03-27 J. Brobecker <brobecker@gnat.com>
+
+ * gdb.gdb/observer.exp: New regression test.
+
+2003-03-27 Michael Chastain <mec@shout.net>
+
+ * gdb.base/list.exp: Remove setup_xfail_format for DWARF 1.
+ * gdb.base/ptype.exp: Likewise.
+
+2003-03-27 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.c++/casts.exp: Fix startup to run also on embedded targets.
+
+2003-03-26 Michael Chastain <mec@shout.net>
+
+ * gdb.base/ptype.exp: Actually use some typedef'd types.
+
2003-03-21 Stephane Carrez <stcarrez@nerim.fr>
* gdb.asm/asm-source.exp: Set asm-arch for m6811 and m6812.
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 115dcb3..0acd139 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -128,12 +128,18 @@ gdb_expect {
send_gdb "finish\n"
gdb_expect {
- -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
- pass "finish out from loop_count (line 617)"}
- -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
- pass "finish out from loop_count (line 615)"}
- -re ".*$gdb_prompt $" { fail "finish out from loop_count"}
- timeout { fail "(timeout)finish out from loop_count"}
+ -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
+ pass "finish out from loop_count (line 617)"
+ }
+ -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
+ pass "finish out from loop_count (line 615)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "finish out from loop_count"
+ }
+ timeout {
+ fail "finish out from loop_count (timeout)"
+ }
}
# Ask GDB to print the value of EXPR, and expect to see the regexp
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 9183fe4..7a5f143 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -342,7 +342,8 @@ if ![gdb_test "bt 2" \
# Call function (causing a breakpoint hit in the call dummy) and do a finish,
# make sure we are back at main and still have the same register contents.
-gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
+ "call function causing a breakpoint then do a finish"
gdb_test "finish" \
"Value returned is .* = 9" \
"finish from call dummy breakpoint returns correct value"
@@ -360,7 +361,8 @@ if ![gdb_test "bt 2" \
# Call function (causing a breakpoint hit in the call dummy) and do a return
# with a value, make sure we are back at main with the same register contents.
-gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
+ "call function causing a breakpoint and then do a return"
if ![gdb_test "return 7" \
"#0 main.*" \
"back at main after return from call dummy breakpoint" \
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index f89e142..3960f06 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -74,7 +74,7 @@ if [target_info exists use_gdb_stub] {
gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked"
send_gdb "i b\n"
gdb_expect {
- -re ".*breakpoint.*breakpoint.*$gdb_prompt $" {
+ -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "cleared bp at line before routine"
}
-re ".*3.*main.*31.*$gdb_prompt $" {
@@ -120,7 +120,7 @@ gdb_expect {
send_gdb "i b\n"
gdb_expect {
- -re ".*breakpoint.*breakpoint.*$gdb_prompt $" {
+ -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "all set to continue (didn't clear bps)"
}
-re ".*3.*main.*31.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index dee9152..84a15cf 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -164,11 +164,9 @@ proc test_listsize {} {
proc test_list_include_file {} {
global gdb_prompt
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
}
@@ -239,7 +237,6 @@ proc test_list_function {} {
# Ultrix gdb is the second case, still correct.
# SunPRO cc is the third case.
setup_xfail "powerpc-*-*"
- setup_xfail_format "DWARF 1"
gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
}
@@ -427,7 +424,6 @@ proc test_list_filename_and_function {} {
# SunPRO cc is the third case.
setup_xfail "rs6000-*-*" 1804
setup_xfail "powerpc-*-*" 1804
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
send_gdb "list list0.h:foo\n"
gdb_expect {
@@ -496,7 +492,6 @@ proc test_list_filename_and_function {} {
gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
- setup_xfail_format "DWARF 1"
gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
}
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 5f406ad..a10a7f3 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -366,23 +366,28 @@ gdb_expect {
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
- send_gdb "cont\n"
- gdb_expect {
- -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
- send_gdb "up\n"
- gdb_expect {
- -re ".*more_code.*$gdb_prompt $" {
- pass "up from marker1"
- }
- -re ".*$gdb_prompt $" {
- fail "up from marker1"
- }
- timeout { fail "up from marker1 (timeout)" }
- }
- }
- -re "$gdb_prompt $" { fail "continue to marker1" }
- timeout { fail "(timeout) continue to marker1" }
+send_gdb "cont\n"
+gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ pass "continue to marker1"
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*more_code.*$gdb_prompt $" {
+ pass "up from marker1"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "up from marker1"
+ }
+ timeout { fail "up from marker1 (timeout)" }
+ }
+ }
+ -re "$gdb_prompt $" {
+ fail "continue to marker1"
}
+ timeout {
+ fail "continue to marker1 (timeout)"
+ }
+}
send_gdb "print *pUC\n"
@@ -568,7 +573,7 @@ gdb_expect {
send_gdb "ptype pppC\n"
gdb_expect {
- -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" }
+ -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" }
-re ".*$gdb_prompt $" { fail "ptype pppC" }
timeout { fail "(timeout) ptype pppC" }
}
diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c
index 2c85c7c..397a714 100644
--- a/gdb/testsuite/gdb.base/ptype.c
+++ b/gdb/testsuite/gdb.base/ptype.c
@@ -59,6 +59,7 @@ double v_double_array[2];
/* PR 3742 */
typedef char t_char_array[];
+t_char_array *pv_char_array;
/**** pointers *******/
@@ -237,6 +238,8 @@ int (*xptr) (int (*) (), int (*) (void), int);
int (*(*ffptr) (char)) (short);
int (*(*(*fffptr) (char)) (short)) (long);
+func_type v_func_type;
+
/* Here are the sort of stabs we expect to see for the above:
.stabs "func_type:t(0,100)=*(0,101)=g(0,1)(0,102)=*(0,103)=g(0,1)(0,1)(0,14)#(0,14)#",128,0,234,0
diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp
index 6e33d85..6580b43 100644
--- a/gdb/testsuite/gdb.base/ptype.exp
+++ b/gdb/testsuite/gdb.base/ptype.exp
@@ -1,5 +1,5 @@
# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999,
-# 2000, 2002 Free Software Foundation, Inc.
+# 2000, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -137,7 +137,6 @@ if {!$gcc_compiled && !$hp_aCC_compiler} {
# For get_debug_format to do its job, we need to have a current source file.
gdb_test "list main" ""
get_debug_format
-setup_xfail_format "DWARF 1"
gdb_test "whatis v_boolean" "type = (enum |)boolean" \
"whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
@@ -370,7 +369,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
#
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
-setup_xfail_format "DWARF 1"
if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c
index 95d379e..c32231f 100644
--- a/gdb/testsuite/gdb.base/sizeof.c
+++ b/gdb/testsuite/gdb.base/sizeof.c
@@ -114,6 +114,7 @@ main ()
printf ("sizeof (long double) == %d\n", sizeof (long double));
/* Signed char? */
+ printf ("valueof ('\\377') == %d\n", '\377');
printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1);
printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1);
printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1);
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 7c03905..7fcbe0e 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -154,10 +154,12 @@ proc check_valueof { exp val } {
# Check that GDB and the target agree over the sign of a character.
+set signof_byte [get_valueof "/d" "'\\377'" -1]
set signof_char [get_valueof "/d" "(int) (char) -1" -1]
set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
+check_valueof "'\\\\377'" ${signof_byte}
check_valueof "(int) (char) -1" ${signof_char}
check_valueof "(int) (signed char) -1" ${signof_signed_char}
check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char}
diff --git a/gdb/testsuite/gdb.c++/casts.exp b/gdb/testsuite/gdb.c++/casts.exp
index 859755f..5b6cabe 100644
--- a/gdb/testsuite/gdb.c++/casts.exp
+++ b/gdb/testsuite/gdb.c++/casts.exp
@@ -55,11 +55,16 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \
"Breakpoint.*at.* file .*" \
""
-gdb_test "run" "Breakpoint .* at .*casts.cc.*" ""
+gdb_test "continue" "Breakpoint .* at .*casts.cc.*" ""
# Casting a pointer to a base class to a pointer to a derived class
# should yield the entire derived class. Until August 2002, GDB got
diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp
new file mode 100644
index 0000000..2ffdcbf
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-file.exp
@@ -0,0 +1,65 @@
+# 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=mi"
+
+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 srcfile
+ global srcdir
+ global subdir
+ set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
+
+ # get the path and absolute path to the current executable
+ mi_gdb_test "111-file-list-exec-source-file" \
+ "111\\\^done,line=\"23\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
+ "request path info of current source file (${srcfile})"
+}
+
+test_tbreak_creation_and_listing
+
+mi_gdb_exit
+return 0
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d2b6fbd..4dfbf76 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -541,27 +541,27 @@ proc gdb_test_multiple { command message user_code } {
}
-re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
set result -1
}
-re "EXIT code \[0-9\r\n\]+Program exited normally.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
set result -1
}
-re "The program is not being run.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program is no longer running"
+ set errmsg "$message (the program is no longer running)"
} else {
- set errmsg "$command: the program is no longer running"
+ set errmsg "$command (the program is no longer running)"
}
fail "$errmsg"
set result -1
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 4b057d4..5907628 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -549,18 +549,18 @@ proc mi_gdb_test { args } {
}
-re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
return -1
}
-re "The program is not being run.*$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
- set errmsg "$message: the program is no longer running"
+ set errmsg "$message (the program is no longer running)"
} else {
- set errmsg "$command: the program is no longer running"
+ set errmsg "$command (the program is no longer running)"
}
fail "$errmsg"
return -1
diff --git a/gdb/thread.c b/gdb/thread.c
index 2c70ee5..1b6d872 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -255,9 +255,8 @@ in_thread_list (ptid_t ptid)
/* Print a list of thread ids currently known, and the total number of
threads. To be used from within catch_errors. */
-static int
-do_captured_list_thread_ids (struct ui_out *uiout,
- void *arg)
+static int
+do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
{
struct thread_info *tp;
int num = 0;
@@ -291,24 +290,23 @@ gdb_list_thread_ids (struct ui_out *uiout)
/* Load infrun state for the thread PID. */
void
-load_infrun_state (ptid_t ptid,
- CORE_ADDR *prev_pc,
+load_infrun_state (ptid_t ptid,
+ CORE_ADDR *prev_pc,
CORE_ADDR *prev_func_start,
- char **prev_func_name,
+ char **prev_func_name,
int *trap_expected,
struct breakpoint **step_resume_breakpoint,
struct breakpoint **through_sigtramp_breakpoint,
- CORE_ADDR *step_range_start,
+ CORE_ADDR *step_range_start,
CORE_ADDR *step_range_end,
- struct frame_id *step_frame_id,
+ struct frame_id *step_frame_id,
int *handling_longjmp,
- int *another_trap,
+ int *another_trap,
int *stepping_through_solib_after_catch,
bpstat *stepping_through_solib_catchpoints,
int *stepping_through_sigtramp,
- int *current_line,
- struct symtab **current_symtab,
- CORE_ADDR *step_sp)
+ int *current_line,
+ struct symtab **current_symtab, CORE_ADDR *step_sp)
{
struct thread_info *tp;
@@ -329,8 +327,10 @@ load_infrun_state (ptid_t ptid,
*step_frame_id = tp->step_frame_id;
*handling_longjmp = tp->handling_longjmp;
*another_trap = tp->another_trap;
- *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
- *stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints;
+ *stepping_through_solib_after_catch =
+ tp->stepping_through_solib_after_catch;
+ *stepping_through_solib_catchpoints =
+ tp->stepping_through_solib_catchpoints;
*stepping_through_sigtramp = tp->stepping_through_sigtramp;
*current_line = tp->current_line;
*current_symtab = tp->current_symtab;
@@ -340,24 +340,23 @@ load_infrun_state (ptid_t ptid,
/* Save infrun state for the thread PID. */
void
-save_infrun_state (ptid_t ptid,
- CORE_ADDR prev_pc,
+save_infrun_state (ptid_t ptid,
+ CORE_ADDR prev_pc,
CORE_ADDR prev_func_start,
- char *prev_func_name,
+ char *prev_func_name,
int trap_expected,
struct breakpoint *step_resume_breakpoint,
struct breakpoint *through_sigtramp_breakpoint,
- CORE_ADDR step_range_start,
+ CORE_ADDR step_range_start,
CORE_ADDR step_range_end,
- const struct frame_id *step_frame_id,
+ const struct frame_id *step_frame_id,
int handling_longjmp,
- int another_trap,
+ int another_trap,
int stepping_through_solib_after_catch,
bpstat stepping_through_solib_catchpoints,
- int stepping_through_sigtramp,
+ int stepping_through_sigtramp,
int current_line,
- struct symtab *current_symtab,
- CORE_ADDR step_sp)
+ struct symtab *current_symtab, CORE_ADDR step_sp)
{
struct thread_info *tp;
@@ -506,7 +505,7 @@ switch_to_thread (ptid_t ptid)
static void
restore_current_thread (ptid_t ptid)
{
- if (! ptid_equal (ptid, inferior_ptid))
+ if (!ptid_equal (ptid, inferior_ptid))
{
switch_to_thread (ptid);
print_stack_frame (get_current_frame (), 0, -1);
@@ -571,14 +570,13 @@ thread_apply_all_command (char *cmd, int from_tty)
switch_to_thread (tp->ptid);
#ifdef HPUXHPPA
printf_filtered ("\nThread %d (%s):\n",
- tp->num,
- target_tid_to_str (inferior_ptid));
+ tp->num, target_tid_to_str (inferior_ptid));
#else
printf_filtered ("\nThread %d (%s):\n", tp->num,
target_pid_to_str (inferior_ptid));
#endif
execute_command (cmd, from_tty);
- strcpy (cmd, saved_cmd); /* Restore exact command used previously */
+ strcpy (cmd, saved_cmd); /* Restore exact command used previously */
}
do_cleanups (saved_cmd_cleanup_chain);
@@ -690,8 +688,7 @@ thread_command (char *tidstr, int from_tty)
}
static int
-do_captured_thread_select (struct ui_out *uiout,
- void *tidstr)
+do_captured_thread_select (struct ui_out *uiout, void *tidstr)
{
int num;
struct thread_info *tp;
@@ -724,8 +721,7 @@ do_captured_thread_select (struct ui_out *uiout,
}
enum gdb_rc
-gdb_thread_select (struct ui_out *uiout,
- char *tidstr)
+gdb_thread_select (struct ui_out *uiout, char *tidstr)
{
return catch_exceptions (uiout, do_captured_thread_select, tidstr,
NULL, RETURN_MASK_ALL);
@@ -744,16 +740,14 @@ _initialize_thread (void)
add_prefix_cmd ("thread", class_run, thread_command,
"Use this command to switch between threads.\n\
-The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1,
- &cmdlist);
+The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1, &cmdlist);
add_prefix_cmd ("apply", class_run, thread_apply_command,
"Apply a command to a list of threads.",
&thread_apply_list, "apply ", 1, &thread_cmd_list);
add_cmd ("all", class_run, thread_apply_all_command,
- "Apply a command to all threads.",
- &thread_apply_list);
+ "Apply a command to all threads.", &thread_apply_list);
if (!xdb_commands)
add_com_alias ("t", "thread", class_run, 1);
diff --git a/gdb/utils.c b/gdb/utils.c
index f7ece88..f8ac0fd 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2298,22 +2298,7 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name,
}
else
{
- switch (lang)
- {
- case language_cplus:
- demangled = cplus_demangle (name, arg_mode);
- break;
- case language_java:
- demangled = cplus_demangle (name, arg_mode | DMGL_JAVA);
- break;
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /*demangled = objc_demangle (name); */
- /*break; */
- default:
- demangled = NULL;
- break;
- }
+ demangled = language_demangle (language_def (lang), name, arg_mode);
fputs_filtered (demangled ? demangled : name, stream);
if (demangled != NULL)
{
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 9bae316..ca627e6 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1268,20 +1268,14 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, v850_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, v850_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, v850_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, v850_push_arguments);
set_gdbarch_deprecated_pop_frame (gdbarch, v850_pop_frame);
set_gdbarch_deprecated_store_struct_return (gdbarch, v850_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, v850_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, v850_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, v850_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, v850_fix_call_dummy);
@@ -1292,6 +1286,9 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/valops.c b/gdb/valops.c
index ff24a9f..a2a2e97 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1079,8 +1079,8 @@ value_push (register CORE_ADDR sp, struct value *arg)
}
CORE_ADDR
-default_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+legacy_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+ int struct_return, CORE_ADDR struct_addr)
{
/* ASSERT ( !struct_return); */
int i;
@@ -1240,8 +1240,8 @@ find_function_addr (struct value *function, struct type **retval_type)
ARGS is modified to contain coerced values. */
-static struct value *
-hand_function_call (struct value *function, int nargs, struct value **args)
+struct value *
+call_function_by_hand (struct value *function, int nargs, struct value **args)
{
register CORE_ADDR sp;
register int i;
@@ -1264,6 +1264,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
static ULONGEST *dummy;
int sizeof_dummy1;
char *dummy1;
+ CORE_ADDR dummy_addr;
CORE_ADDR old_sp;
struct type *value_type;
unsigned char struct_return;
@@ -1423,26 +1424,34 @@ hand_function_call (struct value *function, int nargs, struct value **args)
real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
value_type, using_gcc);
#else
- FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
- value_type, using_gcc);
+ if (FIX_CALL_DUMMY_P ())
+ {
+ /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true? */
+ FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type,
+ using_gcc);
+ }
real_pc = start_sp;
#endif
- if (CALL_DUMMY_LOCATION == ON_STACK)
+ switch (CALL_DUMMY_LOCATION)
{
+ case ON_STACK:
+ dummy_addr = start_sp;
write_memory (start_sp, (char *) dummy1, sizeof_dummy1);
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1);
- }
-
- if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
- {
+ break;
+ case AT_ENTRY_POINT:
real_pc = funaddr;
+ dummy_addr = CALL_DUMMY_ADDRESS ();
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
/* NOTE: cagney/2002-04-13: The entry point is going to be
modified with a single breakpoint. */
generic_save_call_dummy_addr (CALL_DUMMY_ADDRESS (),
CALL_DUMMY_ADDRESS () + 1);
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
}
#ifdef lint
@@ -1569,9 +1578,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
{
int len = TYPE_LENGTH (value_type);
if (STACK_ALIGN_P ())
- /* MVS 11/22/96: I think at least some of this stack_align
- code is really broken. Better to let PUSH_ARGUMENTS adjust
- the stack in a target-defined manner. */
+ /* NOTE: cagney/2003-03-22: Should rely on frame align, rather
+ than stack align to force the alignment of the stack. */
len = STACK_ALIGN (len);
if (INNER_THAN (1, 2))
{
@@ -1605,7 +1613,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
if (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
{
/* MVS 11/22/96: I think at least some of this stack_align code
- is really broken. Better to let PUSH_ARGUMENTS adjust the
+ is really broken. Better to let push_dummy_call() adjust the
stack in a target-defined manner. */
if (STACK_ALIGN_P () && INNER_THAN (1, 2))
{
@@ -1620,9 +1628,24 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
}
}
- sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
+ /* Create the dummy stack frame. Pass in the call dummy address as,
+ presumably, the ABI code knows where, in the call dummy, the
+ return address should be pointed. */
+ if (gdbarch_push_dummy_call_p (current_gdbarch))
+ /* When there is no push_dummy_call method, should this code
+ simply error out. That would the implementation of this method
+ for all ABIs (which is probably a good thing). */
+ sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache,
+ dummy_addr, nargs, args, sp, struct_return,
+ struct_addr);
+ else if (DEPRECATED_PUSH_ARGUMENTS_P ())
+ /* Keep old targets working. */
+ sp = DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return,
+ struct_addr);
+ else
+ sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr);
- if (PUSH_RETURN_ADDRESS_P ())
+ if (DEPRECATED_PUSH_RETURN_ADDRESS_P ())
/* for targets that use no CALL_DUMMY */
/* There are a number of targets now which actually don't write
any CALL_DUMMY instructions into the target, but instead just
@@ -1633,9 +1656,14 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
return-address register as appropriate. Formerly this has been
done in PUSH_ARGUMENTS, but that's overloading its
functionality a bit, so I'm making it explicit to do it here. */
- sp = PUSH_RETURN_ADDRESS (real_pc, sp);
+ sp = DEPRECATED_PUSH_RETURN_ADDRESS (real_pc, sp);
- if (STACK_ALIGN_P () && !INNER_THAN (1, 2))
+ /* NOTE: cagney/2003-03-23: Diable this code when there is a
+ push_dummy_call() method. Since that method will have already
+ handled any alignment issues, the code below is entirely
+ redundant. */
+ if (!gdbarch_push_dummy_call_p (current_gdbarch)
+ && STACK_ALIGN_P () && !INNER_THAN (1, 2))
{
/* If stack grows up, we must leave a hole at the bottom, note
that sp already has been advanced for the arguments! */
@@ -1667,7 +1695,13 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
might fool with it. On SPARC, this write also stores the register
window into the right place in the new stack frame, which otherwise
wouldn't happen. (See store_inferior_registers in sparc-nat.c.) */
- write_sp (sp);
+ /* NOTE: cagney/2003-03-23: Disable this code when there is a
+ push_dummy_call() method. Since that method will have already
+ stored the stack pointer (as part of creating the fake call
+ frame), and none of the code following that code adjusts the
+ stack-pointer value, the below call is entirely redundant. */
+ if (DEPRECATED_DUMMY_WRITE_SP_P ())
+ DEPRECATED_DUMMY_WRITE_SP (sp);
if (SAVE_DUMMY_FRAME_TOS_P ())
SAVE_DUMMY_FRAME_TOS (sp);
@@ -1823,21 +1857,6 @@ the function call).", name);
}
}
-struct value *
-call_function_by_hand (struct value *function, int nargs, struct value **args)
-{
- if (CALL_DUMMY_P)
- {
- return hand_function_call (function, nargs, args);
- }
- else
- {
- error ("Cannot invoke functions on this machine.");
- }
-}
-
-
-
/* Create a value for an array by allocating space in the inferior, copying
the data into that space, and then setting up an array value.
diff --git a/gdb/value.h b/gdb/value.h
index 04be76a..783191a 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -128,9 +128,7 @@ struct value
list. */
struct value *next;
- /* Register number if the value is from a register. Is not kept
- if you take a field of a structure that is stored in a
- register. Shouldn't it be? */
+ /* Register number if the value is from a register. */
short regno;
/* If zero, contents of this value are in the contents field.
If nonzero, contents are in inferior memory at address
@@ -560,9 +558,9 @@ extern struct value *find_function_in_inferior (const char *);
extern struct value *value_allocate_space_in_inferior (int);
-extern CORE_ADDR default_push_arguments (int nargs, struct value ** args,
- CORE_ADDR sp, int struct_return,
- CORE_ADDR struct_addr);
+extern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args,
+ CORE_ADDR sp, int struct_return,
+ CORE_ADDR struct_addr);
extern struct value *value_of_local (const char *name, int complain);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index d2ac421..a39881f 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -668,12 +668,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_push_dummy_frame (gdbarch, vax_push_dummy_frame);
set_gdbarch_deprecated_pop_frame (gdbarch, vax_pop_frame);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, vax_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_vax_call_dummy_words);
set_gdbarch_fix_call_dummy (gdbarch, vax_fix_call_dummy);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 7);
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
@@ -686,6 +683,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_function_start_offset (gdbarch, 2);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/version.in b/gdb/version.in
index dae81b3..8ba75cc 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2003-03-26-cvs
+2003-04-03-cvs
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index 321d9c3..5d43e01 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -1013,8 +1013,8 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments);
- set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, x86_64_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, x86_64_push_return_address);
set_gdbarch_deprecated_pop_frame (gdbarch, x86_64_pop_frame);
set_gdbarch_deprecated_store_struct_return (gdbarch, x86_64_store_struct_return);
set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value);
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 5408a08..255912b 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -1084,24 +1084,17 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments);
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_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch,
xstormy16_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
set_gdbarch_char_signed (gdbarch, 0);
@@ -1122,6 +1115,9 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_in_solib_call_trampoline (gdbarch,
xstormy16_in_solib_call_trampoline);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/include/ChangeLog b/include/ChangeLog
index 0e558d3..9c16fdd 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,15 @@
+2003-04-02 Bob Wilson <bob.wilson@acm.org>
+
+ * xtensa-config.h: Remove comment indicating that this is a
+ generated file.
+
+2003-04-01 Bob Wilson <bob.wilson@acm.org>
+
+ * dis-asm.h (print_insn_xtensa): Declare.
+ * xtensa-config.h: New file.
+ * xtensa-isa-internal.h: Likewise.
+ * xtensa-isa.h: Likewise.
+
2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ansidecl.h (ATTRIBUTE_NONNULL, ATTRIBUTE_NULL_PRINTF,
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 5e6bdc3..392cbf9 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -237,6 +237,7 @@ extern int print_insn_v850 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_xtensa PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *));
extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *));
extern int print_insn_frv PARAMS ((bfd_vma, disassemble_info *));
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 5411f76..9d5ea67 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,12 @@
+2003-04-01 Bob Wilson <bob.wilson@acm.org>
+
+ * elf/common.h (EM_XTENSA_OLD): Define.
+ * elf/xtensa.h: New file.
+
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * arm.h (ARM_NOTE_SECTION): Include .gnu in the string.
+
2003-03-25 Stan Cox <scox@redhat.com>
Nick Clifton <nickc@redhat.com>
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 3b3f8d0..181a9f0 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -141,6 +141,6 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
END_RELOC_NUMBERS (R_ARM_max)
/* The name of the note section used to identify arm variants. */
-#define ARM_NOTE_SECTION ".note.arm.ident"
+#define ARM_NOTE_SECTION ".note.gnu.arm.ident"
#endif /* _ELF_ARM_H */
diff --git a/include/elf/common.h b/include/elf/common.h
index 2315fa8..a515817 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -261,6 +261,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Vitesse IQ2000. */
#define EM_IQ2000 0xFEBA
+
+/* Old, unofficial value for Xtensa. */
+#define EM_XTENSA_OLD 0xabc7
+
/* See the above comment before you add a new EM_* value here. */
/* Values for e_version. */
diff --git a/include/elf/xtensa.h b/include/elf/xtensa.h
new file mode 100644
index 0000000..394ee41
--- /dev/null
+++ b/include/elf/xtensa.h
@@ -0,0 +1,87 @@
+/* Xtensa ELF support for BFD.
+ Copyright 2003 Free Software Foundation, Inc.
+ Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* This file holds definitions specific to the Xtensa ELF ABI. */
+
+#ifndef _ELF_XTENSA_H
+#define _ELF_XTENSA_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocations. */
+START_RELOC_NUMBERS (elf_xtensa_reloc_type)
+ RELOC_NUMBER (R_XTENSA_NONE, 0)
+ RELOC_NUMBER (R_XTENSA_32, 1)
+ RELOC_NUMBER (R_XTENSA_RTLD, 2)
+ RELOC_NUMBER (R_XTENSA_GLOB_DAT, 3)
+ RELOC_NUMBER (R_XTENSA_JMP_SLOT, 4)
+ RELOC_NUMBER (R_XTENSA_RELATIVE, 5)
+ RELOC_NUMBER (R_XTENSA_PLT, 6)
+ RELOC_NUMBER (R_XTENSA_OP0, 8)
+ RELOC_NUMBER (R_XTENSA_OP1, 9)
+ RELOC_NUMBER (R_XTENSA_OP2, 10)
+ RELOC_NUMBER (R_XTENSA_ASM_EXPAND, 11)
+ RELOC_NUMBER (R_XTENSA_ASM_SIMPLIFY, 12)
+ RELOC_NUMBER (R_XTENSA_GNU_VTINHERIT, 15)
+ RELOC_NUMBER (R_XTENSA_GNU_VTENTRY, 16)
+END_RELOC_NUMBERS (R_XTENSA_max)
+
+/* Processor-specific flags for the ELF header e_flags field. */
+
+/* Four-bit Xtensa machine type field. */
+#define EF_XTENSA_MACH 0x0000000f
+
+/* Various CPU types. */
+#define E_XTENSA_MACH 0x00000000
+
+/* Leave bits 0xf0 alone in case we ever have more than 16 cpu types.
+ Highly unlikely, but what the heck. */
+
+#define EF_XTENSA_XT_INSN 0x00000100
+#define EF_XTENSA_XT_LIT 0x00000200
+
+
+/* Processor-specific dynamic array tags. */
+
+/* Offset of the table that records the GOT location(s). */
+#define DT_XTENSA_GOT_LOC_OFF 0x70000000
+
+/* Number of entries in the GOT location table. */
+#define DT_XTENSA_GOT_LOC_SZ 0x70000001
+
+
+/* Definitions for instruction and literal property tables. The
+ instruction tables for ".gnu.linkonce.t.*" sections are placed in
+ the following sections:
+
+ instruction tables: .gnu.linkonce.x.*
+ literal tables: .gnu.linkonce.p.*
+*/
+
+#define XTENSA_INSN_SEC_NAME ".xt.insn"
+#define XTENSA_LIT_SEC_NAME ".xt.lit"
+
+typedef struct property_table_entry_t
+{
+ bfd_vma address;
+ bfd_vma size;
+} property_table_entry;
+
+#endif /* _ELF_XTENSA_H */
diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog
index 97c2f44..9a216a0 100644
--- a/include/gdb/ChangeLog
+++ b/include/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-27 Nick Clifton <nickc@redhat.com>
+
+ * sim-arm.h (sim_arm_regs): Add iWMMXt registers.
+
2003-03-20 Nick Clifton <nickc@redhat.com>
* sim-arm.h (sim_arm_regs): Add Maverick co-processor
diff --git a/include/gdb/sim-arm.h b/include/gdb/sim-arm.h
index fae11f0..5598f73 100644
--- a/include/gdb/sim-arm.h
+++ b/include/gdb/sim-arm.h
@@ -72,7 +72,39 @@ enum sim_arm_regs
SIM_ARM_MAVERIC_COP0R13_REGNUM,
SIM_ARM_MAVERIC_COP0R14_REGNUM,
SIM_ARM_MAVERIC_COP0R15_REGNUM,
- SIM_ARM_MAVERIC_DSPSC_REGNUM
+ SIM_ARM_MAVERIC_DSPSC_REGNUM,
+ SIM_ARM_IWMMXT_COP0R0_REGNUM,
+ SIM_ARM_IWMMXT_COP0R1_REGNUM,
+ SIM_ARM_IWMMXT_COP0R2_REGNUM,
+ SIM_ARM_IWMMXT_COP0R3_REGNUM,
+ SIM_ARM_IWMMXT_COP0R4_REGNUM,
+ SIM_ARM_IWMMXT_COP0R5_REGNUM,
+ SIM_ARM_IWMMXT_COP0R6_REGNUM,
+ SIM_ARM_IWMMXT_COP0R7_REGNUM,
+ SIM_ARM_IWMMXT_COP0R8_REGNUM,
+ SIM_ARM_IWMMXT_COP0R9_REGNUM,
+ SIM_ARM_IWMMXT_COP0R10_REGNUM,
+ SIM_ARM_IWMMXT_COP0R11_REGNUM,
+ SIM_ARM_IWMMXT_COP0R12_REGNUM,
+ SIM_ARM_IWMMXT_COP0R13_REGNUM,
+ SIM_ARM_IWMMXT_COP0R14_REGNUM,
+ SIM_ARM_IWMMXT_COP0R15_REGNUM,
+ SIM_ARM_IWMMXT_COP1R0_REGNUM,
+ SIM_ARM_IWMMXT_COP1R1_REGNUM,
+ SIM_ARM_IWMMXT_COP1R2_REGNUM,
+ SIM_ARM_IWMMXT_COP1R3_REGNUM,
+ SIM_ARM_IWMMXT_COP1R4_REGNUM,
+ SIM_ARM_IWMMXT_COP1R5_REGNUM,
+ SIM_ARM_IWMMXT_COP1R6_REGNUM,
+ SIM_ARM_IWMMXT_COP1R7_REGNUM,
+ SIM_ARM_IWMMXT_COP1R8_REGNUM,
+ SIM_ARM_IWMMXT_COP1R9_REGNUM,
+ SIM_ARM_IWMMXT_COP1R10_REGNUM,
+ SIM_ARM_IWMMXT_COP1R11_REGNUM,
+ SIM_ARM_IWMMXT_COP1R12_REGNUM,
+ SIM_ARM_IWMMXT_COP1R13_REGNUM,
+ SIM_ARM_IWMMXT_COP1R14_REGNUM,
+ SIM_ARM_IWMMXT_COP1R15_REGNUM
};
#ifdef __cplusplus
diff --git a/include/xtensa-config.h b/include/xtensa-config.h
new file mode 100644
index 0000000..b47cbd7
--- /dev/null
+++ b/include/xtensa-config.h
@@ -0,0 +1,64 @@
+/* Xtensa configuration settings.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
+
+ 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef XTENSA_CONFIG_H
+#define XTENSA_CONFIG_H
+
+/* The macros defined here match those with the same names in the Xtensa
+ compile-time HAL (Hardware Abstraction Layer). Please refer to the
+ Xtensa System Software Reference Manual for documentation of these
+ macros. */
+
+#define XCHAL_HAVE_BE 1
+#define XCHAL_HAVE_DENSITY 1
+#define XCHAL_HAVE_MAC16 0
+#define XCHAL_HAVE_MUL16 0
+#define XCHAL_HAVE_MUL32 0
+#define XCHAL_HAVE_DIV32 0
+#define XCHAL_HAVE_NSA 1
+#define XCHAL_HAVE_MINMAX 0
+#define XCHAL_HAVE_SEXT 0
+#define XCHAL_HAVE_LOOPS 1
+#define XCHAL_HAVE_BOOLEANS 0
+#define XCHAL_HAVE_FP 0
+#define XCHAL_HAVE_FP_DIV 0
+#define XCHAL_HAVE_FP_RECIP 0
+#define XCHAL_HAVE_FP_SQRT 0
+#define XCHAL_HAVE_FP_RSQRT 0
+#define XCHAL_HAVE_WINDOWED 1
+
+#define XCHAL_ICACHE_SIZE 8192
+#define XCHAL_DCACHE_SIZE 8192
+#define XCHAL_ICACHE_LINESIZE 16
+#define XCHAL_DCACHE_LINESIZE 16
+#define XCHAL_ICACHE_LINEWIDTH 4
+#define XCHAL_DCACHE_LINEWIDTH 4
+#define XCHAL_DCACHE_IS_WRITEBACK 0
+
+#define XCHAL_HAVE_MMU 1
+#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 12
+
+#define XCHAL_HAVE_DEBUG 1
+#define XCHAL_NUM_IBREAK 2
+#define XCHAL_NUM_DBREAK 2
+#define XCHAL_DEBUGLEVEL 4
+
+#define XCHAL_EXTRA_SA_SIZE 0
+#define XCHAL_EXTRA_SA_ALIGN 1
+
+#endif /* !XTENSA_CONFIG_H */
diff --git a/include/xtensa-isa-internal.h b/include/xtensa-isa-internal.h
new file mode 100644
index 0000000..d2244c5
--- /dev/null
+++ b/include/xtensa-isa-internal.h
@@ -0,0 +1,114 @@
+/* Internal definitions for configurable Xtensa ISA support.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Use the statically-linked version for the GNU tools. */
+#define STATIC_LIBISA 1
+
+#define ISA_INTERFACE_VERSION 3
+
+struct config_struct
+{
+ char *param_name;
+ char *param_value;
+};
+
+/* Encode/decode function types for immediate operands. */
+typedef uint32 (*xtensa_immed_decode_fn) (uint32);
+typedef xtensa_encode_result (*xtensa_immed_encode_fn) (uint32 *);
+
+/* Field accessor function types. */
+typedef uint32 (*xtensa_get_field_fn) (const xtensa_insnbuf);
+typedef void (*xtensa_set_field_fn) (xtensa_insnbuf, uint32);
+
+/* PC-relative relocation function types. */
+typedef uint32 (*xtensa_do_reloc_fn) (uint32, uint32);
+typedef uint32 (*xtensa_undo_reloc_fn) (uint32, uint32);
+
+/* Instruction decode function type. */
+typedef int (*xtensa_insn_decode_fn) (const xtensa_insnbuf);
+
+/* Instruction encoding template function type (each of these functions
+ returns a constant template; they exist only to make it easier for the
+ TIE compiler to generate endian-independent DLLs). */
+typedef xtensa_insnbuf (*xtensa_encoding_template_fn) (void);
+
+
+typedef struct xtensa_operand_internal_struct
+{
+ char *operand_kind; /* e.g., "a", "f", "i", "l".... */
+ char inout; /* '<', '>', or '='. */
+ char isPCRelative; /* Is this a PC-relative offset? */
+ xtensa_get_field_fn get_field; /* Get encoded value of the field. */
+ xtensa_set_field_fn set_field; /* Set field with an encoded value. */
+ xtensa_immed_encode_fn encode; /* Encode the operand value. */
+ xtensa_immed_decode_fn decode; /* Decode the value from the field. */
+ xtensa_do_reloc_fn do_reloc; /* Perform a PC-relative relocation. */
+ xtensa_undo_reloc_fn undo_reloc; /* Undo a PC-relative relocation. */
+} xtensa_operand_internal;
+
+
+typedef struct xtensa_iclass_internal_struct
+{
+ int num_operands; /* Size of "operands" array. */
+ xtensa_operand_internal **operands; /* Array of operand structures. */
+} xtensa_iclass_internal;
+
+
+typedef struct xtensa_opcode_internal_struct
+{
+ const char *name; /* Opcode mnemonic. */
+ int length; /* Length in bytes of the insn. */
+ xtensa_encoding_template_fn template; /* Fn returning encoding template. */
+ xtensa_iclass_internal *iclass; /* Iclass for this opcode. */
+} xtensa_opcode_internal;
+
+
+typedef struct opname_lookup_entry_struct
+{
+ const char *key; /* Opcode mnemonic. */
+ xtensa_opcode opcode; /* Internal opcode number. */
+} opname_lookup_entry;
+
+
+typedef struct xtensa_isa_internal_struct
+{
+ int is_big_endian; /* Endianness. */
+ int insn_size; /* Maximum length in bytes. */
+ int insnbuf_size; /* Number of insnbuf_words. */
+ int num_opcodes; /* Total number for all modules. */
+ xtensa_opcode_internal **opcode_table;/* Indexed by internal opcode #. */
+ int num_modules; /* Number of modules (DLLs) loaded. */
+ int *module_opcode_base; /* Starting opcode # for each module. */
+ xtensa_insn_decode_fn *module_decode_fn; /* Decode fn for each module. */
+ opname_lookup_entry *opname_lookup_table; /* Lookup table for each module. */
+ struct config_struct *config; /* Table of configuration parameters. */
+ int has_density; /* Is density option available? */
+} xtensa_isa_internal;
+
+
+typedef struct xtensa_isa_module_struct
+{
+ const int (*get_num_opcodes_fn) (void);
+ xtensa_opcode_internal **(*get_opcodes_fn) (void);
+ int (*decode_insn_fn) (const xtensa_insnbuf);
+ struct config_struct *(*get_config_table_fn) (void);
+} xtensa_isa_module;
+
+extern xtensa_isa_module xtensa_isa_modules[];
+
diff --git a/include/xtensa-isa.h b/include/xtensa-isa.h
new file mode 100644
index 0000000..54f750c
--- /dev/null
+++ b/include/xtensa-isa.h
@@ -0,0 +1,230 @@
+/* Interface definition for configurable Xtensa ISA support.
+ Copyright 2003 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef XTENSA_LIBISA_H
+#define XTENSA_LIBISA_H
+
+/* Use the statically-linked version for the GNU tools. */
+#define STATIC_LIBISA 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef uint32
+#define uint32 unsigned int
+#endif
+
+/* This file defines the interface to the Xtensa ISA library. This library
+ contains most of the ISA-specific information for a particular Xtensa
+ processor. For example, the set of valid instructions, their opcode
+ encodings and operand fields are all included here. To support Xtensa's
+ configurability and user-defined instruction extensions (i.e., TIE), the
+ library is initialized by loading one or more dynamic libraries; only a
+ small set of interface code is present in the statically-linked portion
+ of the library.
+
+ This interface basically defines four abstract data types.
+
+ . an instruction buffer - for holding the raw instruction bits
+ . ISA info - information about the ISA as a whole
+ . opcode info - information about individual instructions
+ . operand info - information about specific instruction operands
+
+ It would be nice to implement these as classes in C++, but the library is
+ implemented in C to match the expectations of the GNU tools.
+ Instead, the interface defines a set of functions to access each data
+ type. With the exception of the instruction buffer, the internal
+ representations of the data structures are hidden. All accesses must be
+ made through the functions defined here. */
+
+typedef void* xtensa_isa;
+typedef void* xtensa_operand;
+
+
+/* Opcodes are represented here using sequential integers beginning with 0.
+ The specific value used for a particular opcode is only fixed for a
+ particular instantiation of an xtensa_isa structure, so these values
+ should only be used internally. */
+typedef int xtensa_opcode;
+
+/* Define a unique value for undefined opcodes ("static const int" doesn't
+ seem to work for this because EGCS 1.0.3 on i686-Linux without -O won't
+ allow it to be used as an initializer). */
+#define XTENSA_UNDEFINED -1
+
+
+typedef int libisa_module_specifier;
+
+extern xtensa_isa xtensa_isa_init (void);
+
+
+/* Instruction buffers. */
+
+typedef uint32 xtensa_insnbuf_word;
+typedef xtensa_insnbuf_word *xtensa_insnbuf;
+
+/* Get the size in words of the xtensa_insnbuf array. */
+extern int xtensa_insnbuf_size (xtensa_isa);
+
+/* Allocate (with malloc) an xtensa_insnbuf of the right size. */
+extern xtensa_insnbuf xtensa_insnbuf_alloc (xtensa_isa);
+
+/* Release (with free) an xtensa_insnbuf of the right size. */
+extern void xtensa_insnbuf_free (xtensa_insnbuf);
+
+/* Inward and outward conversion from memory images (byte streams) to our
+ internal instruction representation. */
+extern void xtensa_insnbuf_to_chars (xtensa_isa, const xtensa_insnbuf,
+ char *);
+
+extern void xtensa_insnbuf_from_chars (xtensa_isa, xtensa_insnbuf,
+ const char *);
+
+
+/* ISA information. */
+
+/* Load the ISA information from a shared library. If successful, this returns
+ a value which identifies the ISA for use in subsequent calls to the ISA
+ library; otherwise, it returns NULL. Multiple ISAs can be loaded to support
+ heterogeneous multiprocessor systems. */
+extern xtensa_isa xtensa_load_isa (libisa_module_specifier);
+
+/* Extend an existing set of ISA information by loading an additional shared
+ library of ISA information. This is primarily intended for loading TIE
+ extensions. If successful, the return value is non-zero. */
+extern int xtensa_extend_isa (xtensa_isa, libisa_module_specifier);
+
+/* The default ISA. This variable is set automatically to the ISA most
+ recently loaded and is provided as a convenience. An exception is the GNU
+ opcodes library, where there is a fixed interface that does not allow
+ passing the ISA as a parameter and the ISA must be taken from this global
+ variable. (Note: Since this variable is just a convenience, it is not
+ exported when libisa is built as a DLL, due to the hassle of dealing with
+ declspecs.) */
+extern xtensa_isa xtensa_default_isa;
+
+
+/* Deallocate an xtensa_isa structure. */
+extern void xtensa_isa_free (xtensa_isa);
+
+/* Get the maximum instruction size in bytes. */
+extern int xtensa_insn_maxlength (xtensa_isa);
+
+/* Get the total number of opcodes for this processor. */
+extern int xtensa_num_opcodes (xtensa_isa);
+
+/* Translate a mnemonic name to an opcode. Returns XTENSA_UNDEFINED if
+ the name is not a valid opcode mnemonic. */
+extern xtensa_opcode xtensa_opcode_lookup (xtensa_isa, const char *);
+
+/* Decode a binary instruction buffer. Returns the opcode or
+ XTENSA_UNDEFINED if the instruction is illegal. */
+extern xtensa_opcode xtensa_decode_insn (xtensa_isa, const xtensa_insnbuf);
+
+
+/* Opcode information. */
+
+/* Set the opcode field(s) in a binary instruction buffer. The operand
+ fields are set to zero. */
+extern void xtensa_encode_insn (xtensa_isa, xtensa_opcode, xtensa_insnbuf);
+
+/* Get the mnemonic name for an opcode. */
+extern const char * xtensa_opcode_name (xtensa_isa, xtensa_opcode);
+
+/* Find the length (in bytes) of an instruction. */
+extern int xtensa_insn_length (xtensa_isa, xtensa_opcode);
+
+/* Find the length of an instruction by looking only at the first byte. */
+extern int xtensa_insn_length_from_first_byte (xtensa_isa, char);
+
+/* Find the number of operands for an instruction. */
+extern int xtensa_num_operands (xtensa_isa, xtensa_opcode);
+
+/* Get the information about operand number "opnd" of a particular opcode. */
+extern xtensa_operand xtensa_get_operand (xtensa_isa, xtensa_opcode, int);
+
+/* Operand information. */
+
+/* Find the kind of operand. There are three possibilities:
+ 1) PC-relative immediates (e.g., "l", "L"). These can be identified with
+ the xtensa_operand_isPCRelative function.
+ 2) non-PC-relative immediates ("i").
+ 3) register-file short names (e.g., "a", "b", "m" and others defined
+ via TIE). */
+extern char * xtensa_operand_kind (xtensa_operand);
+
+/* Check if an operand is an input ('<'), output ('>'), or inout ('=')
+ operand. Note: The output operand of a conditional assignment
+ (e.g., movnez) appears here as an inout ('=') even if it is declared
+ in the TIE code as an output ('>'); this allows the compiler to
+ properly handle register allocation for conditional assignments. */
+extern char xtensa_operand_inout (xtensa_operand);
+
+/* Get and set the raw (encoded) value of the field for the specified
+ operand. The "set" function does not check if the value fits in the
+ field; that is done by the "encode" function below. */
+extern uint32 xtensa_operand_get_field (xtensa_operand, const xtensa_insnbuf);
+
+extern void xtensa_operand_set_field (xtensa_operand, xtensa_insnbuf, uint32);
+
+
+/* Encode and decode operands. The raw bits in the operand field
+ may be encoded in a variety of different ways. These functions hide the
+ details of that encoding. The encode function has a special return type
+ (xtensa_encode_result) to indicate success or the reason for failure; the
+ encoded value is returned through the argument pointer. The decode function
+ has no possibility of failure and returns the decoded value. */
+
+typedef enum
+{
+ xtensa_encode_result_ok,
+ xtensa_encode_result_align,
+ xtensa_encode_result_not_in_table,
+ xtensa_encode_result_too_low,
+ xtensa_encode_result_too_high,
+ xtensa_encode_result_not_ok,
+ xtensa_encode_result_max = xtensa_encode_result_not_ok
+} xtensa_encode_result;
+
+extern xtensa_encode_result xtensa_operand_encode (xtensa_operand, uint32 *);
+
+extern uint32 xtensa_operand_decode (xtensa_operand, uint32);
+
+
+/* For PC-relative offset operands, the interpretation of the offset may vary
+ between opcodes, e.g., is it relative to the current PC or that of the next
+ instruction? The following functions are defined to perform PC-relative
+ relocations and to undo them (as in the disassembler). The first function
+ takes the desired address and the PC of the current instruction and returns
+ the unencoded value to be stored in the offset field. The second function
+ takes the unencoded offset value and the current PC and returns the address.
+ Note that these functions do not replace the encode/decode functions; the
+ operands must be encoded/decoded separately. */
+
+extern int xtensa_operand_isPCRelative (xtensa_operand);
+
+extern uint32 xtensa_operand_do_reloc (xtensa_operand, uint32, uint32);
+
+extern uint32 xtensa_operand_undo_reloc (xtensa_operand, uint32, uint32);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* XTENSA_LIBISA_H */
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index b133896..f58e425 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * arm-dis.c: Remove presence of (r) and (tm) symbols.
+ * arm-opc.h: Remove presence of (r) and (tm) symbols.
+
2003-03-25 Stan Cox <scox@redhat.com>
Nick Clifton <nickc@redhat.com>
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index d3ecd6f..df20832 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -160,6 +160,7 @@ CFILES = \
xstormy16-dis.c \
xstormy16-ibld.c \
xstormy16-opc.c \
+ xtensa-dis.c \
z8k-dis.c \
z8kgen.c
@@ -270,6 +271,7 @@ ALL_MACHINES = \
xstormy16-dis.lo \
xstormy16-ibld.lo \
xstormy16-opc.lo \
+ xtensa-dis.lo \
z8k-dis.lo
OFILES = @BFD_MACHINES@
@@ -817,6 +819,9 @@ xstormy16-ibld.lo: xstormy16-ibld.c sysdep.h config.h \
xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \
$(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \
$(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h
+xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \
+ $(BFD_H) $(INCDIR)/symcat.h
z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h
z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 4939324..0220191 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -271,6 +271,7 @@ CFILES = \
xstormy16-dis.c \
xstormy16-ibld.c \
xstormy16-opc.c \
+ xtensa-dis.c \
z8k-dis.c \
z8kgen.c
@@ -382,6 +383,7 @@ ALL_MACHINES = \
xstormy16-dis.lo \
xstormy16-ibld.lo \
xstormy16-opc.lo \
+ xtensa-dis.lo \
z8k-dis.lo
@@ -465,7 +467,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES)
OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS)
@@ -1313,6 +1315,9 @@ xstormy16-ibld.lo: xstormy16-ibld.c sysdep.h config.h \
xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \
$(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \
$(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h
+xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \
+ $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \
+ $(BFD_H) $(INCDIR)/symcat.h
z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h
z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 8fb9702..2c9e385 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -71,9 +71,9 @@ static arm_regname regnames[] =
{ "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "IP", "SP", "LR", "PC" }},
{ "special-atpcs", "Select special register names used in the ATPCS",
{ "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL", "FP", "IP", "SP", "LR", "PC" }},
- { "iwmmxt_regnames", "Select register names used on the Intel(r) Wireless MMX(tm) technology coprocessor",
+ { "iwmmxt_regnames", "Select register names used on the Intel Wireless MMX technology coprocessor",
{ "wr0", "wr1", "wr2", "wr3", "wr4", "wr5", "wr6", "wr7", "wr8", "wr9", "wr10", "wr11", "wr12", "wr13", "wr14", "wr15"}},
- { "iwmmxt_Cregnames", "Select control register names used on the Intel(r) Wireless MMX(tm) technology coprocessor",
+ { "iwmmxt_Cregnames", "Select control register names used on the Intel Wireless MMX technology coprocessor",
{"wcid", "wcon", "wcssf", "wcasf", "reserved", "reserved", "reserved", "reserved", "wcgr0", "wcgr1", "wcgr2", "wcgr3", "reserved", "reserved", "reserved", "reserved"}}
};
diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h
index 233a830..22313cb 100644
--- a/opcodes/arm-opc.h
+++ b/opcodes/arm-opc.h
@@ -108,7 +108,7 @@ static const struct arm_opcode arm_opcodes[] =
{0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"},
{0xf450f000, 0xfc70f000, "pld\t%a"},
- /* Intel(r) Wireless MMX(tm) technology instructions. */
+ /* Intel Wireless MMX technology instructions. */
#define FIRST_IWMMXT_INSN 0x0e130130
#define IWMMXT_INSN_COUNT 47
{0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"},
diff --git a/opcodes/configure b/opcodes/configure
index 171fadd..be6e1b8 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -57,6 +57,7 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
+sitefile=
srcdir=
target=NONE
verbose=
@@ -171,6 +172,7 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
+ --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -341,6 +343,11 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
+ -site-file | --site-file | --site-fil | --site-fi | --site-f)
+ ac_prev=sitefile ;;
+ -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
+ sitefile="$ac_optarg" ;;
+
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -506,12 +513,16 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+if test -z "$sitefile"; then
+ if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
+else
+ CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -550,12 +561,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:554: checking for Cygwin environment" >&5
+echo "configure:565: 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 559 "configure"
+#line 570 "configure"
#include "confdefs.h"
int main() {
@@ -566,7 +577,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -583,19 +594,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:587: checking for mingw32 environment" >&5
+echo "configure:598: 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 592 "configure"
+#line 603 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -660,7 +671,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:664: checking host system type" >&5
+echo "configure:675: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -681,7 +692,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:685: checking target system type" >&5
+echo "configure:696: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -699,7 +710,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:703: checking build system type" >&5
+echo "configure:714: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -724,7 +735,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:728: checking for $ac_word" >&5
+echo "configure:739: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -754,7 +765,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:758: checking for $ac_word" >&5
+echo "configure:769: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -805,7 +816,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:809: checking for $ac_word" >&5
+echo "configure:820: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -837,7 +848,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -848,12 +859,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 852 "configure"
+#line 863 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -879,12 +890,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:888: checking whether we are using GNU C" >&5
+echo "configure:899: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -893,7 +904,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -912,7 +923,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:916: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:927: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -944,7 +955,7 @@ else
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:948: checking for POSIXized ISC" >&5
+echo "configure:959: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -982,7 +993,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${
# 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:986: checking for a BSD compatible install" >&5
+echo "configure:997: 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
@@ -1035,7 +1046,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1039: checking whether build environment is sane" >&5
+echo "configure:1050: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1092,7 +1103,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1096: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1107: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1138,7 +1149,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1142: checking for working aclocal" >&5
+echo "configure:1153: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1151,7 +1162,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1155: checking for working autoconf" >&5
+echo "configure:1166: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1164,7 +1175,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1168: checking for working automake" >&5
+echo "configure:1179: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1177,7 +1188,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1181: checking for working autoheader" >&5
+echo "configure:1192: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1190,7 +1201,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1194: checking for working makeinfo" >&5
+echo "configure:1205: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1213,7 +1224,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1217: checking for $ac_word" >&5
+echo "configure:1228: 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
@@ -1245,7 +1256,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1249: checking for $ac_word" >&5
+echo "configure:1260: 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
@@ -1277,7 +1288,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1281: checking for $ac_word" >&5
+echo "configure:1292: 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
@@ -1392,7 +1403,7 @@ ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1396: checking for ld used by GCC" >&5
+echo "configure:1407: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1422,10 +1433,10 @@ echo "configure:1396: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1426: checking for GNU ld" >&5
+echo "configure:1437: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1429: checking for non-GNU ld" >&5
+echo "configure:1440: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1460,7 +1471,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1464: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1475: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1477,7 +1488,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1481: checking for $LD option to reload object files" >&5
+echo "configure:1492: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1489,7 +1500,7 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1493: checking for BSD-compatible nm" >&5
+echo "configure:1504: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1527,7 +1538,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1531: checking whether ln -s works" >&5
+echo "configure:1542: 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
@@ -1548,7 +1559,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1552: checking how to recognise dependant libraries" >&5
+echo "configure:1563: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1721,13 +1732,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1725: checking for object suffix" >&5
+echo "configure:1736: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1742: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1747,7 +1758,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1751: checking for executable suffix" >&5
+echo "configure:1762: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1757,10 +1768,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj) ;;
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1784,7 +1795,7 @@ case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1788: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1799: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1846,7 +1857,7 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1850: checking for file" >&5
+echo "configure:1861: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1917,7 +1928,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1921: checking for $ac_word" >&5
+echo "configure:1932: 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
@@ -1949,7 +1960,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1953: checking for $ac_word" >&5
+echo "configure:1964: 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
@@ -1984,7 +1995,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1988: checking for $ac_word" >&5
+echo "configure:1999: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2016,7 +2027,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2020: checking for $ac_word" >&5
+echo "configure:2031: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2083,8 +2094,21 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2087 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2098 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
@@ -2096,6 +2120,7 @@ case $host in
LD="${LD-ld} -64"
;;
esac
+ fi
fi
rm -rf conftest*
;;
@@ -2103,7 +2128,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2121,7 +2146,7 @@ ia64-*-hpux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2125: checking whether the C compiler needs -belf" >&5
+echo "configure:2150: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2134,14 +2159,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2138 "configure"
+#line 2163 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2309,7 +2334,7 @@ if test -z "$target" ; then
fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2313: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2338: 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"
@@ -2332,7 +2357,7 @@ fi
echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6
-echo "configure:2336: checking whether to install libbfd" >&5
+echo "configure:2361: checking whether to install libbfd" >&5
# Check whether --enable-install-libbfd or --disable-install-libbfd was given.
if test "${enable_install_libbfd+set}" = set; then
enableval="$enable_install_libbfd"
@@ -2369,7 +2394,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2373: checking for executable suffix" >&5
+echo "configure:2398: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2379,10 +2404,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj) ;;
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -2405,7 +2430,7 @@ ac_exeext=$EXEEXT
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2409: checking for $ac_word" >&5
+echo "configure:2434: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2435,7 +2460,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2439: checking for $ac_word" >&5
+echo "configure:2464: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2486,7 +2511,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2490: checking for $ac_word" >&5
+echo "configure:2515: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2518,7 +2543,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2522: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2547: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2529,12 +2554,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2533 "configure"
+#line 2558 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -2560,12 +2585,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2564: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2589: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2569: checking whether we are using GNU C" >&5
+echo "configure:2594: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2574,7 +2599,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2603: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -2593,7 +2618,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2597: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2622: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2627,7 +2652,7 @@ fi
ALL_LINGUAS="fr sv tr es da de id pt_BR"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2631: checking how to run the C preprocessor" >&5
+echo "configure:2656: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2642,13 +2667,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2646 "configure"
+#line 2671 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2677: \"$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
:
@@ -2659,13 +2684,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2663 "configure"
+#line 2688 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2694: \"$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
:
@@ -2676,13 +2701,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2680 "configure"
+#line 2705 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2711: \"$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
:
@@ -2709,7 +2734,7 @@ echo "$ac_t""$CPP" 1>&6
# 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:2713: checking for $ac_word" >&5
+echo "configure:2738: 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
@@ -2737,12 +2762,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2741: checking for ANSI C header files" >&5
+echo "configure:2766: 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 2746 "configure"
+#line 2771 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2750,7 +2775,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2779: \"$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*
@@ -2767,7 +2792,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 2771 "configure"
+#line 2796 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2785,7 +2810,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 2789 "configure"
+#line 2814 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2806,7 +2831,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2810 "configure"
+#line 2835 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2817,7 +2842,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2841,12 +2866,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2845: checking for working const" >&5
+echo "configure:2870: 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 2850 "configure"
+#line 2875 "configure"
#include "confdefs.h"
int main() {
@@ -2895,7 +2920,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2916,21 +2941,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2920: checking for inline" >&5
+echo "configure:2945: 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 2927 "configure"
+#line 2952 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2956,12 +2981,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2960: checking for off_t" >&5
+echo "configure:2985: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2965 "configure"
+#line 2990 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2989,12 +3014,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2993: checking for size_t" >&5
+echo "configure:3018: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2998 "configure"
+#line 3023 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -3024,19 +3049,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:3028: checking for working alloca.h" >&5
+echo "configure:3053: 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 3033 "configure"
+#line 3058 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3065: \"$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
@@ -3057,12 +3082,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3061: checking for alloca" >&5
+echo "configure:3086: 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 3066 "configure"
+#line 3091 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3090,7 +3115,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3119: \"$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
@@ -3122,12 +3147,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3126: checking whether alloca needs Cray hooks" >&5
+echo "configure:3151: 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 3131 "configure"
+#line 3156 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3152,12 +3177,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:3156: checking for $ac_func" >&5
+echo "configure:3181: 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 3161 "configure"
+#line 3186 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3180,7 +3205,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3209: \"$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
@@ -3207,7 +3232,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3211: checking stack direction for C alloca" >&5
+echo "configure:3236: 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
@@ -3215,7 +3240,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3219 "configure"
+#line 3244 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3234,7 +3259,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3263: \"$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
@@ -3255,21 +3280,21 @@ EOF
fi
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
+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:3263: checking for $ac_hdr" >&5
+echo "configure:3288: 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 3268 "configure"
+#line 3293 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3298,12 +3323,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3302: checking for $ac_func" >&5
+echo "configure:3327: 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 3307 "configure"
+#line 3332 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3326,7 +3351,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3330: \"$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*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3351,7 +3376,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3355: checking for working mmap" >&5
+echo "configure:3380: 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
@@ -3359,7 +3384,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3363 "configure"
+#line 3388 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3387,24 +3412,11 @@ else
#include <fcntl.h>
#include <sys/mman.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
/* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
/* Assume that all systems that can run configure have sys/param.h. */
# ifndef HAVE_SYS_PARAM_H
@@ -3512,7 +3524,7 @@ main()
}
EOF
-if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3528: \"$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
@@ -3540,17 +3552,17 @@ unistd.h values.h sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3544: checking for $ac_hdr" >&5
+echo "configure:3556: 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 3549 "configure"
+#line 3561 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3566: \"$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*
@@ -3580,12 +3592,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3584: checking for $ac_func" >&5
+echo "configure:3596: 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 3589 "configure"
+#line 3601 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3608,7 +3620,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3624: \"$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
@@ -3637,12 +3649,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3641: checking for $ac_func" >&5
+echo "configure:3653: 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 3646 "configure"
+#line 3658 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3665,7 +3677,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3681: \"$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
@@ -3699,19 +3711,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3703: checking for LC_MESSAGES" >&5
+echo "configure:3715: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3708 "configure"
+#line 3720 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -3732,7 +3744,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3736: checking whether NLS is requested" >&5
+echo "configure:3748: checking whether NLS is requested" >&5
# Check whether --enable-nls or --disable-nls was given.
if test "${enable_nls+set}" = set; then
enableval="$enable_nls"
@@ -3752,7 +3764,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3756: checking whether included gettext is requested" >&5
+echo "configure:3768: checking whether included gettext is requested" >&5
# Check whether --with-included-gettext or --without-included-gettext was given.
if test "${with_included_gettext+set}" = set; then
withval="$with_included_gettext"
@@ -3771,17 +3783,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3775: checking for libintl.h" >&5
+echo "configure:3787: checking for libintl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3780 "configure"
+#line 3792 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3797: \"$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*
@@ -3798,19 +3810,19 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:3802: checking for gettext in libc" >&5
+echo "configure:3814: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3807 "configure"
+#line 3819 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libc=yes
else
@@ -3826,7 +3838,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3830: checking for bindtextdomain in -lintl" >&5
+echo "configure:3842: checking for bindtextdomain in -lintl" >&5
ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3834,7 +3846,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3838 "configure"
+#line 3850 "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
@@ -3845,7 +3857,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3861: \"$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
@@ -3861,19 +3873,19 @@ fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:3865: checking for gettext in libintl" >&5
+echo "configure:3877: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3870 "configure"
+#line 3882 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libintl=yes
else
@@ -3901,7 +3913,7 @@ EOF
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3905: checking for $ac_word" >&5
+echo "configure:3917: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3935,12 +3947,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3939: checking for $ac_func" >&5
+echo "configure:3951: 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 3944 "configure"
+#line 3956 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3963,7 +3975,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3979: \"$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
@@ -3990,7 +4002,7 @@ done
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3994: checking for $ac_word" >&5
+echo "configure:4006: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4026,7 +4038,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4030: checking for $ac_word" >&5
+echo "configure:4042: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4058,7 +4070,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4062 "configure"
+#line 4074 "configure"
#include "confdefs.h"
int main() {
@@ -4066,7 +4078,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4098,7 +4110,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4102: checking for $ac_word" >&5
+echo "configure:4114: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4132,7 +4144,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4136: checking for $ac_word" >&5
+echo "configure:4148: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4168,7 +4180,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4172: checking for $ac_word" >&5
+echo "configure:4184: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4258,7 +4270,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4262: checking for catalogs to be installed" >&5
+echo "configure:4274: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4286,17 +4298,17 @@ echo "configure:4262: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4290: checking for linux/version.h" >&5
+echo "configure:4302: checking for linux/version.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4295 "configure"
+#line 4307 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4312: \"$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*
@@ -4374,7 +4386,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4378: checking for build system executable suffix" >&5
+echo "configure:4390: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4411,7 +4423,7 @@ fi
# 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:4415: checking for a BSD compatible install" >&5
+echo "configure:4427: 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
@@ -4468,17 +4480,17 @@ for ac_hdr in string.h strings.h stdlib.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4472: checking for $ac_hdr" >&5
+echo "configure:4484: 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 4477 "configure"
+#line 4489 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4494: \"$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*
@@ -4666,6 +4678,7 @@ if test x${all_targets} = xfalse ; then
bfd_w65_arch) ta="$ta w65-dis.lo" ;;
bfd_we32k_arch) ;;
bfd_xstormy16_arch) ta="$ta xstormy16-asm.lo xstormy16-desc.lo xstormy16-dis.lo xstormy16-ibld.lo xstormy16-opc.lo" using_cgen=yes ;;
+ bfd_xtensa_arch) ta="$ta xtensa-dis.lo" ;;
bfd_z8k_arch) ta="$ta z8k-dis.lo" ;;
bfd_frv_arch) ta="$ta frv-asm.lo frv-desc.lo frv-dis.lo frv-ibld.lo frv-opc.lo" using_cgen=yes ;;
diff --git a/opcodes/configure.in b/opcodes/configure.in
index 6e74b15..e4014f1 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -241,6 +241,7 @@ if test x${all_targets} = xfalse ; then
bfd_w65_arch) ta="$ta w65-dis.lo" ;;
bfd_we32k_arch) ;;
bfd_xstormy16_arch) ta="$ta xstormy16-asm.lo xstormy16-desc.lo xstormy16-dis.lo xstormy16-ibld.lo xstormy16-opc.lo" using_cgen=yes ;;
+ bfd_xtensa_arch) ta="$ta xtensa-dis.lo" ;;
bfd_z8k_arch) ta="$ta z8k-dis.lo" ;;
bfd_frv_arch) ta="$ta frv-asm.lo frv-desc.lo frv-dis.lo frv-ibld.lo frv-opc.lo" using_cgen=yes ;;
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 7e6ba0b..1408f39 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -68,6 +68,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARCH_vax
#define ARCH_w65
#define ARCH_xstormy16
+#define ARCH_xtensa
#define ARCH_z8k
#define ARCH_frv
#define ARCH_iq2000
@@ -343,6 +344,11 @@ disassembler (abfd)
disassemble = print_insn_xstormy16;
break;
#endif
+#ifdef ARCH_xtensa
+ case bfd_arch_xtensa:
+ disassemble = print_insn_xtensa;
+ break;
+#endif
#ifdef ARCH_z8k
case bfd_arch_z8k:
if (bfd_get_mach(abfd) == bfd_mach_z8001)
diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c
new file mode 100644
index 0000000..bf5f5bf
--- /dev/null
+++ b/opcodes/xtensa-dis.c
@@ -0,0 +1,526 @@
+/* xtensa-dis.c. Disassembly functions for Xtensa.
+ Copyright 2003 Free Software Foundation, Inc.
+ Contributed by Bob Wilson at Tensilica, Inc. (bwilson@tensilica.com)
+
+ This file is part of GDB, GAS, and the GNU binutils.
+
+ GDB, GAS, and the GNU binutils are free software; you can redistribute
+ them and/or modify them 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.
+
+ GDB, GAS, and the GNU binutils are distributed in the hope that they
+ 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 file; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#include "xtensa-isa.h"
+#include "ansidecl.h"
+#include "sysdep.h"
+#include "dis-asm.h"
+
+#include <setjmp.h>
+
+#ifndef MAX
+#define MAX(a,b) (a > b ? a : b)
+#endif
+
+static char* state_names[256] =
+{
+ "lbeg", /* 0 */
+ "lend", /* 1 */
+ "lcount", /* 2 */
+ "sar", /* 3 */
+ "br", /* 4 */
+
+ "reserved_5", /* 5 */
+ "reserved_6", /* 6 */
+ "reserved_7", /* 7 */
+
+ "av", /* 8 */
+ "avh", /* 9 */
+ "bv", /* 10 */
+ "sav", /* 11 */
+ "scompare1", /* 12 */
+
+ "reserved_13", /* 13 */
+ "reserved_14", /* 14 */
+ "reserved_15", /* 15 */
+
+ "acclo", /* 16 */
+ "acchi", /* 17 */
+
+ "reserved_18", /* 18 */
+ "reserved_19", /* 19 */
+ "reserved_20", /* 20 */
+ "reserved_21", /* 21 */
+ "reserved_22", /* 22 */
+ "reserved_23", /* 23 */
+ "reserved_24", /* 24 */
+ "reserved_25", /* 25 */
+ "reserved_26", /* 26 */
+ "reserved_27", /* 27 */
+ "reserved_28", /* 28 */
+ "reserved_29", /* 29 */
+ "reserved_30", /* 30 */
+ "reserved_31", /* 31 */
+
+ "mr0", /* 32 */
+ "mr1", /* 33 */
+ "mr2", /* 34 */
+ "mr3", /* 35 */
+
+ "reserved_36", /* 36 */
+ "reserved_37", /* 37 */
+ "reserved_38", /* 38 */
+ "reserved_39", /* 39 */
+ "reserved_40", /* 40 */
+ "reserved_41", /* 41 */
+ "reserved_42", /* 42 */
+ "reserved_43", /* 43 */
+ "reserved_44", /* 44 */
+ "reserved_45", /* 45 */
+ "reserved_46", /* 46 */
+ "reserved_47", /* 47 */
+ "reserved_48", /* 48 */
+ "reserved_49", /* 49 */
+ "reserved_50", /* 50 */
+ "reserved_51", /* 51 */
+ "reserved_52", /* 52 */
+ "reserved_53", /* 53 */
+ "reserved_54", /* 54 */
+ "reserved_55", /* 55 */
+ "reserved_56", /* 56 */
+ "reserved_57", /* 57 */
+ "reserved_58", /* 58 */
+ "reserved_59", /* 59 */
+ "reserved_60", /* 60 */
+ "reserved_61", /* 61 */
+ "reserved_62", /* 62 */
+ "reserved_63", /* 63 */
+
+ "reserved_64", /* 64 */
+ "reserved_65", /* 65 */
+ "reserved_66", /* 66 */
+ "reserved_67", /* 67 */
+ "reserved_68", /* 68 */
+ "reserved_69", /* 69 */
+ "reserved_70", /* 70 */
+ "reserved_71", /* 71 */
+
+ "wb", /* 72 */
+ "ws", /* 73 */
+
+ "reserved_74", /* 74 */
+ "reserved_75", /* 75 */
+ "reserved_76", /* 76 */
+ "reserved_77", /* 77 */
+ "reserved_78", /* 78 */
+ "reserved_79", /* 79 */
+ "reserved_80", /* 80 */
+ "reserved_81", /* 81 */
+ "reserved_82", /* 82 */
+
+ "ptevaddr", /* 83 */
+
+ "reserved_84", /* 84 */
+ "reserved_85", /* 85 */
+ "reserved_86", /* 86 */
+ "reserved_87", /* 87 */
+ "reserved_88", /* 88 */
+ "reserved_89", /* 89 */
+
+ "rasid", /* 90 */
+ "itlbcfg", /* 91 */
+ "dtlbcfg", /* 92 */
+
+ "reserved_93", /* 93 */
+ "reserved_94", /* 94 */
+ "reserved_95", /* 95 */
+
+ "ibreakenable", /* 96 */
+
+ "reserved_97", /* 97 */
+
+ "cacheattr", /* 98 */
+
+ "reserved_99", /* 99 */
+ "reserved_100", /* 100 */
+ "reserved_101", /* 101 */
+ "reserved_102", /* 102 */
+ "reserved_103", /* 103 */
+
+ "ddr", /* 104 */
+
+ "reserved_105", /* 105 */
+ "reserved_106", /* 106 */
+ "reserved_107", /* 107 */
+ "reserved_108", /* 108 */
+ "reserved_109", /* 109 */
+ "reserved_110", /* 110 */
+ "reserved_111", /* 111 */
+ "reserved_112", /* 112 */
+ "reserved_113", /* 113 */
+ "reserved_114", /* 114 */
+ "reserved_115", /* 115 */
+ "reserved_116", /* 116 */
+ "reserved_117", /* 117 */
+ "reserved_118", /* 118 */
+ "reserved_119", /* 119 */
+ "reserved_120", /* 120 */
+ "reserved_121", /* 121 */
+ "reserved_122", /* 122 */
+ "reserved_123", /* 123 */
+ "reserved_124", /* 124 */
+ "reserved_125", /* 125 */
+ "reserved_126", /* 126 */
+ "reserved_127", /* 127 */
+
+ "ibreaka0", /* 128 */
+ "ibreaka1", /* 129 */
+ "ibreaka2", /* 130 */
+ "ibreaka3", /* 131 */
+ "ibreaka4", /* 132 */
+ "ibreaka5", /* 133 */
+ "ibreaka6", /* 134 */
+ "ibreaka7", /* 135 */
+ "ibreaka8", /* 136 */
+ "ibreaka9", /* 137 */
+ "ibreaka10", /* 138 */
+ "ibreaka11", /* 139 */
+ "ibreaka12", /* 140 */
+ "ibreaka13", /* 141 */
+ "ibreaka14", /* 142 */
+ "ibreaka15", /* 143 */
+
+ "dbreaka0", /* 144 */
+ "dbreaka1", /* 145 */
+ "dbreaka2", /* 146 */
+ "dbreaka3", /* 147 */
+ "dbreaka4", /* 148 */
+ "dbreaka5", /* 149 */
+ "dbreaka6", /* 150 */
+ "dbreaka7", /* 151 */
+ "dbreaka8", /* 152 */
+ "dbreaka9", /* 153 */
+ "dbreaka10", /* 154 */
+ "dbreaka11", /* 155 */
+ "dbreaka12", /* 156 */
+ "dbreaka13", /* 157 */
+ "dbreaka14", /* 158 */
+ "dbreaka15", /* 159 */
+
+ "dbreakc0", /* 160 */
+ "dbreakc1", /* 161 */
+ "dbreakc2", /* 162 */
+ "dbreakc3", /* 163 */
+ "dbreakc4", /* 164 */
+ "dbreakc5", /* 165 */
+ "dbreakc6", /* 166 */
+ "dbreakc7", /* 167 */
+ "dbreakc8", /* 168 */
+ "dbreakc9", /* 169 */
+ "dbreakc10", /* 170 */
+ "dbreakc11", /* 171 */
+ "dbreakc12", /* 172 */
+ "dbreakc13", /* 173 */
+ "dbreakc14", /* 174 */
+ "dbreakc15", /* 175 */
+
+ "reserved_176", /* 176 */
+
+ "epc1", /* 177 */
+ "epc2", /* 178 */
+ "epc3", /* 179 */
+ "epc4", /* 180 */
+ "epc5", /* 181 */
+ "epc6", /* 182 */
+ "epc7", /* 183 */
+ "epc8", /* 184 */
+ "epc9", /* 185 */
+ "epc10", /* 186 */
+ "epc11", /* 187 */
+ "epc12", /* 188 */
+ "epc13", /* 189 */
+ "epc14", /* 190 */
+ "epc15", /* 191 */
+ "depc", /* 192 */
+
+ "reserved_193", /* 193 */
+
+ "eps2", /* 194 */
+ "eps3", /* 195 */
+ "eps4", /* 196 */
+ "eps5", /* 197 */
+ "eps6", /* 198 */
+ "eps7", /* 199 */
+ "eps8", /* 200 */
+ "eps9", /* 201 */
+ "eps10", /* 202 */
+ "eps11", /* 203 */
+ "eps12", /* 204 */
+ "eps13", /* 205 */
+ "eps14", /* 206 */
+ "eps15", /* 207 */
+
+ "reserved_208", /* 208 */
+
+ "excsave1", /* 209 */
+ "excsave2", /* 210 */
+ "excsave3", /* 211 */
+ "excsave4", /* 212 */
+ "excsave5", /* 213 */
+ "excsave6", /* 214 */
+ "excsave7", /* 215 */
+ "excsave8", /* 216 */
+ "excsave9", /* 217 */
+ "excsave10", /* 218 */
+ "excsave11", /* 219 */
+ "excsave12", /* 220 */
+ "excsave13", /* 221 */
+ "excsave14", /* 222 */
+ "excsave15", /* 223 */
+ "cpenable", /* 224 */
+
+ "reserved_225", /* 225 */
+
+ "interrupt", /* 226 */
+ "interrupt2", /* 227 */
+ "intenable", /* 228 */
+
+ "reserved_229", /* 229 */
+
+ "ps", /* 230 */
+
+ "reserved_231", /* 231 */
+
+ "exccause", /* 232 */
+ "debugcause", /* 233 */
+ "ccount", /* 234 */
+ "prid", /* 235 */
+ "icount", /* 236 */
+ "icountlvl", /* 237 */
+ "excvaddr", /* 238 */
+
+ "reserved_239", /* 239 */
+
+ "ccompare0", /* 240 */
+ "ccompare1", /* 241 */
+ "ccompare2", /* 242 */
+ "ccompare3", /* 243 */
+
+ "misc0", /* 244 */
+ "misc1", /* 245 */
+ "misc2", /* 246 */
+ "misc3", /* 247 */
+
+ "reserved_248", /* 248 */
+ "reserved_249", /* 249 */
+ "reserved_250", /* 250 */
+ "reserved_251", /* 251 */
+ "reserved_252", /* 252 */
+ "reserved_253", /* 253 */
+ "reserved_254", /* 254 */
+ "reserved_255", /* 255 */
+};
+
+
+int show_raw_fields;
+
+static int fetch_data
+ PARAMS ((struct disassemble_info *info, bfd_vma memaddr, int numBytes));
+static void print_xtensa_operand
+ PARAMS ((bfd_vma, struct disassemble_info *, xtensa_operand,
+ unsigned operand_val, int print_sr_name));
+
+struct dis_private {
+ bfd_byte *byte_buf;
+ jmp_buf bailout;
+};
+
+static int
+fetch_data (info, memaddr, numBytes)
+ struct disassemble_info *info;
+ bfd_vma memaddr;
+ int numBytes;
+{
+ int length, status = 0;
+ struct dis_private *priv = (struct dis_private *) info->private_data;
+ int insn_size = (numBytes != 0 ? numBytes :
+ xtensa_insn_maxlength (xtensa_default_isa));
+
+ /* Read the maximum instruction size, padding with zeros if we go past
+ the end of the text section. This code will automatically adjust
+ length when we hit the end of the buffer. */
+
+ memset (priv->byte_buf, 0, insn_size);
+ for (length = insn_size; length > 0; length--)
+ {
+ status = (*info->read_memory_func) (memaddr, priv->byte_buf, length,
+ info);
+ if (status == 0)
+ return length;
+ }
+ (*info->memory_error_func) (status, memaddr, info);
+ longjmp (priv->bailout, 1);
+ /*NOTREACHED*/
+}
+
+
+static void
+print_xtensa_operand (memaddr, info, opnd, operand_val, print_sr_name)
+ bfd_vma memaddr;
+ struct disassemble_info *info;
+ xtensa_operand opnd;
+ unsigned operand_val;
+ int print_sr_name;
+{
+ char *kind = xtensa_operand_kind (opnd);
+ int signed_operand_val;
+
+ if (show_raw_fields)
+ {
+ if (operand_val < 0xa)
+ (*info->fprintf_func) (info->stream, "%u", operand_val);
+ else
+ (*info->fprintf_func) (info->stream, "0x%x", operand_val);
+ return;
+ }
+
+ operand_val = xtensa_operand_decode (opnd, operand_val);
+ signed_operand_val = (int) operand_val;
+
+ if (xtensa_operand_isPCRelative (opnd))
+ {
+ operand_val = xtensa_operand_undo_reloc (opnd, operand_val, memaddr);
+ info->target = operand_val;
+ (*info->print_address_func) (info->target, info);
+ }
+ else if (!strcmp (kind, "i"))
+ {
+ if (print_sr_name
+ && signed_operand_val >= 0
+ && signed_operand_val <= 255)
+ (*info->fprintf_func) (info->stream, "%s",
+ state_names[signed_operand_val]);
+ else if ((signed_operand_val > -256) && (signed_operand_val < 256))
+ (*info->fprintf_func) (info->stream, "%d", signed_operand_val);
+ else
+ (*info->fprintf_func) (info->stream, "0x%x",signed_operand_val);
+ }
+ else
+ (*info->fprintf_func) (info->stream, "%s%u", kind, operand_val);
+}
+
+
+/* Print the Xtensa instruction at address MEMADDR on info->stream.
+ Returns length of the instruction in bytes. */
+
+int
+print_insn_xtensa (memaddr, info)
+ bfd_vma memaddr;
+ struct disassemble_info *info;
+{
+ unsigned operand_val;
+ int bytes_fetched, size, maxsize, i, noperands;
+ xtensa_isa isa;
+ xtensa_opcode opc;
+ char *op_name;
+ int print_sr_name;
+ struct dis_private priv;
+ static bfd_byte *byte_buf = NULL;
+ static xtensa_insnbuf insn_buffer = NULL;
+
+ if (!xtensa_default_isa)
+ (void) xtensa_isa_init ();
+
+ info->target = 0;
+ maxsize = xtensa_insn_maxlength (xtensa_default_isa);
+
+ /* Set bytes_per_line to control the amount of whitespace between the hex
+ values and the opcode. For Xtensa, we always print one "chunk" and we
+ vary bytes_per_chunk to determine how many bytes to print. (objdump
+ would apparently prefer that we set bytes_per_chunk to 1 and vary
+ bytes_per_line but that makes it hard to fit 64-bit instructions on
+ an 80-column screen.) The value of bytes_per_line here is not exactly
+ right, because objdump adds an extra space for each chunk so that the
+ amount of whitespace depends on the chunk size. Oh well, it's good
+ enough.... Note that we set the minimum size to 4 to accomodate
+ literal pools. */
+ info->bytes_per_line = MAX (maxsize, 4);
+
+ /* Allocate buffers the first time through. */
+ if (!insn_buffer)
+ insn_buffer = xtensa_insnbuf_alloc (xtensa_default_isa);
+ if (!byte_buf)
+ byte_buf = (bfd_byte *) malloc (MAX (maxsize, 4));
+
+ priv.byte_buf = byte_buf;
+
+ info->private_data = (PTR) &priv;
+ if (setjmp (priv.bailout) != 0)
+ /* Error return. */
+ return -1;
+
+ /* Don't set "isa" before the setjmp to keep the compiler from griping. */
+ isa = xtensa_default_isa;
+
+ /* Fetch the maximum size instruction. */
+ bytes_fetched = fetch_data (info, memaddr, 0);
+
+ /* Copy the bytes into the decode buffer. */
+ memset (insn_buffer, 0, (xtensa_insnbuf_size (isa) *
+ sizeof (xtensa_insnbuf_word)));
+ xtensa_insnbuf_from_chars (isa, insn_buffer, priv.byte_buf);
+
+ opc = xtensa_decode_insn (isa, insn_buffer);
+ if (opc == XTENSA_UNDEFINED
+ || ((size = xtensa_insn_length (isa, opc)) > bytes_fetched))
+ {
+ (*info->fprintf_func) (info->stream, ".byte %#02x", priv.byte_buf[0]);
+ return 1;
+ }
+
+ op_name = (char *) xtensa_opcode_name (isa, opc);
+ (*info->fprintf_func) (info->stream, "%s", op_name);
+
+ print_sr_name = (!strcasecmp (op_name, "wsr")
+ || !strcasecmp (op_name, "xsr")
+ || !strcasecmp (op_name, "rsr"));
+
+ /* Print the operands (if any). */
+ noperands = xtensa_num_operands (isa, opc);
+ if (noperands > 0)
+ {
+ int first = 1;
+
+ (*info->fprintf_func) (info->stream, "\t");
+ for (i = 0; i < noperands; i++)
+ {
+ xtensa_operand opnd = xtensa_get_operand (isa, opc, i);
+
+ if (first)
+ first = 0;
+ else
+ (*info->fprintf_func) (info->stream, ", ");
+ operand_val = xtensa_operand_get_field (opnd, insn_buffer);
+ print_xtensa_operand (memaddr, info, opnd, operand_val,
+ print_sr_name);
+ }
+ }
+
+ info->bytes_per_chunk = size;
+ info->display_endian = info->endian;
+
+ return size;
+}
+
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index c6597de..03c923e 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,42 @@
+2003-03-30 Nick Clifton <nickc@redhat.com>
+
+ * configure.in (CON_FLAGS): Remove.
+ (COPRO): Unconditionally include iwmmxt.o.
+ * configure: Regenerate.
+ * Makefile.in (CON_FLAGS): Remove.
+ * armcopro.c: Remove use of __IWMMXT__ flag.
+ * wrapper.c: Likewise.
+ * armemu.c: Likewise.
+ Add explanatory comment for suppressed code.
+
+2003-03-27 Nick Clifton <nickc@redhat.com>
+
+ * armos.c (ARMul_OsHandleSWI): Catch SWIs for unhandled vectors.
+
+2003-03-27 Nick Clifton <nickc@redhat.com>
+
+ * configure.in: (CON_FLAGS): Define and intialise.
+ (COPRO): Add iwmmxt.o if configuring for XScale.
+ * configure: Regenerate.
+ * Makefile.in (iwmmxt.o): Add rule to build.
+ (COM_FLAGS): Define.
+ (ALL_FLAGS): Add CON_FLAGS.
+ * armcopro.c (ARMul_CoProInit): Initialise iWMMXt coprocessors.
+ * armdefs.h (struct ARMul_State): Add 'is_iWMMXt' field.
+ (ARM_iWMMXt_Prop): Define.
+ * armemu.c (ARMul_Emulate16): Intercept iWMMXt instructions and
+ pass to coprocessor.
+ * arminit.c (ARMul_NewState): Initialise 'is_iWMMXt'.
+ (ARMul_Abort): Catch branches through uninitialised vectors.
+ * armos.c (softevtorcode): Update comment.
+ (ARMul_OsInit): Use ARMUndefinedInstrV.
+ * wrapper.c (sim_create_inferior): Handle iWMMXt processor type.
+ (sim_store_register): Handle iWMMXt registers.
+ (sim_fetch_register): Handle iWMMXt registers.
+ * iwmmxt.h: New file. Exported iWMMXt coprocessor emulator
+ functions.
+ * iwmmxt.c: New file: iWMMXt emulator.
+
2003-03-20 Nick Clifton <nickc@redhat.com>
* Contribute support for Cirrus Maverick ARM co-processor,
diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in
index 017a983..7def0f9 100644
--- a/sim/arm/Makefile.in
+++ b/sim/arm/Makefile.in
@@ -32,6 +32,7 @@ armos.o: armos.c armdefs.h armos.h armfpe.h
armcopro.o: armcopro.c armdefs.h
maverick.o: maverick.c armdefs.h
+iwmmxt.o: iwmmxt.c iwmmxt.h armdefs.h
armemu26.o: armemu.c armdefs.h armemu.h
$(CC) -c $(srcdir)/armemu.c -o armemu26.o $(ALL_CFLAGS)
diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c
index b974789..aa75243 100644
--- a/sim/arm/armcopro.c
+++ b/sim/arm/armcopro.c
@@ -19,6 +19,7 @@
#include "armos.h"
#include "armemu.h"
#include "ansidecl.h"
+#include "iwmmxt.h"
/* Dummy Co-processors. */
@@ -1365,6 +1366,15 @@ ARMul_CoProInit (ARMul_State * state)
MMUMRC, MMUMCR, NULL, MMURead, MMUWrite);
}
+ if (state->is_iWMMXt)
+ {
+ ARMul_CoProAttach (state, 0, NULL, NULL, IwmmxtLDC, IwmmxtSTC,
+ NULL, NULL, IwmmxtCDP, NULL, NULL);
+
+ ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL,
+ IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL);
+ }
+
/* No handlers below here. */
/* Call all the initialisation routines. */
diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h
index 0f25222..a2ea405 100644
--- a/sim/arm/armdefs.h
+++ b/sim/arm/armdefs.h
@@ -135,6 +135,7 @@ struct ARMul_State
unsigned is_v5; /* Are we emulating a v5 architecture ? */
unsigned is_v5e; /* Are we emulating a v5e architecture ? */
unsigned is_XScale; /* Are we emulating an XScale architecture ? */
+ unsigned is_iWMMXt; /* Are we emulating an iWMMXt co-processor ? */
unsigned is_ep9312; /* Are we emulating a Cirrus Maverick co-processor ? */
unsigned verbose; /* Print various messages like the banner */
};
@@ -164,6 +165,7 @@ struct ARMul_State
#define ARM_v5e_Prop 0x100
#define ARM_XScale_Prop 0x200
#define ARM_ep9312_Prop 0x400
+#define ARM_iWMMXt_Prop 0x800
/***************************************************************************\
* Macros to extract instruction fields *
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index 44943c4..d12ad10 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -19,6 +19,7 @@
#include "armdefs.h"
#include "armemu.h"
#include "armos.h"
+#include "iwmmxt.h"
static ARMword GetDPRegRHS (ARMul_State *, ARMword);
static ARMword GetDPSRegRHS (ARMul_State *, ARMword);
@@ -374,12 +375,23 @@ ARMul_Emulate26 (ARMul_State * state)
if (state->EventSet)
ARMul_EnvokeEvent (state);
-#if 0
- /* Enable this for a helpful bit of debugging when tracing is needed. */
+#if 0 /* Enable this for a helpful bit of debugging when tracing is needed. */
fprintf (stderr, "pc: %x, instr: %x\n", pc & ~1, instr);
if (instr == 0)
abort ();
#endif
+#if 0 /* Enable this code to help track down stack alignment bugs. */
+ {
+ static ARMword old_sp = -1;
+
+ if (old_sp != state->Reg[13])
+ {
+ old_sp = state->Reg[13];
+ fprintf (stderr, "pc: %08x: SP set to %08x%s\n",
+ pc & ~1, old_sp, (old_sp % 8) ? " [UNALIGNED!]" : "");
+ }
+ }
+#endif
if (state->Exception)
{
@@ -492,6 +504,10 @@ ARMul_Emulate26 (ARMul_State * state)
else if ((instr & 0xFC70F000) == 0xF450F000)
/* The PLD instruction. Ignored. */
goto donext;
+ else if ( ((instr & 0xfe500f00) == 0xfc100100)
+ || ((instr & 0xfe500f00) == 0xfc000100))
+ /* wldrw and wstrw are unconditional. */
+ goto mainswitch;
else
/* UNDEFINED in v5, UNPREDICTABLE in v3, v4, non executed in v1, v2. */
ARMul_UndefInstr (state, instr);
@@ -689,6 +705,9 @@ check_PMUintr:
goto donext;
}
}
+
+ if (ARMul_HandleIwmmxt (state, instr))
+ goto donext;
}
switch ((int) BITS (20, 27))
diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c
index 0439990..4588787 100644
--- a/sim/arm/arminit.c
+++ b/sim/arm/arminit.c
@@ -17,6 +17,7 @@
#include "armdefs.h"
#include "armemu.h"
+#include "dbg_rdi.h"
/***************************************************************************\
* Definitions for the emulator architecture *
@@ -127,6 +128,7 @@ ARMul_NewState (void)
state->is_v5 = LOW;
state->is_v5e = LOW;
state->is_XScale = LOW;
+ state->is_iWMMXt = LOW;
ARMul_Reset (state);
@@ -157,6 +159,7 @@ ARMul_SelectProcessor (ARMul_State * state, unsigned properties)
state->is_v5 = (properties & ARM_v5_Prop) ? HIGH : LOW;
state->is_v5e = (properties & ARM_v5e_Prop) ? HIGH : LOW;
state->is_XScale = (properties & ARM_XScale_Prop) ? HIGH : LOW;
+ state->is_iWMMXt = (properties & ARM_iWMMXt_Prop) ? HIGH : LOW;
state->is_ep9312 = (properties & ARM_ep9312_Prop) ? HIGH : LOW;
/* Only initialse the coprocessor support once we
@@ -323,4 +326,24 @@ ARMul_Abort (ARMul_State * state, ARMword vector)
ARMul_SetR15 (state, vector);
else
ARMul_SetR15 (state, R15CCINTMODE | vector);
+
+ if (ARMul_ReadWord (state, ARMul_GetPC (state)) == 0)
+ {
+ /* No vector has been installed. Rather than simulating whatever
+ random bits might happen to be at address 0x20 onwards we elect
+ to stop. */
+ switch (vector)
+ {
+ case ARMul_ResetV: state->EndCondition = RDIError_Reset; break;
+ case ARMul_UndefinedInstrV: state->EndCondition = RDIError_UndefinedInstruction; break;
+ case ARMul_SWIV: state->EndCondition = RDIError_SoftwareInterrupt; break;
+ case ARMul_PrefetchAbortV: state->EndCondition = RDIError_PrefetchAbort; break;
+ case ARMul_DataAbortV: state->EndCondition = RDIError_DataAbort; break;
+ case ARMul_AddrExceptnV: state->EndCondition = RDIError_AddressException; break;
+ case ARMul_IRQV: state->EndCondition = RDIError_IRQ; break;
+ case ARMul_FIQV: state->EndCondition = RDIError_FIQ; break;
+ default: break;
+ }
+ state->Emulate = FALSE;
+ }
}
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 04916d6..613d07e 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -131,8 +131,11 @@ unsigned int swi_mask = -1;
static ARMword softvectorcode[] =
{
- /* Basic: swi tidyexception + event; mov pc, lr;
- ldmia r11,{r11,pc}; swi generateexception + event. */
+ /* Installed instructions:
+ swi tidyexception + event;
+ mov lr, pc;
+ ldmia fp, {fp, pc};
+ swi generateexception + event. */
0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080, /* Reset */
0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081, /* Undef */
0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082, /* SWI */
@@ -205,11 +208,15 @@ ARMul_OSInit (ARMul_State * state)
/* Copy the code. */
ARMul_WriteWord (state, FPESTART + i, fpecode[i >> 2]);
+ /* Scan backwards from the end of the code. */
for (i = FPESTART + fpesize;; i -= 4)
{
- /* Reverse the error strings. */
+ /* When we reach the marker value, break out of
+ the loop, leaving i pointing at the maker. */
if ((j = ARMul_ReadWord (state, i)) == 0xffffffff)
break;
+
+ /* If necessary, reverse the error strings. */
if (state->bigendSig && j < 0x80000000)
{
/* It's part of the string so swap it. */
@@ -221,9 +228,9 @@ ARMul_OSInit (ARMul_State * state)
}
/* Copy old illegal instr vector. */
- ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4));
+ ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, ARMUndefinedInstrV));
/* Install new vector. */
- ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4)));
+ ARMul_WriteWord (state, ARMUndefinedInstrV, FPENEWVECT (ARMul_ReadWord (state, i - 4)));
ARMul_ConsolePrint (state, ", FPE");
/* #endif ASIM */
@@ -692,12 +699,34 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
unhandled = TRUE;
break;
- case 0x90:
- case 0x91:
- case 0x92:
- /* These are used by the FPE code. */
+ /* The following SWIs are generated by the softvectorcode[]
+ installed by default by the simulator. */
+ case 0x91: /* Undefined Instruction. */
+ {
+ ARMword addr = state->RegBank[UNDEFBANK][14] - 4;
+
+ sim_callback->printf_filtered
+ (sim_callback, "sim: exception: Unhandled Instruction '0x%08x' at 0x%08x. Stopping.\n",
+ ARMul_ReadWord (state, addr), addr);
+ state->EndCondition = RDIError_SoftwareInterrupt;
+ state->Emulate = FALSE;
+ return FALSE;
+ }
+
+ case 0x90: /* Reset. */
+ case 0x92: /* SWI. */
+ /* These two can be safely ignored. */
break;
-
+
+ case 0x93: /* Prefetch Abort. */
+ case 0x94: /* Data Abort. */
+ case 0x95: /* Address Exception. */
+ case 0x96: /* IRQ. */
+ case 0x97: /* FIQ. */
+ case 0x98: /* Error. */
+ unhandled = TRUE;
+ break;
+
case -1:
/* This can happen when a SWI is interrupted (eg receiving a
ctrl-C whilst processing SWIRead()). The SWI will complete
diff --git a/sim/arm/configure b/sim/arm/configure
index 26fd5f5..a82b7c7 100755
--- a/sim/arm/configure
+++ b/sim/arm/configure
@@ -3534,7 +3534,7 @@ fi
done
-COPRO="armcopro.o maverick.o"
+COPRO="armcopro.o maverick.o iwmmxt.o"
diff --git a/sim/arm/configure.in b/sim/arm/configure.in
index 73fa0a0..44300ca 100644
--- a/sim/arm/configure.in
+++ b/sim/arm/configure.in
@@ -7,7 +7,7 @@ SIM_AC_COMMON
AC_CHECK_HEADERS(unistd.h)
-COPRO="armcopro.o maverick.o"
+COPRO="armcopro.o maverick.o iwmmxt.o"
AC_SUBST(COPRO)
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index f13d329..bba6f7f 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -263,10 +263,34 @@ sim_create_inferior (sd, abfd, argv, env)
/* We wouldn't set the machine type with earlier toolchains, so we
explicitly select a processor capable of supporting all ARMs in
32bit mode. */
+ /* We choose the XScale rather than the iWMMXt, because the iWMMXt
+ removes the FPE emulator, since it conflicts with its coprocessors.
+ For the most generic ARM support, we want the FPE emulator in place. */
case bfd_mach_arm_XScale:
ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop);
break;
+ case bfd_mach_arm_iWMMXt:
+ {
+ extern int SWI_vector_installed;
+ ARMword i;
+
+ if (! SWI_vector_installed)
+ {
+ /* Intialise the hardware vectors to zero. */
+ if (! SWI_vector_installed)
+ for (i = ARMul_ResetV; i <= ARMFIQV; i += 4)
+ ARMul_WriteWord (state, i, 0);
+
+ /* ARM_WriteWord will have detected the write to the SWI vector,
+ but we want SWI_vector_installed to remain at 0 so that thumb
+ mode breakpoints will work. */
+ SWI_vector_installed = 0;
+ }
+ }
+ ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop | ARM_iWMMXt_Prop);
+ break;
+
case bfd_mach_arm_ep9312:
ARMul_SelectProcessor (state, ARM_v4_Prop | ARM_ep9312_Prop);
break;
@@ -481,6 +505,40 @@ sim_store_register (sd, rn, memory, length)
memcpy (&DSPsc, memory, sizeof DSPsc);
return sizeof DSPsc;
+ case SIM_ARM_IWMMXT_COP0R0_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R1_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R2_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R3_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R4_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R5_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R6_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R7_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R8_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R9_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R10_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R11_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R12_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R13_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R14_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R15_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R0_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R1_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R2_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R3_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R4_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R5_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R6_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R7_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R8_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R9_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R10_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R11_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R12_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R13_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R14_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R15_REGNUM:
+ return Store_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
+
default:
return 0;
}
@@ -560,6 +618,40 @@ sim_fetch_register (sd, rn, memory, length)
memcpy (memory, & DSPsc, sizeof DSPsc);
return sizeof DSPsc;
+ case SIM_ARM_IWMMXT_COP0R0_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R1_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R2_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R3_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R4_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R5_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R6_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R7_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R8_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R9_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R10_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R11_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R12_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R13_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R14_REGNUM:
+ case SIM_ARM_IWMMXT_COP0R15_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R0_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R1_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R2_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R3_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R4_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R5_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R6_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R7_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R8_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R9_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R10_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R11_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R12_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R13_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R14_REGNUM:
+ case SIM_ARM_IWMMXT_COP1R15_REGNUM:
+ return Fetch_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
+
default:
return 0;
}
@@ -822,6 +914,9 @@ sim_stop_reason (sd, reason, sigrc)
*reason = sim_stopped;
if (state->EndCondition == RDIError_BreakpointReached)
*sigrc = SIGTRAP;
+ else if ( state->EndCondition == RDIError_DataAbort
+ || state->EndCondition == RDIError_AddressException)
+ *sigrc = SIGBUS;
else
*sigrc = 0;
}
diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog
index 9699c98..4023d28 100644
--- a/sim/testsuite/ChangeLog
+++ b/sim/testsuite/ChangeLog
@@ -1,3 +1,95 @@
+2003-04-01 Nick Clifton <nickc@redhat.com>
+
+ * sim/arm: New directory: Tests for ARM simulator.
+ * sim/arm/allinsn.exp: New file: Test script.
+ * sim/arm/testutils.inc: New file: Test macros.
+ * sim/arm/adc.cgs, sim/arm/add.cgs, sim/arm/and.cgs,
+ sim/arm/b.cgs, sim/arm/bic.cgs, sim/arm/bl.cgs, sim/arm/bx.cgs,
+ sim/arm/cmn.cgs, sim/arm/cmp.cgs, sim/arm/eor.cgs,
+ sim/arm/hello.ms, sim/arm/ldm.cgs, sim/arm/ldr.cgs,
+ sim/arm/ldrb.cgs, sim/arm/ldrh.cgs, sim/arm/ldrsb.cgs,
+ sim/arm/ldrsh.cgs, sim/arm/misaligned1.ms, sim/arm/misaligned2.ms,
+ sim/arm/misaligned3.ms, sim/arm/misc.exp, sim/arm/mla.cgs,
+ sim/arm/mov.cgs, sim/arm/mrs.cgs, sim/arm/msr.cgs,
+ sim/arm/mul.cgs, sim/arm/mvn.cgs, sim/arm/orr.cgs,
+ sim/arm/rsb.cgs, sim/arm/rsc.cgs, sim/arm/sbc.cgs,
+ sim/arm/smlal.cgs, sim/arm/smull.cgs, sim/arm/stm.cgs,
+ sim/arm/str.cgs, sim/arm/strb.cgs, sim/arm/strh.cgs,
+ sim/arm/sub.cgs, sim/arm/swi.cgs, sim/arm/swp.cgs,
+ sim/arm/swpb.cgs, sim/arm/teq.cgs, sim/arm/tst.cgs,
+ sim/arm/umlal.cgs, sim/arm/umull.cgs: New files: ARM tests.
+ * sim/arm/iwmmxt: New Directory: Tests for iWMMXt.
+ * sim/arm/iwmmxt/iwmmxt.exp: New file: Test script.
+ * sim/arm/iwmmxt/testutils.inc: New file: Test macros.
+ * sim/arm/iwmmxt/tbcst.cgs, sim/arm/iwmmxt/textrm.cgs,
+ sim/arm/iwmmxt/tinsr.cgs, sim/arm/iwmmxt/tmia.cgs,
+ sim/arm/iwmmxt/tmiaph.cgs, sim/arm/iwmmxt/tmiaxy.cgs,
+ sim/arm/iwmmxt/tmovmsk.cgss, sim/arm/iwmmxt/wacc.cgs,
+ sim/arm/iwmmxt/wadd.cgs, sim/arm/iwmmxt/waligni.cgs,
+ sim/arm/iwmmxt/walignr.cgs, sim/arm/iwmmxt/wand.cgs,
+ sim/arm/iwmmxt/wandn.cgs, sim/arm/iwmmxt/wavg2.cgs,
+ sim/arm/iwmmxt/wcmpeq.cgs, sim/arm/iwmmxt/wcmpgt.cgs,
+ sim/arm/iwmmxt/wmac.cgs, sim/arm/iwmmxt/wmadd.cgs,
+ sim/arm/iwmmxt/wmax.cgs, sim/arm/iwmmxt/wmin.cgs,
+ sim/arm/iwmmxt/wmov.cgs, sim/arm/iwmmxt/wmul.cgs,
+ sim/arm/iwmmxt/wor.cgs, sim/arm/iwmmxt/wpack.cgs,
+ sim/arm/iwmmxt/wror.cgs, sim/arm/iwmmxt/wsad.cgs,
+ sim/arm/iwmmxt/wshufh.cgs, sim/arm/iwmmxt/wsll.cgs,
+ sim/arm/iwmmxt/wsra.cgs, sim/arm/iwmmxt/wsrl.cgs,
+ sim/arm/iwmmxt/wsub.cgs, sim/arm/iwmmxt/wunpckeh.cgs,
+ sim/arm/iwmmxt/wunpckel.cgs, sim/arm/iwmmxt/wunpckih.cgs,
+ sim/arm/iwmmxt/wunpckil.cgs, sim/arm/iwmmxt/wxor.cgs,
+ sim/arm/iwmmxt/wzero.cgs: New files: iWMMXt tests.
+ * sim/arm/thumb: New Directory: Thumb tests.
+ * sim/arm/thumb/allthumb.exp: New file: Test script.
+ * sim/arm/thumb/testutils.inc: New file: Test macros.
+ * sim/arm/thumb/adc.cgs, sim/arm/thumb/add-hd-hs.cgs,
+ sim/arm/thumb/add-hd-rs.cgs, sim/arm/thumb/add-rd-hs.cgs,
+ sim/arm/thumb/add-sp.cgs, sim/arm/thumb/add.cgs,
+ sim/arm/thumb/addi.cgs, sim/arm/thumb/addi8.cgs,
+ sim/arm/thumb/and.cgs, sim/arm/thumb/asr.cgs, sim/arm/thumb/b.cgs,
+ sim/arm/thumb/bcc.cgs, sim/arm/thumb/bcs.cgs,
+ sim/arm/thumb/beq.cgs, sim/arm/thumb/bge.cgs,
+ sim/arm/thumb/bgt.cgs, sim/arm/thumb/bhi.cgs,
+ sim/arm/thumb/bic.cgs, sim/arm/thumb/bl-hi.cgs,
+ sim/arm/thumb/bl-lo.cgs, sim/arm/thumb/ble.cgs,
+ sim/arm/thumb/bls.cgs, sim/arm/thumb/blt.cgs,
+ sim/arm/thumb/bmi.cgs, sim/arm/thumb/bne.cgs,
+ sim/arm/thumb/bpl.cgs, sim/arm/thumb/bvc.cgs,
+ sim/arm/thumb/bvs.cgs, sim/arm/thumb/bx-hs.cgs,
+ sim/arm/thumb/bx-rs.cgs, sim/arm/thumb/cmn.cgs,
+ sim/arm/thumb/cmp-hd-hs.cgs, sim/arm/thumb/cmp-hd-rs.cgs,
+ sim/arm/thumb/cmp-rd-hs.cgs, sim/arm/thumb/cmp.cgs,
+ sim/arm/thumb/eor.cgs, sim/arm/thumb/lda-pc.cgs,
+ sim/arm/thumb/lda-sp.cgs, sim/arm/thumb/ldmia.cgs,
+ sim/arm/thumb/ldr-imm.cgs, sim/arm/thumb/ldr-pc.cgs,
+ sim/arm/thumb/ldr-sprel.cgs, sim/arm/thumb/ldr.cgs,
+ sim/arm/thumb/ldrb-imm.cgs, sim/arm/thumb/ldrb.cgs,
+ sim/arm/thumb/ldrh-imm.cgs, sim/arm/thumb/ldrh.cgs,
+ sim/arm/thumb/ldsb.cgs, sim/arm/thumb/ldsh.cgs,
+ sim/arm/thumb/lsl.cgs, sim/arm/thumb/lsr.cgs,
+ sim/arm/thumb/mov-hd-hs.cgs, sim/arm/thumb/mov-hd-rs.cgs,
+ sim/arm/thumb/mov-rd-hs.cgs, sim/arm/thumb/mov.cgs,
+ sim/arm/thumb/mul.cgs, sim/arm/thumb/mvn.cgs,
+ sim/arm/thumb/neg.cgs, sim/arm/thumb/orr.cgs,
+ sim/arm/thumb/pop-pc.cgs, sim/arm/thumb/pop.cgs,
+ sim/arm/thumb/push-lr.cgs, sim/arm/thumb/push.cgs,
+ sim/arm/thumb/ror.cgs, sim/arm/thumb/sbc.cgs,
+ sim/arm/thumb/stmia.cgs, sim/arm/thumb/str-imm.cgs,
+ sim/arm/thumb/str-sprel.cgs, sim/arm/thumb/str.cgs,
+ sim/arm/thumb/strb-imm.cgs, sim/arm/thumb/strb.cgs,
+ sim/arm/thumb/strh-imm.cgs, sim/arm/thumb/strh.cgs,
+ sim/arm/thumb/sub-sp.cgs, sim/arm/thumb/sub.cgs,
+ sim/arm/thumb/subi.cgs, sim/arm/thumb/subi8.cgs,
+ sim/arm/thumb/swi.cgs, sim/arm/thumb/tst.cgs: New files: Thumb
+ tests.
+ * sim/arm/xscale: New directory.
+ * sim/arm/xscale/xscale.exp: New file: Test script.
+ * sim/arm/xscale/testutils.inc: New file: Test macros.
+ * sim/arm/xscale/blx.cgs, sim/arm/xscale/mia.cgs,
+ sim/arm/xscale/miaph.cgs, sim/arm/xscale/miaxy.cgs,
+ sim/arm/xscale/mra.cgs: New files: XScale tests.
+
2002-06-16 Andrew Cagney <ac131313@redhat.com>
* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/testsuite/sim/arm/adc.cgs b/sim/testsuite/sim/arm/adc.cgs
new file mode 100644
index 0000000..b6659a1
--- /dev/null
+++ b/sim/testsuite/sim/arm/adc.cgs
@@ -0,0 +1,43 @@
+# arm testcase for adc
+# mach: all
+
+# ??? Unfinished, more tests needed.
+
+ .include "testutils.inc"
+
+ start
+
+# adc$cond${set-cc?} $rd,$rn,$imm12
+
+ .global adc_imm
+adc_imm:
+ mvi_h_gr r4,1
+ mvi_h_cnvz 0,0,0,0
+ adc r5,r4,#1
+ test_h_cnvz 0,0,0,0
+ test_h_gr r5,2
+
+# adc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+
+ .global adc_reg_imm_shift
+adc_reg_imm_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_cnvz 0,0,0,0
+ adc r6,r4,r5,lsl #2
+ test_h_cnvz 0,0,0,0
+ test_h_gr r6,5
+
+# adc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+
+ .global adc_reg_reg_shift
+adc_reg_reg_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_gr r6,2
+ mvi_h_cnvz 0,0,0,0
+ adc r7,r4,r5,lsl r6
+ test_h_cnvz 0,0,0,0
+ test_h_gr r7,5
+
+ pass
diff --git a/sim/testsuite/sim/arm/add.cgs b/sim/testsuite/sim/arm/add.cgs
new file mode 100644
index 0000000..eba32e0
--- /dev/null
+++ b/sim/testsuite/sim/arm/add.cgs
@@ -0,0 +1,43 @@
+# arm testcase for add
+# mach: all
+
+# ??? Unfinished, more tests needed.
+
+ .include "testutils.inc"
+
+ start
+
+# add$cond${set-cc?} $rd,$rn,$imm12
+
+ .global add_imm
+add_imm:
+ mvi_h_gr r4,1
+ mvi_h_cnvz 0,0,0,0
+ add r5,r4,#1
+ test_h_cnvz 0,0,0,0
+ test_h_gr r5,2
+
+# add$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+
+ .global add_reg_imm_shift
+add_reg_imm_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_cnvz 0,0,0,0
+ add r6,r4,r5,lsl #2
+ test_h_cnvz 0,0,0,0
+ test_h_gr r6,5
+
+# add$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+
+ .global add_reg_reg_shift
+add_reg_reg_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_gr r6,2
+ mvi_h_cnvz 0,0,0,0
+ add r7,r4,r5,lsl r6
+ test_h_cnvz 0,0,0,0
+ test_h_gr r7,5
+
+ pass
diff --git a/sim/testsuite/sim/arm/allinsn.exp b/sim/testsuite/sim/arm/allinsn.exp
new file mode 100644
index 0000000..ec8402f
--- /dev/null
+++ b/sim/testsuite/sim/arm/allinsn.exp
@@ -0,0 +1,28 @@
+# ARM simulator testsuite.
+
+if { [istarget arm*-*-*] || [istarget xscale*-*-*] } {
+ # load support procs (none yet)
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "xscale"
+
+ if [is_remote host] {
+ remote_download host $srcdir/$subdir/testutils.inc
+ }
+
+ # The .cgs suffix is for "cgen .s".
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+
+ run_sim_test $src $all_machs
+ }
+
+ if [is_remote host] {
+ remote_file host delete testutils.inc
+ }
+}
diff --git a/sim/testsuite/sim/arm/and.cgs b/sim/testsuite/sim/arm/and.cgs
new file mode 100644
index 0000000..cd8f003
--- /dev/null
+++ b/sim/testsuite/sim/arm/and.cgs
@@ -0,0 +1,43 @@
+# arm testcase for and
+# mach: all
+
+# ??? Unfinished, more tests needed.
+
+ .include "testutils.inc"
+
+ start
+
+# and$cond${set-cc?} $rd,$rn,$imm12
+
+ .global and_imm
+and_imm:
+ mvi_h_gr r4,1
+ mvi_h_cnvz 0,0,0,0
+ and r5,r4,#1
+ test_h_cnvz 0,0,0,0
+ test_h_gr r5,1
+
+# and$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+
+ .global and_reg_imm_shift
+and_reg_imm_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_cnvz 0,0,0,0
+ and r6,r4,r5,lsl #1
+ test_h_cnvz 0,0,0,0
+ test_h_gr r6,0
+
+# and$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+
+ .global and_reg_reg_shift
+and_reg_reg_shift:
+ mvi_h_gr r4,1
+ mvi_h_gr r5,1
+ mvi_h_gr r6,1
+ mvi_h_cnvz 0,0,0,0
+ and r7,r4,r5,lsl r6
+ test_h_cnvz 0,0,0,0
+ test_h_gr r7,0
+
+ pass
diff --git a/sim/testsuite/sim/arm/b.cgs b/sim/testsuite/sim/arm/b.cgs
new file mode 100644
index 0000000..414b963
--- /dev/null
+++ b/sim/testsuite/sim/arm/b.cgs
@@ -0,0 +1,261 @@
+# arm testcase for b$cond $offset24
+# mach: all
+
+# ??? Still need to test edge cases.
+
+ .include "testutils.inc"
+
+ start
+
+ .global b
+b:
+
+# b foo
+
+ b balways1
+ fail
+balways1:
+
+# beq foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,4
+ cmp r4,r5
+ beq beq1
+ fail
+beq1:
+ mvi_h_gr r5,5
+ cmp r4,r5
+ beq beq2
+ b beq3
+beq2:
+ fail
+beq3:
+
+# bne foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,5
+ cmp r4,r5
+ bne bne1
+ fail
+bne1:
+ mvi_h_gr r5,4
+ cmp r4,r5
+ bne bne2
+ b bne3
+bne2:
+ fail
+bne3:
+
+# bcs foo
+
+ mvi_h_cnvz 1,0,0,0
+ bcs bcs1
+ fail
+bcs1:
+ mvi_h_cnvz 0,0,0,0
+ bcs bcs2
+ b bcs3
+bcs2:
+ fail
+bcs3:
+
+# bcc foo
+
+ mvi_h_cnvz 0,0,0,0
+ bcc bcc1
+ fail
+bcc1:
+ mvi_h_cnvz 1,0,0,0
+ bcc bcc2
+ b bcc3
+bcc2:
+ fail
+bcc3:
+
+# bmi foo
+
+ mvi_h_cnvz 0,1,0,0
+ bmi bmi1
+ fail
+bmi1:
+ mvi_h_cnvz 0,0,0,0
+ bmi bmi2
+ b bmi3
+bmi2:
+ fail
+bmi3:
+
+# bpl foo
+
+ mvi_h_cnvz 0,0,0,0
+ bpl bpl1
+ fail
+bpl1:
+ mvi_h_cnvz 0,1,0,0
+ bpl bpl2
+ b bpl3
+bpl2:
+ fail
+bpl3:
+
+# bvs foo
+
+ mvi_h_cnvz 0,0,1,0
+ bvs bvs1
+ fail
+bvs1:
+ mvi_h_cnvz 0,0,0,0
+ bvs bvs2
+ b bvs3
+bvs2:
+ fail
+bvs3:
+
+# bvc foo
+
+ mvi_h_cnvz 0,0,0,0
+ bvc bvc1
+ fail
+bvc1:
+ mvi_h_cnvz 0,0,1,0
+ bvc bvc2
+ b bvc3
+bvc2:
+ fail
+bvc3:
+
+# bhi foo
+
+ mvi_h_gr r4,5
+ mvi_h_gr r5,4
+ cmp r4,r5
+ bhi bhi1
+ fail
+bhi1:
+ mvi_h_gr r5,5
+ cmp r4,r5
+ bhi bhi2
+ b bhi3
+bhi2:
+ fail
+bhi3:
+ mvi_h_gr r5,6
+ cmp r4,r5
+ bhi bhi4
+ b bhi5
+bhi4:
+ fail
+bhi5:
+
+# bls foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,5
+ cmp r4,r5
+ bls bls1
+ fail
+bls1:
+ mvi_h_gr r5,4
+ cmp r4,r5
+ bls bls2
+ fail
+bls2:
+ mvi_h_gr r5,3
+ cmp r4,r5
+ bls bls3
+ b bls4
+bls3:
+ fail
+bls4:
+
+# bge foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,4
+ cmp r4,r5
+ bge bge1
+ fail
+bge1:
+ mvi_h_gr r5,3
+ cmp r4,r5
+ bge bge2
+ fail
+bge2:
+ mvi_h_gr r5,5
+ cmp r4,r5
+ bge bge3
+ b bge4
+bge3:
+ fail
+bge4:
+
+# blt foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,5
+ cmp r4,r5
+ blt blt1
+ fail
+blt1:
+ mvi_h_gr r5,4
+ cmp r4,r5
+ blt blt2
+ b blt3
+blt2:
+ fail
+blt3:
+ mvi_h_gr r5,3
+ cmp r4,r5
+ blt blt4
+ b blt5
+blt4:
+ fail
+blt5:
+
+# bgt foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,3
+ cmp r4,r5
+ bgt bgt1
+ fail
+bgt1:
+ mvi_h_gr r5,4
+ cmp r4,r5
+ bgt bgt2
+ b bgt3
+bgt2:
+ fail
+bgt3:
+ mvi_h_gr r5,5
+ cmp r4,r5
+ bgt bgt4
+ b bgt5
+bgt4:
+ fail
+bgt5:
+
+# ble foo
+
+ mvi_h_gr r4,4
+ mvi_h_gr r5,4
+ cmp r4,r5
+ ble ble1
+ fail
+ble1:
+ mvi_h_gr r5,5
+ cmp r4,r5
+ ble ble2
+ fail
+ble2:
+ mvi_h_gr r5,3
+ cmp r4,r5
+ ble ble3
+ b ble4
+ble3:
+ fail
+ble4:
+
+ pass
diff --git a/sim/testsuite/sim/arm/bic.cgs b/sim/testsuite/sim/arm/bic.cgs
new file mode 100644
index 0000000..37a9b6c
--- /dev/null
+++ b/sim/testsuite/sim/arm/bic.cgs
@@ -0,0 +1,43 @@
+# arm testcase for bic
+# mach: all
+
+# ??? Unfinished, more tests needed.
+
+ .include "testutils.inc"
+
+ start
+
+# bic$cond${set-cc?} $rd,$rn,$imm12
+
+ .global bic_imm
+bic_imm:
+ mvi_h_gr r4,1
+ mvi_h_cnvz 0,0,0,0
+ bic r5,r4,#0
+ test_h_cnvz 0,0,0,0
+ test_h_gr r5,1
+
+# bic$cond${set-cc?} $rd,$rn,$rm,${operbic2-shifttype} ${operbic2-shiftimm}
+
+ .global bic_reg_imm_shift
+bic_reg_imm_shift:
+ mvi_h_gr r4,7
+ mvi_h_gr r5,1
+ mvi_h_cnvz 0,0,0,0
+ bic r6,r4,r5,lsl #1
+ test_h_cnvz 0,0,0,0
+ test_h_gr r6,5
+
+# bic$cond${set-cc?} $rd,$rn,$rm,${operbic2-shifttype} ${operbic2-shiftreg}
+
+ .global bic_reg_reg_shift
+bic_reg_reg_shift:
+ mvi_h_gr r4,7
+ mvi_h_gr r5,1
+ mvi_h_gr r6,1
+ mvi_h_cnvz 0,0,0,0
+ bic r7,r4,r5,lsl r6
+ test_h_cnvz 0,0,0,0
+ test_h_gr r7,5
+
+ pass
diff --git a/sim/testsuite/sim/arm/bl.cgs b/sim/testsuite/sim/arm/bl.cgs
new file mode 100644
index 0000000..fbc7ef5
--- /dev/null
+++ b/sim/testsuite/sim/arm/bl.cgs
@@ -0,0 +1,21 @@
+# arm testcase for bl$cond $offset24
+# mach: all
+
+ .include "testutils.inc"
+
+ start
+
+ .global bl
+bl:
+ mvi_h_gr r14,0
+ bl bl2
+bl1:
+ fail
+bl2:
+ mvaddr_h_gr r4,bl1
+ cmp r14,r4
+ beq bl3
+ fail
+bl3:
+
+ pass
diff --git a/sim/testsuite/sim/arm/bx.cgs b/sim/testsuite/sim/arm/bx.cgs
new file mode 100644
index 0000000..4c18af4
--- /dev/null
+++ b/sim/testsuite/sim/arm/bx.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bx$cond $rn
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bx
+bx:
+ bx0 pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/cmn.cgs b/sim/testsuite/sim/arm/cmn.cgs
new file mode 100644
index 0000000..1829fc7
--- /dev/null
+++ b/sim/testsuite/sim/arm/cmn.cgs
@@ -0,0 +1,36 @@
+# arm testcase for cmn${cond}${set-cc?} $rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmn_imm
+cmn_imm:
+ cmn00 pc,0
+
+ pass
+# arm testcase for cmn$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmn_reg_imm_shift
+cmn_reg_imm_shift:
+ cmn00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for cmn$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmn_reg_reg_shift
+cmn_reg_reg_shift:
+ cmn00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/cmp.cgs b/sim/testsuite/sim/arm/cmp.cgs
new file mode 100644
index 0000000..ab9dd59
--- /dev/null
+++ b/sim/testsuite/sim/arm/cmp.cgs
@@ -0,0 +1,36 @@
+# arm testcase for cmp${cond}${set-cc?} $rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_imm
+cmp_imm:
+ cmp00 pc,0
+
+ pass
+# arm testcase for cmp$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_reg_imm_shift
+cmp_reg_imm_shift:
+ cmp00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for cmp$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_reg_reg_shift
+cmp_reg_reg_shift:
+ cmp00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/eor.cgs b/sim/testsuite/sim/arm/eor.cgs
new file mode 100644
index 0000000..5bbb1c6
--- /dev/null
+++ b/sim/testsuite/sim/arm/eor.cgs
@@ -0,0 +1,36 @@
+# arm testcase for eor$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global eor_imm
+eor_imm:
+ eor00 pc,pc,0
+
+ pass
+# arm testcase for eor$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global eor_reg_imm_shift
+eor_reg_imm_shift:
+ eor00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for eor$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global eor_reg_reg_shift
+eor_reg_reg_shift:
+ eor00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/hello.ms b/sim/testsuite/sim/arm/hello.ms
new file mode 100644
index 0000000..b063c29
--- /dev/null
+++ b/sim/testsuite/sim/arm/hello.ms
@@ -0,0 +1,91 @@
+# output(): Hello, world.\n
+# mach(): all
+
+# Emit hello world while switching back and forth between arm/thumb.
+# ??? Unfinished
+
+ .macro invalid
+# This is "undefined" but it's not properly decoded yet.
+ .word 0x07ffffff
+# This is stc which isn't recognized yet.
+ stc 0,cr0,[r0]
+ .endm
+
+ .global _start
+_start:
+# Run some simple insns to confirm the engine is at least working.
+ nop
+
+# Skip over output text.
+
+ bl skip_output
+
+hello_text:
+ .asciz "Hello, world.\n"
+
+ .p2align 2
+skip_output:
+
+# Prime loop.
+
+ mov r4, r14
+
+output_next:
+
+# Switch arm->thumb to output next chacter.
+# At this point r4 must point to the next character to output.
+
+ adr r0, into_thumb + 1
+ bx r0
+
+into_thumb:
+ .thumb
+
+# Output a character.
+
+ mov r0,#3 @ writec angel call
+ mov r1,r4
+ swi 0xab @ ??? Confirm number.
+
+# Switch thumb->arm.
+
+ adr r5, back_to_arm
+ bx r5
+
+ .p2align 2
+back_to_arm:
+ .arm
+
+# Load next character, see if done.
+
+ add r4,r4,#1
+ sub r3,r3,r3
+ ldrb r5,[r4,r3]
+ teq r5,#0
+ beq done
+
+# Output a character (in arm mode).
+
+ mov r0,#3
+ mov r1,r4
+ swi #0x123456
+
+# Load next character, see if done.
+
+ add r4,r4,#1
+ sub r3,r3,r3
+ ldrb r5,[r4,r3]
+ teq r5,#0
+ bne output_next
+
+done:
+ mov r0,#0x18
+ ldr r1,exit_code
+ swi #0x123456
+
+# If that fails, try to die with an invalid insn.
+
+ invalid
+
+exit_code:
+ .word 0x20026
diff --git a/sim/testsuite/sim/arm/iwmmxt/iwmmxt.exp b/sim/testsuite/sim/arm/iwmmxt/iwmmxt.exp
new file mode 100644
index 0000000..f3d0f0a
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/iwmmxt.exp
@@ -0,0 +1,28 @@
+# Intel(r) Wireless MMX(tm) technology simulator testsuite.
+
+if { [istarget xscale*-*-*] } {
+ # load support procs (none yet)
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "xscale"
+
+ if [is_remote host] {
+ remote_download host $srcdir/$subdir/testutils.inc
+ }
+
+ # The .cgs suffix is for "cgen .s".
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+
+ run_sim_test $src $all_machs
+ }
+
+ if [is_remote host] {
+ remote_file host delete testutils.inc
+ }
+}
diff --git a/sim/testsuite/sim/arm/iwmmxt/tbcst.cgs b/sim/testsuite/sim/arm/iwmmxt/tbcst.cgs
new file mode 100644
index 0000000..b7138df
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tbcst.cgs
@@ -0,0 +1,65 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TBCST
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tbcst
+tbcst:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte Wide Broadcast
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tbcstb wr0, r2
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0xffffffff
+ test_h_gr r1, 0xffffffff
+ test_h_gr r2, 0x111111ff
+
+ # Test Half Word Wide Broadcast
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tbcsth wr0, r2
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x11ff11ff
+ test_h_gr r1, 0x11ff11ff
+ test_h_gr r2, 0x111111ff
+
+ # Test Word Wide Broadcast
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tbcstw wr0, r2
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x111111ff
+ test_h_gr r1, 0x111111ff
+ test_h_gr r2, 0x111111ff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/testutils.inc b/sim/testsuite/sim/arm/iwmmxt/testutils.inc
new file mode 100644
index 0000000..ae49db8
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/testutils.inc
@@ -0,0 +1,118 @@
+# r0-r3 are used as tmps, consider them call clobbered by these macros.
+# This uses the angel rom monitor calls.
+# ??? How do we use the \@ facility of .macros ???
+# @ is the comment char!
+
+ .macro mvi_h_gr reg, val
+ ldr \reg,[pc]
+ b . + 8
+ .word \val
+ .endm
+
+ .macro mvaddr_h_gr reg, addr
+ ldr \reg,[pc]
+ b . + 8
+ .word \addr
+ .endm
+
+ .macro start
+ .data
+failmsg:
+ .asciz "fail\n"
+passmsg:
+ .asciz "pass\n"
+ .text
+
+do_pass:
+ ldr r1, passmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 0
+passmsg_addr:
+ .word passmsg
+
+do_fail:
+ ldr r1, failmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 1
+failmsg_addr:
+ .word failmsg
+
+ .global _start
+_start:
+ .endm
+
+# *** Other macros know pass/fail are 4 bytes in size! Yuck.
+
+ .macro pass
+ b do_pass
+ .endm
+
+ .macro fail
+ b do_fail
+ .endm
+
+ .macro exit rc
+ # ??? This works with the ARMulator but maybe not others.
+ #mov r0, #\rc
+ #swi #1
+ # This seems to be portable (though it ignores rc).
+ mov r0,#0x18
+ mvi_h_gr r1, 0x20026
+ swi #0x123456
+ # If that returns, punt with a sigill.
+ stc 0,cr0,[r0]
+ .endm
+
+# Other macros know this only clobbers r0.
+# WARNING: It also clobbers the condition codes (FIXME).
+ .macro test_h_gr reg, val
+ mvaddr_h_gr r0, \val
+ cmp \reg, r0
+ beq . + 8
+ fail
+ .endm
+
+ .macro mvi_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ bic r1, r1, #0xf0000000
+ orr r1, r1, r0
+ msr cpsr, r1
+ # ??? nops needed
+ .endm
+
+# ??? Preserve condition codes?
+ .macro test_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ and r1, r1, #0xf0000000
+ cmp r0, r1
+ beq . + 8
+ fail
+ .endm
diff --git a/sim/testsuite/sim/arm/iwmmxt/textrm.cgs b/sim/testsuite/sim/arm/iwmmxt/textrm.cgs
new file mode 100644
index 0000000..fb3dc94
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/textrm.cgs
@@ -0,0 +1,113 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TEXTRM
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global textrm
+textrm:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmub r2, wr0, #3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00000012
+
+ # Test Signed Byte Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmsb r2, wr0, #4
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0xfffffff0
+
+ # Test Unsigned Half Word Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmuh r2, wr0, #3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00009abc
+
+ # Test Signed Half Word Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmsh r2, wr0, #1
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00001234
+
+ # Test Unsigned Word Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmuw r2, wr0, #0
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x12345678
+
+ # Test Signed Word Wide Extraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ textrmsw r2, wr0, #1
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/tinsr.cgs b/sim/testsuite/sim/arm/iwmmxt/tinsr.cgs
new file mode 100644
index 0000000..f457b19
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tinsr.cgs
@@ -0,0 +1,65 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TINSR
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tinsr
+tinsr:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte Wide Insertion
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tinsrb wr0, r2, #3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0xff345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x111111ff
+
+ # Test Half Word Wide Insertion
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tinsrh wr0, r2, #2
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abc11ff
+ test_h_gr r2, 0x111111ff
+
+ # Test Word Wide Insertion
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x111111ff
+
+ tmcrr wr0, r0, r1
+
+ tinsrw wr0, r2, #1
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x111111ff
+ test_h_gr r2, 0x111111ff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/tmia.cgs b/sim/testsuite/sim/arm/iwmmxt/tmia.cgs
new file mode 100644
index 0000000..0b0da66
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tmia.cgs
@@ -0,0 +1,35 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TMIA
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tmia
+tmia:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmia wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x354f53c4
+ test_h_gr r1, 0x4e330b5e
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/tmiaph.cgs b/sim/testsuite/sim/arm/iwmmxt/tmiaph.cgs
new file mode 100644
index 0000000..3778b0a
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tmiaph.cgs
@@ -0,0 +1,35 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TMIAPH
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tmiaph
+tmiaph:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmiaph wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0xfec3f9f4
+ test_h_gr r1, 0x55667787
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/tmiaxy.cgs b/sim/testsuite/sim/arm/iwmmxt/tmiaxy.cgs
new file mode 100644
index 0000000..e7a7b73
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tmiaxy.cgs
@@ -0,0 +1,89 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TMIAxy
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tmiaXY
+tmiaXY:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Bottom Bottom Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmiaBB wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x05f753c4
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Bottom Top Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmiaBT wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0xeeede364
+ test_h_gr r1, 0x55667787
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Top Bottom Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmiaTB wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x0ec85c04
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Top Top Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ tmiaTT wr0, r2, r3
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x09eed974
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/tmovmsk.cgs b/sim/testsuite/sim/arm/iwmmxt/tmovmsk.cgs
new file mode 100644
index 0000000..cfea5b7
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/tmovmsk.cgs
@@ -0,0 +1,65 @@
+# Intel(r) Wireless MMX(tm) technology testcase for TMOVMSK
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global tmovmsk
+tmovmsk:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte Wide Mask Transfer
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+
+ tmcrr wr0, r0, r1
+
+ tmovmskb r2, wr0
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x000000f0
+
+ # Test Half Word Wide Mask Transfer
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+
+ tmcrr wr0, r0, r1
+
+ tmovmskh r2, wr0
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x0000000c
+
+ # Test Word Wide Mask Transfer
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+
+ tmcrr wr0, r0, r1
+
+ tmovmskw r2, wr0
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00000002
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wacc.cgs b/sim/testsuite/sim/arm/iwmmxt/wacc.cgs
new file mode 100644
index 0000000..b3ffea1
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wacc.cgs
@@ -0,0 +1,77 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WACC
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wacc
+wacc:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Wide Accumulation
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ waccb wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00000438
+ test_h_gr r3, 0x00000000
+
+ # Test Unsigned Half Word Wide Accumulation
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wacch wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x0001e258
+ test_h_gr r3, 0x00000000
+
+ # Test Unsigned Word Wide Accumulation
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ waccw wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0xacf13568
+ test_h_gr r3, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wadd.cgs b/sim/testsuite/sim/arm/iwmmxt/wadd.cgs
new file mode 100644
index 0000000..bb4d0ab
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wadd.cgs
@@ -0,0 +1,251 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WADD
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wadd
+wadd:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test UnSaturated Byte Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Unsigned Saturated Byte Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddbus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Signed Saturated Byte Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddbss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x2345677f
+ test_h_gr r5, 0xabcdef11
+
+ # Test UnSaturated Halfword Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Unsigned Saturated Halfword Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddhus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Signed Saturated Halfword Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddhss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test UnSaturated Word Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Unsigned Saturated Word Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddwus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ # Test Signed Saturated Word Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waddwss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456789
+ test_h_gr r5, 0xabcdef11
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/waligni.cgs b/sim/testsuite/sim/arm/iwmmxt/waligni.cgs
new file mode 100644
index 0000000..dc99dae
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/waligni.cgs
@@ -0,0 +1,43 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WALIGNI
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global waligni
+waligni:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test 2 byte align
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ waligni wr2, wr0, wr1, #2
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0xdef01234
+ test_h_gr r5, 0x11119abc
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/walignr.cgs b/sim/testsuite/sim/arm/iwmmxt/walignr.cgs
new file mode 100644
index 0000000..85df51e
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/walignr.cgs
@@ -0,0 +1,137 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WALIGNR
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global walignr
+walignr:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test 0 byte align
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+ mvi_h_gr r6, 3
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+ tmcr wcgr0, r6
+
+ walignr0 wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+ tmrc r6, wcgr0
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0xbcdef012
+ test_h_gr r5, 0x1111119a
+ test_h_gr r6, 3
+
+ # Test 1 byte align
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+ mvi_h_gr r6, 4
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+ tmcr wcgr1, r6
+
+ walignr1 wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+ tmrc r6, wcgr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x9abcdef0
+ test_h_gr r5, 0x11111111
+ test_h_gr r6, 4
+
+ # Test 2 byte align
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+ mvi_h_gr r6, 2
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+ tmcr wcgr2, r6
+
+ walignr2 wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+ tmrc r6, wcgr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0xdef01234
+ test_h_gr r5, 0x11119abc
+ test_h_gr r6, 2
+
+ # Test 3 byte align
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+ mvi_h_gr r6, 5
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+ tmcr wcgr3, r6
+
+ walignr3 wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+ tmrc r6, wcgr3
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x119abcde
+ test_h_gr r5, 0x00111111
+ test_h_gr r6, 5
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wand.cgs b/sim/testsuite/sim/arm/iwmmxt/wand.cgs
new file mode 100644
index 0000000..018383f
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wand.cgs
@@ -0,0 +1,41 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WAND
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wand
+wand:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wand wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x10101010
+ test_h_gr r5, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wandn.cgs b/sim/testsuite/sim/arm/iwmmxt/wandn.cgs
new file mode 100644
index 0000000..f2c2305
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wandn.cgs
@@ -0,0 +1,41 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WANDN
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wandn
+wandn:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wandn wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x02244668
+ test_h_gr r5, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wavg2.cgs b/sim/testsuite/sim/arm/iwmmxt/wavg2.cgs
new file mode 100644
index 0000000..cac2c1a
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wavg2.cgs
@@ -0,0 +1,121 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WAVG2
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wavg2
+wavg2:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte Wide Averaging
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wavg2b wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x11223344
+ test_h_gr r5, 0x5e6f8089
+
+ # Test Byte Wide Averaging with Rounding
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wavg2br wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x12233445
+ test_h_gr r5, 0x5e6f8089
+
+ # Test Half Word Wide Averaging
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wavg2h wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x11a233c4
+ test_h_gr r5, 0x5e6f8089
+
+ # Test Half Word Wide Averaging with Rounding
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wavg2hr wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x11a333c5
+ test_h_gr r5, 0x5e6f8089
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wcmpeq.cgs b/sim/testsuite/sim/arm/iwmmxt/wcmpeq.cgs
new file mode 100644
index 0000000..13ef3dc
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wcmpeq.cgs
@@ -0,0 +1,95 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WCMPEQ
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wcmpeq
+wcmpeq:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte Wide Compare Equal To
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x9abcde00
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpeqb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x9abcde00
+ test_h_gr r4, 0x00000000
+ test_h_gr r5, 0xffffffff
+
+ # Test Half Word Wide Compare Equal To
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x9abcde00
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpeqh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x9abcde00
+ test_h_gr r4, 0x00000000
+ test_h_gr r5, 0xffffffff
+
+ # Test Word Wide Compare Equal To
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x9abcde00
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpeqw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x9abcde00
+ test_h_gr r4, 0x00000000
+ test_h_gr r5, 0xffffffff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wcmpgt.cgs b/sim/testsuite/sim/arm/iwmmxt/wcmpgt.cgs
new file mode 100644
index 0000000..33086c9
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wcmpgt.cgs
@@ -0,0 +1,173 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WCMPGT
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wcmpgt
+wcmpgt:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtub wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0xffffff00
+
+ # Test Signed Byte Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtsb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0x00000000
+
+ # Test Unsigned Half Word Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtuh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0xffffffff
+
+ # Test Signed Half Word Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtsh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0x00000000
+
+ # Test Unsigned Word Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtuw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0xffffffff
+
+ # Test Signed Word Wide Compare Greater Than
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wcmpgtsw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xffffffff
+ test_h_gr r5, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmac.cgs b/sim/testsuite/sim/arm/iwmmxt/wmac.cgs
new file mode 100644
index 0000000..0857ef9
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmac.cgs
@@ -0,0 +1,121 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMAC
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmac
+wmac:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned, Multiply Accumulate, Non-zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x33333333
+ mvi_h_gr r5, 0x44444444
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmacu wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x6c889377
+ test_h_gr r5, 0x44444444
+
+ # Test Unsigned, Multiply Accumulate, Zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x33333333
+ mvi_h_gr r5, 0x44444444
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmacuz wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x39556044
+ test_h_gr r5, 0x00000000
+
+ # Test Signed, Multiply Accumulate, Non-zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x33333333
+ mvi_h_gr r5, 0x44444444
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmacs wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x28449377
+ test_h_gr r5, 0x44444444
+
+ # Test Signed, Multiply Accumulate, Zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x33333333
+ mvi_h_gr r5, 0x44444444
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmacsz wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xf5116044
+ test_h_gr r5, 0xffffffff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmadd.cgs b/sim/testsuite/sim/arm/iwmmxt/wmadd.cgs
new file mode 100644
index 0000000..564b3be
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmadd.cgs
@@ -0,0 +1,69 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMADD
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmadd
+wmadd:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned, Multiply Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaddu wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x06fa5f6c
+ test_h_gr r5, 0x325b00d8
+
+ # Test Signed, Multiply Addition
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmadds wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x06fa5f6c
+ test_h_gr r5, 0xee1700d8
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmax.cgs b/sim/testsuite/sim/arm/iwmmxt/wmax.cgs
new file mode 100644
index 0000000..3a684ce
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmax.cgs
@@ -0,0 +1,173 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMAX
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmax
+wmax:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxub wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x9abcde11
+
+ # Test Signed Byte Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxsb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x11111111
+
+ # Test Unsigned Halfword Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxuh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x9abcde00
+
+ # Test Signed Halfword Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxsh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x11111111
+
+ # Test Unsigned Word Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxuw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x9abcde00
+
+ # Test Signed Word Maximum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmaxsw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x11111111
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmin.cgs b/sim/testsuite/sim/arm/iwmmxt/wmin.cgs
new file mode 100644
index 0000000..3bc1c08
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmin.cgs
@@ -0,0 +1,173 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMIN
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmin
+wmin:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminub wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x11111100
+
+ # Test Signed Byte Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminsb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x9abcde00
+
+ # Test Unsigned Halfword Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminuh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x11111111
+
+ # Test Signed Halfword Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminsh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x9abcde00
+
+ # Test Unsigned Word Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminuw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x11111111
+
+ # Test Signed Word Minimum
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wminsw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x11111111
+ test_h_gr r5, 0x9abcde00
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmov.cgs b/sim/testsuite/sim/arm/iwmmxt/wmov.cgs
new file mode 100644
index 0000000..e86fed6
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmov.cgs
@@ -0,0 +1,35 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMOV
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmov
+wmov:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wmov wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wmul.cgs b/sim/testsuite/sim/arm/iwmmxt/wmul.cgs
new file mode 100644
index 0000000..0978b63
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wmul.cgs
@@ -0,0 +1,121 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WMUL
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wmul
+wmul:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned, Most Significant Multiply
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmulum wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x013605c3
+ test_h_gr r5, 0x14a11db9
+
+ # Test Unsigned, Least Significant Multiply
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmulul wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xa974b5f8
+ test_h_gr r5, 0x84f87be0
+
+ # Test Signed, Most Significant Multiply
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmulsm wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x013605c3
+ test_h_gr r5, 0xf27ffb97
+
+ # Test Signed, Least Significant Multiply
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wmulsl wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0xa974b5f8
+ test_h_gr r5, 0x84f87be0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wor.cgs b/sim/testsuite/sim/arm/iwmmxt/wor.cgs
new file mode 100644
index 0000000..48d5f53
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wor.cgs
@@ -0,0 +1,41 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WOR
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wor
+wor:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wor wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x13355779
+ test_h_gr r5, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wpack.cgs b/sim/testsuite/sim/arm/iwmmxt/wpack.cgs
new file mode 100644
index 0000000..0546bd4
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wpack.cgs
@@ -0,0 +1,173 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WPACK
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wpack
+wpack:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Halfword, Unsigned Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackhus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x0000ffff
+ test_h_gr r5, 0x0000ffff
+
+ # Test Halfword, Signed Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackhss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x80807f7f
+ test_h_gr r5, 0x00007f7f
+
+ # Test Word, Unsigned Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackwus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x0000ffff
+ test_h_gr r5, 0x0000ffff
+
+ # Test Word, Signed Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackwss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x80007fff
+ test_h_gr r5, 0x00007fff
+
+ # Test Double Word, Unsigned Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackdus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x00000000
+ test_h_gr r5, 0x11111111
+
+ # Test Double Word, Signed Saturation, Packing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wpackdss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x80000000
+ test_h_gr r5, 0x11111111
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wror.cgs b/sim/testsuite/sim/arm/iwmmxt/wror.cgs
new file mode 100644
index 0000000..e329916
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wror.cgs
@@ -0,0 +1,167 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WROR
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wror
+wror:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Halfword wide rotate right by register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wrorh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x091a2b3c
+ test_h_gr r5, 0x4d5e6f78
+
+ # Test Halfword wide rotate right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr0, r2
+ tmcrr wr1, r2, r3
+
+ wrorhg wr1, wr0, wcgr0
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr0
+ tmrrc r3, r4, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x091a2b3c
+ test_h_gr r4, 0x4d5e6f78
+
+ # Test Word wide rotate right by register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wrorw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x2b3c091a
+ test_h_gr r5, 0x6f784d5e
+
+ # Test Word wide rotate right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr0, r2
+ tmcrr wr1, r2, r3
+
+ wrorwg wr1, wr0, wcgr0
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr0
+ tmrrc r3, r4, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x2b3c091a
+ test_h_gr r4, 0x6f784d5e
+
+ # Test Double Word wide rotate right by register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wrord wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x6f78091a
+ test_h_gr r5, 0x2b3c4d5e
+
+ # Test Double Word wide rotate right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr0, r2
+ tmcrr wr1, r2, r3
+
+ wrordg wr1, wr0, wcgr0
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr0
+ tmrrc r3, r4, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x6f78091a
+ test_h_gr r4, 0x2b3c4d5e
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wsad.cgs b/sim/testsuite/sim/arm/iwmmxt/wsad.cgs
new file mode 100644
index 0000000..34a20cc
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wsad.cgs
@@ -0,0 +1,121 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSAD
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wsad
+wsad:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte wide absolute accumulation
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x22222222
+ mvi_h_gr r5, 0x22222222
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsadb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x2222258e
+ test_h_gr r5, 0x00000000
+
+ # Test Byte wide absolute accumulation with zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x22222222
+ mvi_h_gr r5, 0x22222222
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsadbz wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x0000036c
+ test_h_gr r5, 0x00000000
+
+ # Test Halfword wide absolute accumulation
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x22222222
+ mvi_h_gr r5, 0x22222222
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsadh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x22239e14
+ test_h_gr r5, 0x00000000
+
+ # Test Halfword wide absolute accumulation with zeroing
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x22222222
+ mvi_h_gr r4, 0x22222222
+ mvi_h_gr r5, 0x22222222
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsadhz wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x22222222
+ test_h_gr r4, 0x00017bf2
+ test_h_gr r5, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wshufh.cgs b/sim/testsuite/sim/arm/iwmmxt/wshufh.cgs
new file mode 100644
index 0000000..d5cff1e
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wshufh.cgs
@@ -0,0 +1,35 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSHUFH
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wshufh
+wshufh:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wshufh wr1, wr0, #0x1b
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0xdef09abc
+ test_h_gr r3, 0x56781234
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wsll.cgs b/sim/testsuite/sim/arm/iwmmxt/wsll.cgs
new file mode 100644
index 0000000..17d7893
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wsll.cgs
@@ -0,0 +1,167 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSLL
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wsll
+wsll:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Halfword Logical Shift Left
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsllh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23406780
+ test_h_gr r5, 0xabc0ef00
+
+ # Test Halfword Aritc Shift Left by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr1, r2
+ tmcrr wr1, r3, r4
+
+ wsllhg wr1, wr0, wcgr1
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr1
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x23406780
+ test_h_gr r4, 0xabc0ef00
+
+ # Test Word Logical Shift Left
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsllw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456780
+ test_h_gr r5, 0xabcdef00
+
+ # Test Word Logical Shift Left by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr2, r2
+ tmcrr wr1, r3, r4
+
+ wsllwg wr1, wr0, wcgr2
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr2
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x23456780
+ test_h_gr r4, 0xabcdef00
+
+ # Test Double Word Logical Shift Left
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wslld wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x23456780
+ test_h_gr r5, 0xabcdefc1
+
+ # Test Double Word Logical Shift Left by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr3, r2
+ tmcrr wr1, r3, r4
+
+ wslldg wr1, wr0, wcgr3
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr3
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x23456780
+ test_h_gr r4, 0xabcdefc1
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wsra.cgs b/sim/testsuite/sim/arm/iwmmxt/wsra.cgs
new file mode 100644
index 0000000..db998bb
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wsra.cgs
@@ -0,0 +1,167 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSRA
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wsra
+wsra:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Halfword Arithmetic Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsrah wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01230567
+ test_h_gr r5, 0xf9abfdef
+
+ # Test Halfword Arithmetic Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr1, r2
+ tmcrr wr1, r3, r4
+
+ wsrahg wr1, wr0, wcgr1
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr1
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x01230567
+ test_h_gr r4, 0xf9abfdef
+
+ # Test Word Arithmetic Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsraw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0xf9abcdef
+
+ # Test Word Arithmetic Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr2, r2
+ tmcrr wr1, r3, r4
+
+ wsrawg wr1, wr0, wcgr2
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr2
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x01234567
+ test_h_gr r4, 0xf9abcdef
+
+ # Test Double Word Arithmetic Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsrad wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0xc1234567
+ test_h_gr r5, 0xf9abcdef
+
+ # Test Double Word Arithmetic Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr3, r2
+ tmcrr wr1, r3, r4
+
+ wsradg wr1, wr0, wcgr3
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr3
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0xc1234567
+ test_h_gr r4, 0xf9abcdef
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wsrl.cgs b/sim/testsuite/sim/arm/iwmmxt/wsrl.cgs
new file mode 100644
index 0000000..416a464
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wsrl.cgs
@@ -0,0 +1,167 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSRL
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wsrl
+wsrl:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Halfword Logical Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsrlh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01230567
+ test_h_gr r5, 0x09ab0def
+
+ # Test Halfword Logical Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr1, r2
+ tmcrr wr1, r3, r4
+
+ wsrlhg wr1, wr0, wcgr1
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr1
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x01230567
+ test_h_gr r4, 0x09ab0def
+
+ # Test Word Logical Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsrlw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x09abcdef
+
+ # Test Word Logical Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr2, r2
+ tmcrr wr1, r3, r4
+
+ wsrlwg wr1, wr0, wcgr2
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr2
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x01234567
+ test_h_gr r4, 0x09abcdef
+
+ # Test Double Word Logical Shift Right
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsrld wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0xc1234567
+ test_h_gr r5, 0x09abcdef
+
+ # Test Double Word Logical Shift Right by CG register
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdefc
+ mvi_h_gr r2, 0x11111104
+ mvi_h_gr r3, 0
+ mvi_h_gr r4, 0
+
+ tmcrr wr0, r0, r1
+ tmcr wcgr3, r2
+ tmcrr wr1, r3, r4
+
+ wsrldg wr1, wr0, wcgr3
+
+ tmrrc r0, r1, wr0
+ tmrc r2, wcgr3
+ tmrrc r3, r4, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdefc
+ test_h_gr r2, 0x11111104
+ test_h_gr r3, 0xc1234567
+ test_h_gr r4, 0x09abcdef
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wsub.cgs b/sim/testsuite/sim/arm/iwmmxt/wsub.cgs
new file mode 100644
index 0000000..b0e77be
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wsub.cgs
@@ -0,0 +1,251 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WSUB
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wsub
+wsub:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsaturated Byte subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abcdef
+
+ # Test Unsigned saturated Byte subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubbus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abcd00
+
+ # Test Signed saturated Byte subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubbss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abcdef
+
+ # Test Unsaturated Halfword subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ # Test Unsigned saturated Halfword subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubhus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ # Test Signed saturated Halfword subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubhss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ # Test Unsaturated Word subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ # Test Unsigned saturated Word subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubwus wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ # Test Signed saturated Word subtraction
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcde00
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x11111111
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wsubwss wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcde00
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x11111111
+ test_h_gr r4, 0x01234567
+ test_h_gr r5, 0x89abccef
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wunpckeh.cgs b/sim/testsuite/sim/arm/iwmmxt/wunpckeh.cgs
new file mode 100644
index 0000000..32a70f4
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wunpckeh.cgs
@@ -0,0 +1,137 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WUNPCKEH
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wunpckeh
+wunpckeh:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Unpacking
+
+ mvi_h_gr r0, 0x12345687
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehub wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345687
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00de00f0
+ test_h_gr r3, 0x009a00bc
+
+ # Test Signed Byte Unpacking
+
+ mvi_h_gr r0, 0x12345687
+ mvi_h_gr r1, 0x7abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehsb wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345687
+ test_h_gr r1, 0x7abcdef0
+ test_h_gr r2, 0xffdefff0
+ test_h_gr r3, 0x007affbc
+
+ # Test Unsigned Halfword Unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehuh wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x0000def0
+ test_h_gr r3, 0x00009abc
+
+ # Test Signed Halfword Unpacking
+
+ mvi_h_gr r0, 0x12348678
+ mvi_h_gr r1, 0x7abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehsh wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12348678
+ test_h_gr r1, 0x7abcdef0
+ test_h_gr r2, 0xffffdef0
+ test_h_gr r3, 0x00007abc
+
+ # Test Unsigned Word Unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehuw wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x9abcdef0
+ test_h_gr r3, 0x00000000
+
+ # Test Signed Word Unpacking
+
+ mvi_h_gr r0, 0x82345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckehsw wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x82345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x9abcdef0
+ test_h_gr r3, 0xffffffff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wunpckel.cgs b/sim/testsuite/sim/arm/iwmmxt/wunpckel.cgs
new file mode 100644
index 0000000..a6ffb4f
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wunpckel.cgs
@@ -0,0 +1,137 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WUNPCKEL
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wunpckel
+wunpckel:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Unsigned Byte Unpacking
+
+ mvi_h_gr r0, 0x12345687
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckelub wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345687
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00560087
+ test_h_gr r3, 0x00120034
+
+ # Test Signed Byte Unpacking
+
+ mvi_h_gr r0, 0x12345687
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckelsb wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345687
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x0056ff87
+ test_h_gr r3, 0x00120034
+
+ # Test Unsigned Halfword Unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckeluh wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x00005678
+ test_h_gr r3, 0x00001234
+
+ # Test Signed Halfword Unpacking
+
+ mvi_h_gr r0, 0x12348678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckelsh wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12348678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0xffff8678
+ test_h_gr r3, 0x00001234
+
+ # Test Unsigned Word Unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckeluw wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x00000000
+
+ # Test Signed Word Unpacking
+
+ mvi_h_gr r0, 0x82345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0
+ mvi_h_gr r3, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+
+ wunpckelsw wr1, wr0
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+
+ test_h_gr r0, 0x82345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x82345678
+ test_h_gr r3, 0xffffffff
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wunpckih.cgs b/sim/testsuite/sim/arm/iwmmxt/wunpckih.cgs
new file mode 100644
index 0000000..41fed0e
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wunpckih.cgs
@@ -0,0 +1,95 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WUNPCKIH
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wunpckih
+wunpckih:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckihb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x00de00f0
+ test_h_gr r5, 0x009a00bc
+
+ # Test Halfword unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckihh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x0000def0
+ test_h_gr r5, 0x00009abc
+
+ # Test Word unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckihw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x9abcdef0
+ test_h_gr r5, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wunpckil.cgs b/sim/testsuite/sim/arm/iwmmxt/wunpckil.cgs
new file mode 100644
index 0000000..7bd7300
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wunpckil.cgs
@@ -0,0 +1,95 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WUNPCKIL
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wunpckil
+wunpckil:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Byte unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckilb wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x11561178
+ test_h_gr r5, 0x11121134
+
+ # Test Halfword unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckilh wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x11115678
+ test_h_gr r5, 0x11111234
+
+ # Test Word unpacking
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wunpckilw wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x12345678
+ test_h_gr r5, 0x11111111
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wxor.cgs b/sim/testsuite/sim/arm/iwmmxt/wxor.cgs
new file mode 100644
index 0000000..95e1fc8
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wxor.cgs
@@ -0,0 +1,41 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WXOR
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wxor
+wxor:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+ mvi_h_gr r2, 0x11111111
+ mvi_h_gr r3, 0x00000000
+ mvi_h_gr r4, 0
+ mvi_h_gr r5, 0
+
+ tmcrr wr0, r0, r1
+ tmcrr wr1, r2, r3
+ tmcrr wr2, r4, r5
+
+ wxor wr2, wr0, wr1
+
+ tmrrc r0, r1, wr0
+ tmrrc r2, r3, wr1
+ tmrrc r4, r5, wr2
+
+ test_h_gr r0, 0x12345678
+ test_h_gr r1, 0x9abcdef0
+ test_h_gr r2, 0x11111111
+ test_h_gr r3, 0x00000000
+ test_h_gr r4, 0x03254769
+ test_h_gr r5, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/iwmmxt/wzero.cgs b/sim/testsuite/sim/arm/iwmmxt/wzero.cgs
new file mode 100644
index 0000000..78fa7c5
--- /dev/null
+++ b/sim/testsuite/sim/arm/iwmmxt/wzero.cgs
@@ -0,0 +1,29 @@
+# Intel(r) Wireless MMX(tm) technology testcase for WZERO
+# mach: xscale
+# as: -mcpu=xscale+iwmmxt
+
+ .include "testutils.inc"
+
+ start
+
+ .global wzero
+wzero:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mvi_h_gr r0, 0x12345678
+ mvi_h_gr r1, 0x9abcdef0
+
+ tmcrr wr0, r0, r1
+
+ wzero wr0
+
+ tmrrc r0, r1, wr0
+
+ test_h_gr r0, 0x00000000
+ test_h_gr r1, 0x00000000
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldm.cgs b/sim/testsuite/sim/arm/ldm.cgs
new file mode 100644
index 0000000..6831a83
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldm.cgs
@@ -0,0 +1,89 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmda_wb
+ldmda_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmda
+ldmda:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmdb_wb
+ldmdb_wb:
+
+ pass
+# arm testcase for ldm$cond ..
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmdb
+ldmdb:
+ ldm0 ..
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmia_wb
+ldmia_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmia
+ldmia:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmib_wb
+ldmib_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmib
+ldmib:
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldr.cgs b/sim/testsuite/sim/arm/ldr.cgs
new file mode 100644
index 0000000..437b68c
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldr.cgs
@@ -0,0 +1,192 @@
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_dec_imm_offset
+ldr_post_dec_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_dec_nonpriv_imm_offset
+ldr_post_dec_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_dec_nonpriv_reg_offset
+ldr_post_dec_nonpriv_reg_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_dec_reg_offset
+ldr_post_dec_reg_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_inc_imm_offset
+ldr_post_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_inc_nonpriv_imm_offset
+ldr_post_inc_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_inc_nonpriv_reg_offset
+ldr_post_inc_nonpriv_reg_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_post_inc_reg_offset
+ldr_post_inc_reg_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_dec_imm_offset
+ldr_pre_dec_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_dec_reg_offset
+ldr_pre_dec_reg_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_dec_wb_imm_offset
+ldr_pre_dec_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_dec_wb_reg_offset
+ldr_pre_dec_wb_reg_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_inc_imm_offset
+ldr_pre_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_inc_reg_offset
+ldr_pre_inc_reg_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_inc_wb_imm_offset
+ldr_pre_inc_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pre_inc_wb_reg_offset
+ldr_pre_inc_wb_reg_offset:
+ ldr0 pc,???
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldrb.cgs b/sim/testsuite/sim/arm/ldrb.cgs
new file mode 100644
index 0000000..b09880c
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldrb.cgs
@@ -0,0 +1,192 @@
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_dec_imm_offset
+ldrb_post_dec_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}bt $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_dec_nonpriv_imm_offset
+ldrb_post_dec_nonpriv_imm_offset:
+ ldr0bt pc,???
+
+ pass
+# arm testcase for ldr${cond}bt $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_dec_nonpriv_reg_offset
+ldrb_post_dec_nonpriv_reg_offset:
+ ldr0bt pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_dec_reg_offset
+ldrb_post_dec_reg_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_inc_imm_offset
+ldrb_post_inc_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}bt $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_inc_nonpriv_imm_offset
+ldrb_post_inc_nonpriv_imm_offset:
+ ldr0bt pc,???
+
+ pass
+# arm testcase for ldr${cond}bt $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_inc_nonpriv_reg_offset
+ldrb_post_inc_nonpriv_reg_offset:
+ ldr0bt pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_post_inc_reg_offset
+ldrb_post_inc_reg_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_dec_imm_offset
+ldrb_pre_dec_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_dec_reg_offset
+ldrb_pre_dec_reg_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_dec_wb_imm_offset
+ldrb_pre_dec_wb_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_dec_wb_reg_offset
+ldrb_pre_dec_wb_reg_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_inc_imm_offset
+ldrb_pre_inc_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_inc_reg_offset
+ldrb_pre_inc_reg_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_inc_wb_imm_offset
+ldrb_pre_inc_wb_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_pre_inc_wb_reg_offset
+ldrb_pre_inc_wb_reg_offset:
+ ldr0b pc,???
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldrh.cgs b/sim/testsuite/sim/arm/ldrh.cgs
new file mode 100644
index 0000000..16a4323
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldrh.cgs
@@ -0,0 +1,132 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_post_dec_imm_offset
+ldrh_post_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_post_dec_reg_offset
+ldrh_post_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_post_inc_imm_offset
+ldrh_post_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_post_inc_reg_offset
+ldrh_post_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_dec_imm_offset
+ldrh_pre_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_dec_reg_offset
+ldrh_pre_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_dec_wb_imm_offset
+ldrh_pre_dec_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_dec_wb_reg_offset
+ldrh_pre_dec_wb_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_inc_imm_offset
+ldrh_pre_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_inc_reg_offset
+ldrh_pre_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_inc_wb_imm_offset
+ldrh_pre_inc_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_pre_inc_wb_reg_offset
+ldrh_pre_inc_wb_reg_offset:
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldrsb.cgs b/sim/testsuite/sim/arm/ldrsb.cgs
new file mode 100644
index 0000000..4d08f4c
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldrsb.cgs
@@ -0,0 +1,132 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_post_dec_imm_offset
+ldrsb_post_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_post_dec_reg_offset
+ldrsb_post_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_post_inc_imm_offset
+ldrsb_post_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_post_inc_reg_offset
+ldrsb_post_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_dec_imm_offset
+ldrsb_pre_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_dec_reg_offset
+ldrsb_pre_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_dec_wb_imm_offset
+ldrsb_pre_dec_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_dec_wb_reg_offset
+ldrsb_pre_dec_wb_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_inc_imm_offset
+ldrsb_pre_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_inc_reg_offset
+ldrsb_pre_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_inc_wb_imm_offset
+ldrsb_pre_inc_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsb_pre_inc_wb_reg_offset
+ldrsb_pre_inc_wb_reg_offset:
+
+ pass
diff --git a/sim/testsuite/sim/arm/ldrsh.cgs b/sim/testsuite/sim/arm/ldrsh.cgs
new file mode 100644
index 0000000..5a6e7c7
--- /dev/null
+++ b/sim/testsuite/sim/arm/ldrsh.cgs
@@ -0,0 +1,132 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_post_dec_imm_offset
+ldrsh_post_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_post_dec_reg_offset
+ldrsh_post_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_post_inc_imm_offset
+ldrsh_post_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_post_inc_reg_offset
+ldrsh_post_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_dec_imm_offset
+ldrsh_pre_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_dec_reg_offset
+ldrsh_pre_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_dec_wb_imm_offset
+ldrsh_pre_dec_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_dec_wb_reg_offset
+ldrsh_pre_dec_wb_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_inc_imm_offset
+ldrsh_pre_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_inc_reg_offset
+ldrsh_pre_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_inc_wb_imm_offset
+ldrsh_pre_inc_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrsh_pre_inc_wb_reg_offset
+ldrsh_pre_inc_wb_reg_offset:
+
+ pass
diff --git a/sim/testsuite/sim/arm/misaligned1.ms b/sim/testsuite/sim/arm/misaligned1.ms
new file mode 100644
index 0000000..69fda47
--- /dev/null
+++ b/sim/testsuite/sim/arm/misaligned1.ms
@@ -0,0 +1,61 @@
+# Test LDR instructions with offsets misaligned by 1 byte.
+# mach(): all
+
+ .macro invalid
+# This is "undefined" but it's not properly decoded yet.
+ .word 0x07ffffff
+# This is stc which isn't recognized yet.
+ stc 0,cr0,[r0]
+ .endm
+
+ .global _start
+_start:
+# Run some simple insns to confirm the engine is at least working.
+ nop
+
+# Skip over output text.
+ bl do_test
+
+pass:
+ .asciz "pass\n"
+ .p2align 2
+
+do_test:
+ mov r4, r14
+ bl continue
+word1:
+ .word 0x5555
+continue:
+ ldr r6, [r14, #1]
+ ldr r7, word2
+ cmp r6, r7
+ # Failed.
+ bne done
+
+output_next:
+# Output a character (in arm mode).
+ mov r0,#3
+ mov r1,r4
+ swi #0x123456
+
+# Load next character, see if done.
+ add r4,r4,#1
+ sub r3,r3,r3
+ ldrb r5,[r4,r3]
+ teq r5,#0
+ bne output_next
+
+done:
+ mov r0,#0x18
+ ldr r1,exit_code
+ swi #0x123456
+
+# If that fails, try to die with an invalid insn.
+ invalid
+
+exit_code:
+ .word 0x20026
+ .word 0xFFFFFFFF
+word2:
+ .word 0x55000055
+ .word 0xFFFFFFFF
diff --git a/sim/testsuite/sim/arm/misaligned2.ms b/sim/testsuite/sim/arm/misaligned2.ms
new file mode 100644
index 0000000..3a03326
--- /dev/null
+++ b/sim/testsuite/sim/arm/misaligned2.ms
@@ -0,0 +1,60 @@
+# Test LDR instructions with offsets misaligned by 2 bytes.
+# mach(): all
+
+ .macro invalid
+# This is "undefined" but it's not properly decoded yet.
+ .word 0x07ffffff
+# This is stc which isn't recognized yet.
+ stc 0,cr0,[r0]
+ .endm
+
+ .global _start
+_start:
+# Run some simple insns to confirm the engine is at least working.
+ nop
+
+# Skip over output text.
+ bl do_test
+
+pass:
+ .asciz "pass\n"
+ .p2align 2
+
+do_test:
+ mov r4, r14
+ bl continue
+word1:
+ .word 0x5555
+continue:
+ ldr r6, [r14, #2]
+ ldr r7, word2
+ cmp r6, r7
+ # Failed.
+ bne done
+
+output_next:
+# Output a character (in arm mode).
+ mov r0,#3
+ mov r1,r4
+ swi #0x123456
+
+# Load next character, see if done.
+ add r4,r4,#1
+ sub r3,r3,r3
+ ldrb r5,[r4,r3]
+ teq r5,#0
+ bne output_next
+
+done:
+ mov r0,#0x18
+ ldr r1,exit_code
+ swi #0x123456
+
+# If that fails, try to die with an invalid insn.
+ invalid
+
+exit_code:
+ .word 0x20026
+
+word2:
+ .word 0x55550000
diff --git a/sim/testsuite/sim/arm/misaligned3.ms b/sim/testsuite/sim/arm/misaligned3.ms
new file mode 100644
index 0000000..bf2d9f1
--- /dev/null
+++ b/sim/testsuite/sim/arm/misaligned3.ms
@@ -0,0 +1,62 @@
+# Test LDR instructions with offsets misaligned by 3 bytes.
+# mach(): all
+
+ .macro invalid
+# This is "undefined" but it's not properly decoded yet.
+ .word 0x07ffffff
+# This is stc which isn't recognized yet.
+ stc 0,cr0,[r0]
+ .endm
+
+ .global _start
+_start:
+# Run some simple insns to confirm the engine is at least working.
+ nop
+
+# Skip over output text.
+ bl do_test
+
+pass:
+ .asciz "pass\n"
+ .p2align 2
+
+do_test:
+ mov r4, r14
+ bl continue
+word1:
+ .word 0x5555
+continue:
+ ldr r6, [r14, #3]
+ ldr r7, word2
+ cmp r6, r7
+ # Failed.
+ bne done
+
+output_next:
+# Output a character (in arm mode).
+ mov r0,#3
+ mov r1,r4
+ swi #0x123456
+
+# Load next character, see if done.
+ add r4,r4,#1
+ sub r3,r3,r3
+ ldrb r5,[r4,r3]
+ teq r5,#0
+ bne output_next
+
+done:
+ mov r0,#0x18
+ ldr r1,exit_code
+ swi #0x123456
+
+# If that fails, try to die with an invalid insn.
+ invalid
+
+exit_code:
+ .word 0x20026
+
+ .word 0xFFFFFFFF
+word2:
+ .word 0x555500
+ .word 0xFFFFFFFF
diff --git a/sim/testsuite/sim/arm/misc.exp b/sim/testsuite/sim/arm/misc.exp
new file mode 100644
index 0000000..1e8006f
--- /dev/null
+++ b/sim/testsuite/sim/arm/misc.exp
@@ -0,0 +1,20 @@
+# Miscellaneous ARM simulator testcases
+
+if { [istarget arm*-*-*] || [istarget thumb*-*-*] || [istarget xscale*-*-*] } {
+ # load support procs
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "arm7tdmi"
+
+ # The .ms suffix is for "miscellaneous .s".
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.ms]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+
+ run_sim_test $src $all_machs
+ }
+}
diff --git a/sim/testsuite/sim/arm/mla.cgs b/sim/testsuite/sim/arm/mla.cgs
new file mode 100644
index 0000000..c82dd0c
--- /dev/null
+++ b/sim/testsuite/sim/arm/mla.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mla$cond${set-cc?} ${mul-rd},$rm,$rs,${mul-rn}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mla
+mla:
+ mla00 pc,pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/mov.cgs b/sim/testsuite/sim/arm/mov.cgs
new file mode 100644
index 0000000..d2a83d3
--- /dev/null
+++ b/sim/testsuite/sim/arm/mov.cgs
@@ -0,0 +1,36 @@
+# arm testcase for mov$cond${set-cc?} $rd,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_imm
+mov_imm:
+ mov00 pc,0
+
+ pass
+# arm testcase for mov$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_reg_imm_shift
+mov_reg_imm_shift:
+ mov00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for mov$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_reg_reg_shift
+mov_reg_reg_shift:
+ mov00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/mrs.cgs b/sim/testsuite/sim/arm/mrs.cgs
new file mode 100644
index 0000000..22c5e95
--- /dev/null
+++ b/sim/testsuite/sim/arm/mrs.cgs
@@ -0,0 +1,24 @@
+# arm testcase for mrs$cond $rd,cpsr
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mrs_c
+mrs_c:
+ mrs0 pc,cpsr
+
+ pass
+# arm testcase for mrs$cond $rd,spsr
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mrs_s
+mrs_s:
+ mrs0 pc,spsr
+
+ pass
diff --git a/sim/testsuite/sim/arm/msr.cgs b/sim/testsuite/sim/arm/msr.cgs
new file mode 100644
index 0000000..c79f0bd
--- /dev/null
+++ b/sim/testsuite/sim/arm/msr.cgs
@@ -0,0 +1,24 @@
+# arm testcase for msr$cond cpsr,$rm
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global msr_c
+msr_c:
+ msr0 cpsr,pc
+
+ pass
+# arm testcase for msr$cond spsr,$rm
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global msr_s
+msr_s:
+ msr0 spsr,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/mul.cgs b/sim/testsuite/sim/arm/mul.cgs
new file mode 100644
index 0000000..4f0a926
--- /dev/null
+++ b/sim/testsuite/sim/arm/mul.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mul$cond${set-cc?} ${mul-rd},$rm,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mul
+mul:
+ mul00 pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/mvn.cgs b/sim/testsuite/sim/arm/mvn.cgs
new file mode 100644
index 0000000..92fd3a4
--- /dev/null
+++ b/sim/testsuite/sim/arm/mvn.cgs
@@ -0,0 +1,36 @@
+# arm testcase for mvn$cond${set-cc?} $rd,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvn_imm
+mvn_imm:
+ mvn00 pc,0
+
+ pass
+# arm testcase for mvn$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvn_reg_imm_shift
+mvn_reg_imm_shift:
+ mvn00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for mvn$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mvn_reg_reg_shift
+mvn_reg_reg_shift:
+ mvn00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/orr.cgs b/sim/testsuite/sim/arm/orr.cgs
new file mode 100644
index 0000000..3fc67ad
--- /dev/null
+++ b/sim/testsuite/sim/arm/orr.cgs
@@ -0,0 +1,36 @@
+# arm testcase for orr$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global orr_imm
+orr_imm:
+ orr00 pc,pc,0
+
+ pass
+# arm testcase for orr$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global orr_reg_imm_shift
+orr_reg_imm_shift:
+ orr00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for orr$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global orr_reg_reg_shift
+orr_reg_reg_shift:
+ orr00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/rsb.cgs b/sim/testsuite/sim/arm/rsb.cgs
new file mode 100644
index 0000000..14edc35
--- /dev/null
+++ b/sim/testsuite/sim/arm/rsb.cgs
@@ -0,0 +1,36 @@
+# arm testcase for rsb$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsb_imm
+rsb_imm:
+ rsb00 pc,pc,0
+
+ pass
+# arm testcase for rsb$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsb_reg_imm_shift
+rsb_reg_imm_shift:
+ rsb00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for rsb$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsb_reg_reg_shift
+rsb_reg_reg_shift:
+ rsb00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/rsc.cgs b/sim/testsuite/sim/arm/rsc.cgs
new file mode 100644
index 0000000..078fbcc
--- /dev/null
+++ b/sim/testsuite/sim/arm/rsc.cgs
@@ -0,0 +1,36 @@
+# arm testcase for rsc$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsc_imm
+rsc_imm:
+ rsc00 pc,pc,0
+
+ pass
+# arm testcase for rsc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsc_reg_imm_shift
+rsc_reg_imm_shift:
+ rsc00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for rsc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global rsc_reg_reg_shift
+rsc_reg_reg_shift:
+ rsc00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/sbc.cgs b/sim/testsuite/sim/arm/sbc.cgs
new file mode 100644
index 0000000..9462702
--- /dev/null
+++ b/sim/testsuite/sim/arm/sbc.cgs
@@ -0,0 +1,36 @@
+# arm testcase for sbc$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sbc_imm
+sbc_imm:
+ sbc00 pc,pc,0
+
+ pass
+# arm testcase for sbc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sbc_reg_imm_shift
+sbc_reg_imm_shift:
+ sbc00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for sbc$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sbc_reg_reg_shift
+sbc_reg_reg_shift:
+ sbc00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/smlal.cgs b/sim/testsuite/sim/arm/smlal.cgs
new file mode 100644
index 0000000..4ad1373
--- /dev/null
+++ b/sim/testsuite/sim/arm/smlal.cgs
@@ -0,0 +1,12 @@
+# arm testcase for smlal$cond${set-cc?} $rdlo,$rdhi,$rm,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global smlal
+smlal:
+ smlal00 pc,pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/smull.cgs b/sim/testsuite/sim/arm/smull.cgs
new file mode 100644
index 0000000..22e3960
--- /dev/null
+++ b/sim/testsuite/sim/arm/smull.cgs
@@ -0,0 +1,12 @@
+# arm testcase for smull$cond${set-cc?} $rdlo,$rdhi,$rm,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global smull
+smull:
+ smull00 pc,pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/stm.cgs b/sim/testsuite/sim/arm/stm.cgs
new file mode 100644
index 0000000..c381216
--- /dev/null
+++ b/sim/testsuite/sim/arm/stm.cgs
@@ -0,0 +1,88 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmda_wb
+stmda_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmda
+stmda:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmdb_wb
+stmdb_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmdb
+stmdb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmia_wb
+stmia_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmia
+stmia:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmib_wb
+stmib_wb:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmib
+stmib:
+
+ pass
diff --git a/sim/testsuite/sim/arm/str.cgs b/sim/testsuite/sim/arm/str.cgs
new file mode 100644
index 0000000..82c683b
--- /dev/null
+++ b/sim/testsuite/sim/arm/str.cgs
@@ -0,0 +1,192 @@
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_dec_imm_offset
+str_post_dec_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_dec_nonpriv_imm_offset
+str_post_dec_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for str${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_dec_nonpriv_reg_offset
+str_post_dec_nonpriv_reg_offset:
+ str0t pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_dec_reg_offset
+str_post_dec_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_inc_imm_offset
+str_post_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_inc_nonpriv_imm_offset
+str_post_inc_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for str${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_inc_nonpriv_reg_offset
+str_post_inc_nonpriv_reg_offset:
+ str0t pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_post_inc_reg_offset
+str_post_inc_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_dec_imm_offset
+str_pre_dec_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_dec_reg_offset
+str_pre_dec_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_dec_wb_imm_offset
+str_pre_dec_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_dec_wb_reg_offset
+str_pre_dec_wb_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_inc_imm_offset
+str_pre_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_inc_reg_offset
+str_pre_inc_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_inc_wb_imm_offset
+str_pre_inc_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_pre_inc_wb_reg_offset
+str_pre_inc_wb_reg_offset:
+ str0 pc,???
+
+ pass
diff --git a/sim/testsuite/sim/arm/strb.cgs b/sim/testsuite/sim/arm/strb.cgs
new file mode 100644
index 0000000..875a649
--- /dev/null
+++ b/sim/testsuite/sim/arm/strb.cgs
@@ -0,0 +1,192 @@
+# arm testcase for ldr${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_dec_imm_offset
+strb_post_dec_imm_offset:
+ ldr0b pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_dec_nonpriv_imm_offset
+strb_post_dec_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for str${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_dec_nonpriv_reg_offset
+strb_post_dec_nonpriv_reg_offset:
+ str0t pc,???
+
+ pass
+# arm testcase for str${cond}b $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_dec_reg_offset
+strb_post_dec_reg_offset:
+ str0b pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_inc_imm_offset
+strb_post_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for ldr${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_inc_nonpriv_imm_offset
+strb_post_inc_nonpriv_imm_offset:
+ ldr0t pc,???
+
+ pass
+# arm testcase for str${cond}t $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_inc_nonpriv_reg_offset
+strb_post_inc_nonpriv_reg_offset:
+ str0t pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_post_inc_reg_offset
+strb_post_inc_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_dec_imm_offset
+strb_pre_dec_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_dec_reg_offset
+strb_pre_dec_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_dec_wb_imm_offset
+strb_pre_dec_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_dec_wb_reg_offset
+strb_pre_dec_wb_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_inc_imm_offset
+strb_pre_inc_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_inc_reg_offset
+strb_pre_inc_reg_offset:
+ str0 pc,???
+
+ pass
+# arm testcase for ldr${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_inc_wb_imm_offset
+strb_pre_inc_wb_imm_offset:
+ ldr0 pc,???
+
+ pass
+# arm testcase for str${cond} $rd,???
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_pre_inc_wb_reg_offset
+strb_pre_inc_wb_reg_offset:
+ str0 pc,???
+
+ pass
diff --git a/sim/testsuite/sim/arm/strh.cgs b/sim/testsuite/sim/arm/strh.cgs
new file mode 100644
index 0000000..e111d48
--- /dev/null
+++ b/sim/testsuite/sim/arm/strh.cgs
@@ -0,0 +1,132 @@
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_post_dec_imm_offset
+strh_post_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_post_dec_reg_offset
+strh_post_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_post_inc_imm_offset
+strh_post_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_post_inc_reg_offset
+strh_post_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_dec_imm_offset
+strh_pre_dec_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_dec_reg_offset
+strh_pre_dec_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_dec_wb_imm_offset
+strh_pre_dec_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_dec_wb_reg_offset
+strh_pre_dec_wb_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_inc_imm_offset
+strh_pre_inc_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_inc_reg_offset
+strh_pre_inc_reg_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_inc_wb_imm_offset
+strh_pre_inc_wb_imm_offset:
+
+ pass
+# arm testcase for FIXME
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_pre_inc_wb_reg_offset
+strh_pre_inc_wb_reg_offset:
+
+ pass
diff --git a/sim/testsuite/sim/arm/sub.cgs b/sim/testsuite/sim/arm/sub.cgs
new file mode 100644
index 0000000..50f222c
--- /dev/null
+++ b/sim/testsuite/sim/arm/sub.cgs
@@ -0,0 +1,36 @@
+# arm testcase for sub$cond${set-cc?} $rd,$rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub_imm
+sub_imm:
+ sub00 pc,pc,0
+
+ pass
+# arm testcase for sub$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub_reg_imm_shift
+sub_reg_imm_shift:
+ sub00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for sub$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub_reg_reg_shift
+sub_reg_reg_shift:
+ sub00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/swi.cgs b/sim/testsuite/sim/arm/swi.cgs
new file mode 100644
index 0000000..0c23d43
--- /dev/null
+++ b/sim/testsuite/sim/arm/swi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for swi$cond ${swi-comment}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global swi
+swi:
+ swi0 0
+
+ pass
diff --git a/sim/testsuite/sim/arm/swp.cgs b/sim/testsuite/sim/arm/swp.cgs
new file mode 100644
index 0000000..f965ef2
--- /dev/null
+++ b/sim/testsuite/sim/arm/swp.cgs
@@ -0,0 +1,12 @@
+# arm testcase for swp$cond $rd,$rm,[$rn]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global swp
+swp:
+ swp0 pc,pc,[pc]
+
+ pass
diff --git a/sim/testsuite/sim/arm/swpb.cgs b/sim/testsuite/sim/arm/swpb.cgs
new file mode 100644
index 0000000..6f8a076
--- /dev/null
+++ b/sim/testsuite/sim/arm/swpb.cgs
@@ -0,0 +1,12 @@
+# arm testcase for swpb${cond}b $rd,$rm,[$rn]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global swpb
+swpb:
+ swpb0b pc,pc,[pc]
+
+ pass
diff --git a/sim/testsuite/sim/arm/teq.cgs b/sim/testsuite/sim/arm/teq.cgs
new file mode 100644
index 0000000..6c69347
--- /dev/null
+++ b/sim/testsuite/sim/arm/teq.cgs
@@ -0,0 +1,36 @@
+# arm testcase for teq${cond}${set-cc?} $rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global teq_imm
+teq_imm:
+ teq00 pc,0
+
+ pass
+# arm testcase for teq$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global teq_reg_imm_shift
+teq_reg_imm_shift:
+ teq00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for teq$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global teq_reg_reg_shift
+teq_reg_reg_shift:
+ teq00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/testutils.inc b/sim/testsuite/sim/arm/testutils.inc
new file mode 100644
index 0000000..ae49db8
--- /dev/null
+++ b/sim/testsuite/sim/arm/testutils.inc
@@ -0,0 +1,118 @@
+# r0-r3 are used as tmps, consider them call clobbered by these macros.
+# This uses the angel rom monitor calls.
+# ??? How do we use the \@ facility of .macros ???
+# @ is the comment char!
+
+ .macro mvi_h_gr reg, val
+ ldr \reg,[pc]
+ b . + 8
+ .word \val
+ .endm
+
+ .macro mvaddr_h_gr reg, addr
+ ldr \reg,[pc]
+ b . + 8
+ .word \addr
+ .endm
+
+ .macro start
+ .data
+failmsg:
+ .asciz "fail\n"
+passmsg:
+ .asciz "pass\n"
+ .text
+
+do_pass:
+ ldr r1, passmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 0
+passmsg_addr:
+ .word passmsg
+
+do_fail:
+ ldr r1, failmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 1
+failmsg_addr:
+ .word failmsg
+
+ .global _start
+_start:
+ .endm
+
+# *** Other macros know pass/fail are 4 bytes in size! Yuck.
+
+ .macro pass
+ b do_pass
+ .endm
+
+ .macro fail
+ b do_fail
+ .endm
+
+ .macro exit rc
+ # ??? This works with the ARMulator but maybe not others.
+ #mov r0, #\rc
+ #swi #1
+ # This seems to be portable (though it ignores rc).
+ mov r0,#0x18
+ mvi_h_gr r1, 0x20026
+ swi #0x123456
+ # If that returns, punt with a sigill.
+ stc 0,cr0,[r0]
+ .endm
+
+# Other macros know this only clobbers r0.
+# WARNING: It also clobbers the condition codes (FIXME).
+ .macro test_h_gr reg, val
+ mvaddr_h_gr r0, \val
+ cmp \reg, r0
+ beq . + 8
+ fail
+ .endm
+
+ .macro mvi_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ bic r1, r1, #0xf0000000
+ orr r1, r1, r0
+ msr cpsr, r1
+ # ??? nops needed
+ .endm
+
+# ??? Preserve condition codes?
+ .macro test_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ and r1, r1, #0xf0000000
+ cmp r0, r1
+ beq . + 8
+ fail
+ .endm
diff --git a/sim/testsuite/sim/arm/thumb/adc.cgs b/sim/testsuite/sim/arm/thumb/adc.cgs
new file mode 100644
index 0000000..58d74c1
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/adc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for adc $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_adc
+alu_adc:
+ adc r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/add-hd-hs.cgs b/sim/testsuite/sim/arm/thumb/add-hd-hs.cgs
new file mode 100644
index 0000000..0307acc
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/add-hd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add $hd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global add_hd_hs
+add_hd_hs:
+ add r8,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/add-hd-rs.cgs b/sim/testsuite/sim/arm/thumb/add-hd-rs.cgs
new file mode 100644
index 0000000..ca080f7
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/add-hd-rs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add $hd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global add_hd_rs
+add_hd_rs:
+ add r8,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/add-rd-hs.cgs b/sim/testsuite/sim/arm/thumb/add-rd-hs.cgs
new file mode 100644
index 0000000..46373a0
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/add-rd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add $rd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global add_rd_hs
+add_rd_hs:
+ add r0,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/add-sp.cgs b/sim/testsuite/sim/arm/thumb/add-sp.cgs
new file mode 100644
index 0000000..54efa2a
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/add-sp.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add sp,#$sword7
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global add_sp
+add_sp:
+ add sp,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/add.cgs b/sim/testsuite/sim/arm/thumb/add.cgs
new file mode 100644
index 0000000..63cc20c
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/add.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add $rd,$rs,$rn
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global add
+add:
+ add r0,r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/addi.cgs b/sim/testsuite/sim/arm/thumb/addi.cgs
new file mode 100644
index 0000000..00ec76d
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/addi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add $rd,$rs,#$offset3
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global addi
+addi:
+ add r0,r0,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/addi8.cgs b/sim/testsuite/sim/arm/thumb/addi8.cgs
new file mode 100644
index 0000000..d8e9f81
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/addi8.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add ${bit10-rd},#$offset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global addi8
+addi8:
+ add r0,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/allthumb.exp b/sim/testsuite/sim/arm/thumb/allthumb.exp
new file mode 100644
index 0000000..9674bca
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/allthumb.exp
@@ -0,0 +1,21 @@
+# ARM simulator testsuite.
+
+if { [istarget arm*-*-*]
+ || [istarget thumb*-*-*] } {
+ # load support procs (none yet)
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "arm7tdmi"
+
+ # The .cgs suffix is for "cgen .s".
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+
+ run_sim_test $src $all_machs
+ }
+}
diff --git a/sim/testsuite/sim/arm/thumb/and.cgs b/sim/testsuite/sim/arm/thumb/and.cgs
new file mode 100644
index 0000000..d67adf4
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/and.cgs
@@ -0,0 +1,12 @@
+# arm testcase for and $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_and
+alu_and:
+ and r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/asr.cgs b/sim/testsuite/sim/arm/thumb/asr.cgs
new file mode 100644
index 0000000..4d21dae
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/asr.cgs
@@ -0,0 +1,14 @@
+# arm testcase for asr $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_asr
+alu_asr:
+ asr r0,r0
+
+# FIXME: Also asr $rd,$rs,#$offset5
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/b.cgs b/sim/testsuite/sim/arm/thumb/b.cgs
new file mode 100644
index 0000000..ecae537
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/b.cgs
@@ -0,0 +1,12 @@
+# arm testcase for b $offset11
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global b
+b:
+ b footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bcc.cgs b/sim/testsuite/sim/arm/thumb/bcc.cgs
new file mode 100644
index 0000000..6c84458
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bcc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bcc $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bcc
+bcc:
+ bcc footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bcs.cgs b/sim/testsuite/sim/arm/thumb/bcs.cgs
new file mode 100644
index 0000000..a29a8fb
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bcs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bcs $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bcs
+bcs:
+ bcs footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/beq.cgs b/sim/testsuite/sim/arm/thumb/beq.cgs
new file mode 100644
index 0000000..33f3748
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/beq.cgs
@@ -0,0 +1,12 @@
+# arm testcase for beq $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global beq
+beq:
+ beq footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bge.cgs b/sim/testsuite/sim/arm/thumb/bge.cgs
new file mode 100644
index 0000000..4eb543d
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bge.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bge $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bge
+bge:
+ bge footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bgt.cgs b/sim/testsuite/sim/arm/thumb/bgt.cgs
new file mode 100644
index 0000000..1ffe092
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bgt.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bgt $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bgt
+bgt:
+ bgt footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bhi.cgs b/sim/testsuite/sim/arm/thumb/bhi.cgs
new file mode 100644
index 0000000..c9811c6
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bhi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bhi $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bhi
+bhi:
+ bhi footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bic.cgs b/sim/testsuite/sim/arm/thumb/bic.cgs
new file mode 100644
index 0000000..6dca1ef
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bic.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bic $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_bic
+alu_bic:
+ bic r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bl-hi.cgs b/sim/testsuite/sim/arm/thumb/bl-hi.cgs
new file mode 100644
index 0000000..c7400c7
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bl-hi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bl-hi ${lbwl-hi}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bl_hi
+bl_hi:
+ bl-hi 0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bl-lo.cgs b/sim/testsuite/sim/arm/thumb/bl-lo.cgs
new file mode 100644
index 0000000..ed76613
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bl-lo.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bl-lo ${lbwl-lo}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bl_lo
+bl_lo:
+ bl-lo 0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ble.cgs b/sim/testsuite/sim/arm/thumb/ble.cgs
new file mode 100644
index 0000000..e9c5a8f
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ble.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ble $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ble
+ble:
+ ble footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bls.cgs b/sim/testsuite/sim/arm/thumb/bls.cgs
new file mode 100644
index 0000000..483412b
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bls.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bls $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bls
+bls:
+ bls footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/blt.cgs b/sim/testsuite/sim/arm/thumb/blt.cgs
new file mode 100644
index 0000000..0fbcbe8
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/blt.cgs
@@ -0,0 +1,12 @@
+# arm testcase for blt $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global blt
+blt:
+ blt footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bmi.cgs b/sim/testsuite/sim/arm/thumb/bmi.cgs
new file mode 100644
index 0000000..8f7558a
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bmi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bmi $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bmi
+bmi:
+ bmi footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bne.cgs b/sim/testsuite/sim/arm/thumb/bne.cgs
new file mode 100644
index 0000000..a5ac348
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bne.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bne $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bne
+bne:
+ bne footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bpl.cgs b/sim/testsuite/sim/arm/thumb/bpl.cgs
new file mode 100644
index 0000000..8f64259
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bpl.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bpl $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bpl
+bpl:
+ bpl footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bvc.cgs b/sim/testsuite/sim/arm/thumb/bvc.cgs
new file mode 100644
index 0000000..bbd3af5
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bvc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bvc $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bvc
+bvc:
+ bvc footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bvs.cgs b/sim/testsuite/sim/arm/thumb/bvs.cgs
new file mode 100644
index 0000000..8c9a551
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bvs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bvs $soffset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bvs
+bvs:
+ bvs footext
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bx-hs.cgs b/sim/testsuite/sim/arm/thumb/bx-hs.cgs
new file mode 100644
index 0000000..d963387
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bx-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bx $hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bx_hs
+bx_hs:
+ bx r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/bx-rs.cgs b/sim/testsuite/sim/arm/thumb/bx-rs.cgs
new file mode 100644
index 0000000..f6db8c8
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/bx-rs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for bx $rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global bx_rs
+bx_rs:
+ bx r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/cmn.cgs b/sim/testsuite/sim/arm/thumb/cmn.cgs
new file mode 100644
index 0000000..96d53a1
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/cmn.cgs
@@ -0,0 +1,12 @@
+# arm testcase for cmn $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_cmn
+alu_cmn:
+ cmn r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/cmp-hd-hs.cgs b/sim/testsuite/sim/arm/thumb/cmp-hd-hs.cgs
new file mode 100644
index 0000000..96a91a2
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/cmp-hd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for cmp $hd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_hd_hs
+cmp_hd_hs:
+ cmp r8,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/cmp-hd-rs.cgs b/sim/testsuite/sim/arm/thumb/cmp-hd-rs.cgs
new file mode 100644
index 0000000..9fc4875
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/cmp-hd-rs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for cmp $hd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_hd_rs
+cmp_hd_rs:
+ cmp r8,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/cmp-rd-hs.cgs b/sim/testsuite/sim/arm/thumb/cmp-rd-hs.cgs
new file mode 100644
index 0000000..e3f7a4a
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/cmp-rd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for cmp $rd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp_rd_hs
+cmp_rd_hs:
+ cmp r0,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/cmp.cgs b/sim/testsuite/sim/arm/thumb/cmp.cgs
new file mode 100644
index 0000000..7564099
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/cmp.cgs
@@ -0,0 +1,14 @@
+# arm testcase for cmp ${bit10-rd},#$offset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global cmp
+cmp:
+ cmp r0,#0
+
+# FIXME: Also: cmp $rd,$rs
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/eor.cgs b/sim/testsuite/sim/arm/thumb/eor.cgs
new file mode 100644
index 0000000..cc6021c
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/eor.cgs
@@ -0,0 +1,12 @@
+# arm testcase for eor $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_eor
+alu_eor:
+ eor r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/lda-pc.cgs b/sim/testsuite/sim/arm/thumb/lda-pc.cgs
new file mode 100644
index 0000000..74407e2
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/lda-pc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add ${bit10-rd},pc,$word8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global lda_pc
+lda_pc:
+ add r0,pc,0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/lda-sp.cgs b/sim/testsuite/sim/arm/thumb/lda-sp.cgs
new file mode 100644
index 0000000..ce2b62e
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/lda-sp.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add ${bit10-rd},sp,$word8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global lda_sp
+lda_sp:
+ add r0,sp,0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldmia.cgs b/sim/testsuite/sim/arm/thumb/ldmia.cgs
new file mode 100644
index 0000000..550031e
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldmia.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldmia $rb!,{$rlist}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldmia
+ldmia:
+ ldmia r0!,{0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldr-imm.cgs b/sim/testsuite/sim/arm/thumb/ldr-imm.cgs
new file mode 100644
index 0000000..a757f33
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldr-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldr $rd,[$rb,#${offset5-7}]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_imm
+ldr_imm:
+ ldr r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldr-pc.cgs b/sim/testsuite/sim/arm/thumb/ldr-pc.cgs
new file mode 100644
index 0000000..8227562
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldr-pc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldr ${bit10-rd},[pc,#$word8]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_pc
+ldr_pc:
+ ldr r0,[pc,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldr-sprel.cgs b/sim/testsuite/sim/arm/thumb/ldr-sprel.cgs
new file mode 100644
index 0000000..11eee26
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldr-sprel.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldr ${bit10-rd},[sp,#$word8]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr_sprel
+ldr_sprel:
+ ldr r0,[sp,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldr.cgs b/sim/testsuite/sim/arm/thumb/ldr.cgs
new file mode 100644
index 0000000..03af925
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldr.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldr $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldr
+ldr:
+ ldr r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldrb-imm.cgs b/sim/testsuite/sim/arm/thumb/ldrb-imm.cgs
new file mode 100644
index 0000000..c1eeafe
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldrb-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldrb $rd,[$rb,#$offset5]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb_imm
+ldrb_imm:
+ ldrb r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldrb.cgs b/sim/testsuite/sim/arm/thumb/ldrb.cgs
new file mode 100644
index 0000000..316a10f
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldrb.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldrb $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrb
+ldrb:
+ ldrb r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldrh-imm.cgs b/sim/testsuite/sim/arm/thumb/ldrh-imm.cgs
new file mode 100644
index 0000000..81ea1e0
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldrh-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldrh $rd,[$rb,#${offset5-6}]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh_imm
+ldrh_imm:
+ ldrh r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldrh.cgs b/sim/testsuite/sim/arm/thumb/ldrh.cgs
new file mode 100644
index 0000000..3ff8f4e
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldrh.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldrh $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldrh
+ldrh:
+ ldrh r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldsb.cgs b/sim/testsuite/sim/arm/thumb/ldsb.cgs
new file mode 100644
index 0000000..e1612c9
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldsb.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldsb $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldsb
+ldsb:
+ ldsb r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ldsh.cgs b/sim/testsuite/sim/arm/thumb/ldsh.cgs
new file mode 100644
index 0000000..46d49ac
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ldsh.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ldsh $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global ldsh
+ldsh:
+ ldsh r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/lsl.cgs b/sim/testsuite/sim/arm/thumb/lsl.cgs
new file mode 100644
index 0000000..05222e7
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/lsl.cgs
@@ -0,0 +1,14 @@
+# arm testcase for lsl $rd,$rs,#$offset5
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global lsl
+lsl:
+ lsl r0,r0,#0
+
+# FIXME: Also lsl $rd,$rs
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/lsr.cgs b/sim/testsuite/sim/arm/thumb/lsr.cgs
new file mode 100644
index 0000000..fe38fe0
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/lsr.cgs
@@ -0,0 +1,14 @@
+# arm testcase for lsr $rd,$rs,#$offset5
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global lsr
+lsr:
+ lsr r0,r0,#0
+
+# FIXME: Also lsr $rd,$rs
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mov-hd-hs.cgs b/sim/testsuite/sim/arm/thumb/mov-hd-hs.cgs
new file mode 100644
index 0000000..2050908
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mov-hd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mov $hd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_hd_hs
+mov_hd_hs:
+ mov r8,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mov-hd-rs.cgs b/sim/testsuite/sim/arm/thumb/mov-hd-rs.cgs
new file mode 100644
index 0000000..3d229c3
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mov-hd-rs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mov $hd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_hd_rs
+mov_hd_rs:
+ mov r8,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mov-rd-hs.cgs b/sim/testsuite/sim/arm/thumb/mov-rd-hs.cgs
new file mode 100644
index 0000000..0661dfa
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mov-rd-hs.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mov $rd,$hs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov_rd_hs
+mov_rd_hs:
+ mov r0,r8
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mov.cgs b/sim/testsuite/sim/arm/thumb/mov.cgs
new file mode 100644
index 0000000..b497b0f
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mov.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mov ${bit10-rd},#$offset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global mov
+mov:
+ mov r0,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mul.cgs b/sim/testsuite/sim/arm/thumb/mul.cgs
new file mode 100644
index 0000000..d160c56
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mul.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mul $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_mul
+alu_mul:
+ mul r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/mvn.cgs b/sim/testsuite/sim/arm/thumb/mvn.cgs
new file mode 100644
index 0000000..606ce85
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/mvn.cgs
@@ -0,0 +1,12 @@
+# arm testcase for mvn $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_mvn
+alu_mvn:
+ mvn r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/neg.cgs b/sim/testsuite/sim/arm/thumb/neg.cgs
new file mode 100644
index 0000000..09f0c81
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/neg.cgs
@@ -0,0 +1,12 @@
+# arm testcase for neg $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_neg
+alu_neg:
+ neg r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/orr.cgs b/sim/testsuite/sim/arm/thumb/orr.cgs
new file mode 100644
index 0000000..de6f688
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/orr.cgs
@@ -0,0 +1,12 @@
+# arm testcase for orr $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_orr
+alu_orr:
+ orr r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/pop-pc.cgs b/sim/testsuite/sim/arm/thumb/pop-pc.cgs
new file mode 100644
index 0000000..4579cad
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/pop-pc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for pop {${rlist-pc}}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global pop_pc
+pop_pc:
+ pop {0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/pop.cgs b/sim/testsuite/sim/arm/thumb/pop.cgs
new file mode 100644
index 0000000..b156e1d
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/pop.cgs
@@ -0,0 +1,12 @@
+# arm testcase for pop {$rlist}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global pop
+pop:
+ pop {0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/push-lr.cgs b/sim/testsuite/sim/arm/thumb/push-lr.cgs
new file mode 100644
index 0000000..ee700a4
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/push-lr.cgs
@@ -0,0 +1,12 @@
+# arm testcase for push {${rlist-lr}}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global push_lr
+push_lr:
+ push {0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/push.cgs b/sim/testsuite/sim/arm/thumb/push.cgs
new file mode 100644
index 0000000..ff94ca5
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/push.cgs
@@ -0,0 +1,12 @@
+# arm testcase for push {$rlist}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global push
+push:
+ push {0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/ror.cgs b/sim/testsuite/sim/arm/thumb/ror.cgs
new file mode 100644
index 0000000..991fa66
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/ror.cgs
@@ -0,0 +1,12 @@
+# arm testcase for ror $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_ror
+alu_ror:
+ ror r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/sbc.cgs b/sim/testsuite/sim/arm/thumb/sbc.cgs
new file mode 100644
index 0000000..078b061
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/sbc.cgs
@@ -0,0 +1,12 @@
+# arm testcase for sbc $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_sbc
+alu_sbc:
+ sbc r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/stmia.cgs b/sim/testsuite/sim/arm/thumb/stmia.cgs
new file mode 100644
index 0000000..0e1c30c
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/stmia.cgs
@@ -0,0 +1,12 @@
+# arm testcase for stmia $rb!,{$rlist}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global stmia
+stmia:
+ stmia r0!,{0}
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/str-imm.cgs b/sim/testsuite/sim/arm/thumb/str-imm.cgs
new file mode 100644
index 0000000..ce75941
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/str-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for str $rd,[$rb,#${offset5-7}]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_imm
+str_imm:
+ str r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/str-sprel.cgs b/sim/testsuite/sim/arm/thumb/str-sprel.cgs
new file mode 100644
index 0000000..132edfb
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/str-sprel.cgs
@@ -0,0 +1,12 @@
+# arm testcase for str ${bit10-rd},[sp,#$word8]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str_sprel
+str_sprel:
+ str r0,[sp,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/str.cgs b/sim/testsuite/sim/arm/thumb/str.cgs
new file mode 100644
index 0000000..073e20b
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/str.cgs
@@ -0,0 +1,12 @@
+# arm testcase for str $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global str
+str:
+ str r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/strb-imm.cgs b/sim/testsuite/sim/arm/thumb/strb-imm.cgs
new file mode 100644
index 0000000..2b5bcf7
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/strb-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for strb $rd,[$rb,#$offset5]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb_imm
+strb_imm:
+ strb r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/strb.cgs b/sim/testsuite/sim/arm/thumb/strb.cgs
new file mode 100644
index 0000000..b7cb763
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/strb.cgs
@@ -0,0 +1,12 @@
+# arm testcase for strb $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strb
+strb:
+ strb r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/strh-imm.cgs b/sim/testsuite/sim/arm/thumb/strh-imm.cgs
new file mode 100644
index 0000000..9500288
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/strh-imm.cgs
@@ -0,0 +1,12 @@
+# arm testcase for strh $rd,[$rb,#${offset5-6}]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh_imm
+strh_imm:
+ strh r0,[r0,#0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/strh.cgs b/sim/testsuite/sim/arm/thumb/strh.cgs
new file mode 100644
index 0000000..13f3a0d
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/strh.cgs
@@ -0,0 +1,12 @@
+# arm testcase for strh $rd,[$rb,$ro]
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global strh
+strh:
+ strh r0,[r0,r0]
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/sub-sp.cgs b/sim/testsuite/sim/arm/thumb/sub-sp.cgs
new file mode 100644
index 0000000..e676f58
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/sub-sp.cgs
@@ -0,0 +1,12 @@
+# arm testcase for add sp,#-$sword7
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub_sp
+sub_sp:
+ add sp,#-0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/sub.cgs b/sim/testsuite/sim/arm/thumb/sub.cgs
new file mode 100644
index 0000000..91cd7ab
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/sub.cgs
@@ -0,0 +1,12 @@
+# arm testcase for sub $rd,$rs,$rn
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global sub
+sub:
+ sub r0,r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/subi.cgs b/sim/testsuite/sim/arm/thumb/subi.cgs
new file mode 100644
index 0000000..044efd0
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/subi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for sub $rd,$rs,#$offset3
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global subi
+subi:
+ sub r0,r0,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/subi8.cgs b/sim/testsuite/sim/arm/thumb/subi8.cgs
new file mode 100644
index 0000000..0c4d717
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/subi8.cgs
@@ -0,0 +1,12 @@
+# arm testcase for sub ${bit10-rd},#$offset8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global subi8
+subi8:
+ sub r0,#0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/swi.cgs b/sim/testsuite/sim/arm/thumb/swi.cgs
new file mode 100644
index 0000000..1724c14
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/swi.cgs
@@ -0,0 +1,12 @@
+# arm testcase for swi $value8
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global swi
+swi:
+ swi 0
+
+ pass
diff --git a/sim/testsuite/sim/arm/thumb/testutils.inc b/sim/testsuite/sim/arm/thumb/testutils.inc
new file mode 100644
index 0000000..bdae29b
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/testutils.inc
@@ -0,0 +1,91 @@
+# FIXME: wip, copied from ../testutils.inc
+# r0-r3 are used as tmps, consider them call clobbered by these macros.
+# This uses the angel rom monitor calls.
+# ??? How do we use the \@ facility of .macros ???
+# @ is the comment char!
+
+ .macro a_mvi_h_gr reg, val
+ ldr \reg,[pc]
+ b . + 8
+ .word \val
+ .endm
+
+ .macro mvaddr_h_gr reg, addr
+ ldr \reg,[pc]
+ b . + 8
+ .word \val
+ .endm
+
+ .macro start
+ .data
+failmsg:
+ .asciz "fail\n"
+passmsg:
+ .asciz "pass\n"
+ .text
+
+do_pass:
+ ldr r1, passmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 0
+passmsg_addr:
+ .word passmsg
+
+do_fail:
+ ldr r1, failmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 1
+failmsg_addr:
+ .word failmsg
+
+ .global _start
+_start:
+ .endm
+
+# *** Other macros know pass/fail are 4 bytes in size! Yuck.
+
+ .macro pass
+ b do_pass
+ .endm
+
+ .macro fail
+ b do_fail
+ .endm
+
+ .macro exit rc
+ mov r1, #\rc
+ mov r0, #0x2a @ decimal 42
+ swi #1
+ # If that returns, punt with a sigill.
+ stc 0,cr0,[r0]
+ .endm
+
+# Other macros know this only clobbers r0.
+ .macro test_h_gr reg, val
+ mvaddr_h_gr r0, \val
+ cmp \reg, r0
+ beq . + 8
+ fail
+ .endm
+
+ .macro mvi_h_cc c, n, v, z
+ ldi8 r0, 0
+ ldi8 r1, 1
+ .if xxx
+ cmp r0, r1
+ .else
+ cmp r1, r0
+ .endif
+ .endm
+
+ .macro test_h_cc c, n, v, z
+ .if xxx
+ bc . + 8
+ fail
+ .else
+ bnc . + 8
+ fail
+ .endif
+ .endm
diff --git a/sim/testsuite/sim/arm/thumb/tst.cgs b/sim/testsuite/sim/arm/thumb/tst.cgs
new file mode 100644
index 0000000..068fccc
--- /dev/null
+++ b/sim/testsuite/sim/arm/thumb/tst.cgs
@@ -0,0 +1,12 @@
+# arm testcase for tst $rd,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global alu_tst
+alu_tst:
+ tst r0,r0
+
+ pass
diff --git a/sim/testsuite/sim/arm/tst.cgs b/sim/testsuite/sim/arm/tst.cgs
new file mode 100644
index 0000000..f071707
--- /dev/null
+++ b/sim/testsuite/sim/arm/tst.cgs
@@ -0,0 +1,36 @@
+# arm testcase for tst${cond}${set-cc?} $rn,$imm12
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global tst_imm
+tst_imm:
+ tst00 pc,0
+
+ pass
+# arm testcase for tst$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftimm}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global tst_reg_imm_shift
+tst_reg_imm_shift:
+ tst00 pc,pc,pc,lsl 0
+
+ pass
+# arm testcase for tst$cond${set-cc?} $rd,$rn,$rm,${operand2-shifttype} ${operand2-shiftreg}
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global tst_reg_reg_shift
+tst_reg_reg_shift:
+ tst00 pc,pc,pc,lsl pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/umlal.cgs b/sim/testsuite/sim/arm/umlal.cgs
new file mode 100644
index 0000000..1c17fb6
--- /dev/null
+++ b/sim/testsuite/sim/arm/umlal.cgs
@@ -0,0 +1,12 @@
+# arm testcase for umlal$cond${set-cc?} $rdlo,$rdhi,$rm,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global umlal
+umlal:
+ umlal00 pc,pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/umull.cgs b/sim/testsuite/sim/arm/umull.cgs
new file mode 100644
index 0000000..a58541c
--- /dev/null
+++ b/sim/testsuite/sim/arm/umull.cgs
@@ -0,0 +1,12 @@
+# arm testcase for umull$cond${set-cc?} $rdlo,$rdhi,$rm,$rs
+# mach: unfinished
+
+ .include "testutils.inc"
+
+ start
+
+ .global umull
+umull:
+ umull00 pc,pc,pc,pc
+
+ pass
diff --git a/sim/testsuite/sim/arm/xscale/blx.cgs b/sim/testsuite/sim/arm/xscale/blx.cgs
new file mode 100644
index 0000000..854647b
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/blx.cgs
@@ -0,0 +1,31 @@
+# arm testcase for bl$cond $offset24
+# mach: all
+
+ .include "testutils.inc"
+
+ start
+
+ .arm
+ blx thumb
+
+ .thumb
+ .thumb_func
+thumb:
+ nop
+ blx next
+ blx PASS
+ nop
+ nop
+
+ .section text1, "ax"
+ .arm
+next:
+ add r0, r1, r0
+ bx lr
+
+FAIL:
+ fail
+PASS:
+ pass
+
+
diff --git a/sim/testsuite/sim/arm/xscale/mia.cgs b/sim/testsuite/sim/arm/xscale/mia.cgs
new file mode 100644
index 0000000..a3f729e
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/mia.cgs
@@ -0,0 +1,35 @@
+# XSCALE testcase for MIA
+# mach: xscale
+# as: -mcpu=xscale
+
+ .include "testutils.inc"
+
+ start
+
+ .global mia
+mia:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ mia acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0x354f53c4
+ test_h_gr r1, 0x4e330b5e
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/xscale/miaph.cgs b/sim/testsuite/sim/arm/xscale/miaph.cgs
new file mode 100644
index 0000000..53fb201
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/miaph.cgs
@@ -0,0 +1,35 @@
+# XSCALE testcase for MIAPH
+# mach: xscale
+# as: -mcpu=xscale
+
+ .include "testutils.inc"
+
+ start
+
+ .global miaph
+miaph:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ miaph acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0xfec3f9f4
+ test_h_gr r1, 0x55667787
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/xscale/miaxy.cgs b/sim/testsuite/sim/arm/xscale/miaxy.cgs
new file mode 100644
index 0000000..624564e
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/miaxy.cgs
@@ -0,0 +1,89 @@
+# XSCALE testcase for MIAxy
+# mach: xscale
+# as: -mcpu=xscale
+
+ .include "testutils.inc"
+
+ start
+
+ .global miaXY
+miaXY:
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ # Test Bottom Bottom Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ miaBB acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0x05f753c4
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Bottom Top Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ miaBT acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0xeeede364
+ test_h_gr r1, 0x55667787
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Top Bottom Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ miaTB acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0x0ec85c04
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ # Test Top Top Multilply Accumulate
+
+ mvi_h_gr r0, 0x11223344
+ mvi_h_gr r1, 0x55667788
+ mvi_h_gr r2, 0x12345678
+ mvi_h_gr r3, 0x9abcdef0
+
+ mar acc0, r0, r1
+
+ miaTT acc0, r2, r3
+
+ mra r0, r1, acc0
+
+ test_h_gr r0, 0x09eed974
+ test_h_gr r1, 0x55667788
+ test_h_gr r2, 0x12345678
+ test_h_gr r3, 0x9abcdef0
+
+ pass
diff --git a/sim/testsuite/sim/arm/xscale/mra.cgs b/sim/testsuite/sim/arm/xscale/mra.cgs
new file mode 100644
index 0000000..be4d9df
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/mra.cgs
@@ -0,0 +1,30 @@
+# XScale testcase for MAR and MRA
+# mach: xscale
+# as: -mcpu=xscale
+
+ .include "testutils.inc"
+
+ start
+
+ .global mar_mra
+mar_mra:
+ mvi_h_gr r2,0
+ mvi_h_gr r3,0
+ mvi_h_gr r4,0x0000EFA0
+ mvi_h_gr r5,0xA0A0A0A0
+
+ # Enable access to CoProcessors 0 & 1 before
+ # we attempt these instructions.
+
+ mvi_h_gr r1, 3
+ mcr p15, 0, r1, cr15, cr1, 0
+
+ mar acc0, r5, r4
+ mra r2, r3, acc0
+
+ test_h_gr r2,0xA0A0A0A0
+ test_h_gr r3,0x0000EFA0
+ test_h_gr r4,0x0000EFA0
+ test_h_gr r5,0xA0A0A0A0
+
+ pass
diff --git a/sim/testsuite/sim/arm/xscale/testutils.inc b/sim/testsuite/sim/arm/xscale/testutils.inc
new file mode 100644
index 0000000..ae49db8
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/testutils.inc
@@ -0,0 +1,118 @@
+# r0-r3 are used as tmps, consider them call clobbered by these macros.
+# This uses the angel rom monitor calls.
+# ??? How do we use the \@ facility of .macros ???
+# @ is the comment char!
+
+ .macro mvi_h_gr reg, val
+ ldr \reg,[pc]
+ b . + 8
+ .word \val
+ .endm
+
+ .macro mvaddr_h_gr reg, addr
+ ldr \reg,[pc]
+ b . + 8
+ .word \addr
+ .endm
+
+ .macro start
+ .data
+failmsg:
+ .asciz "fail\n"
+passmsg:
+ .asciz "pass\n"
+ .text
+
+do_pass:
+ ldr r1, passmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 0
+passmsg_addr:
+ .word passmsg
+
+do_fail:
+ ldr r1, failmsg_addr
+ mov r0, #4
+ swi #0x123456
+ exit 1
+failmsg_addr:
+ .word failmsg
+
+ .global _start
+_start:
+ .endm
+
+# *** Other macros know pass/fail are 4 bytes in size! Yuck.
+
+ .macro pass
+ b do_pass
+ .endm
+
+ .macro fail
+ b do_fail
+ .endm
+
+ .macro exit rc
+ # ??? This works with the ARMulator but maybe not others.
+ #mov r0, #\rc
+ #swi #1
+ # This seems to be portable (though it ignores rc).
+ mov r0,#0x18
+ mvi_h_gr r1, 0x20026
+ swi #0x123456
+ # If that returns, punt with a sigill.
+ stc 0,cr0,[r0]
+ .endm
+
+# Other macros know this only clobbers r0.
+# WARNING: It also clobbers the condition codes (FIXME).
+ .macro test_h_gr reg, val
+ mvaddr_h_gr r0, \val
+ cmp \reg, r0
+ beq . + 8
+ fail
+ .endm
+
+ .macro mvi_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ bic r1, r1, #0xf0000000
+ orr r1, r1, r0
+ msr cpsr, r1
+ # ??? nops needed
+ .endm
+
+# ??? Preserve condition codes?
+ .macro test_h_cnvz c, n, v, z
+ mov r0, #0
+ .if \c
+ orr r0, r0, #0x20000000
+ .endif
+ .if \n
+ orr r0, r0, #0x80000000
+ .endif
+ .if \v
+ orr r0, r0, #0x10000000
+ .endif
+ .if \z
+ orr r0, r0, #0x40000000
+ .endif
+ mrs r1, cpsr
+ and r1, r1, #0xf0000000
+ cmp r0, r1
+ beq . + 8
+ fail
+ .endm
diff --git a/sim/testsuite/sim/arm/xscale/xscale.exp b/sim/testsuite/sim/arm/xscale/xscale.exp
new file mode 100644
index 0000000..3756929
--- /dev/null
+++ b/sim/testsuite/sim/arm/xscale/xscale.exp
@@ -0,0 +1,28 @@
+# XSCALE simulator testsuite.
+
+if { [istarget xscale*-*-*] } {
+ # load support procs (none yet)
+ # load_lib cgen.exp
+
+ # all machines
+ set all_machs "xscale"
+
+ if [is_remote host] {
+ remote_download host $srcdir/$subdir/testutils.inc
+ }
+
+ # The .cgs suffix is for "cgen .s".
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+
+ run_sim_test $src $all_machs
+ }
+
+ if [is_remote host] {
+ remote_file host delete testutils.inc
+ }
+}