diff options
author | nobody <> | 2003-05-04 03:57:41 +0000 |
---|---|---|
committer | nobody <> | 2003-05-04 03:57:41 +0000 |
commit | d61035147949d9ba7f2cb711df51060ff2193c54 (patch) | |
tree | c1250cf6eb34e506ebf998ac2e3611c19bb2351a | |
parent | 291862d73dc6b445dae7638c7490d74473dea27c (diff) | |
download | gdb-carlton_dictionary-20030430-merge.zip gdb-carlton_dictionary-20030430-merge.tar.gz gdb-carlton_dictionary-20030430-merge.tar.bz2 |
This commit was manufactured by cvs2svn to create tagcarlton_dictionary-20030430-merge
'carlton_dictionary-20030430-merge'.
Sprout from kettenis_i386newframe-20030419-branch 2003-04-19 14:43:51 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from kettenis_i386newframe-20030419-branch 2003-05-04 03:57:40 UTC nobody 'This commit was manufactured by cvs2svn to create branch':
bfd/elf32-m68hc1x.c
bfd/elf32-m68hc1x.h
gdb/infcall.h
Cherrypick from master 2003-04-30 22:01:38 UTC Andrew Cagney <cagney@redhat.com> '2003-04-30 Andrew Cagney <cagney@redhat.com>':
ChangeLog
Makefile.in
Makefile.tpl
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/archures.c
bfd/bfd-in2.h
bfd/coff-h8300.c
bfd/coffcode.h
bfd/configure
bfd/configure.in
bfd/cpu-h8300.c
bfd/cpu-sh.c
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-h8300.c
bfd/elf32-i386.c
bfd/elf32-m68hc11.c
bfd/elf32-m68hc12.c
bfd/elf32-ppc.c
bfd/elf32-sh.c
bfd/elf32-sh64-com.c
bfd/elf32-sh64.c
bfd/elf64-alpha.c
bfd/elf64-sh64.c
bfd/elflink.h
bfd/elfxx-ia64.c
bfd/reloc.c
bfd/section.c
bfd/version.h
config-ml.in
gdb/ChangeLog
gdb/Makefile.in
gdb/ada-lang.c
gdb/ada-valprint.c
gdb/alpha-nat.c
gdb/alpha-tdep.c
gdb/alpha-tdep.h
gdb/alphabsd-nat.c
gdb/alphanbsd-tdep.c
gdb/arch-utils.c
gdb/arch-utils.h
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/blockframe.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/config/djgpp/fnchange.lst
gdb/config/ia64/tm-ia64.h
gdb/config/pa/tm-hppa.h
gdb/config/pa/tm-hppa64.h
gdb/config/s390/tm-s390.h
gdb/config/sparc/tm-sp64.h
gdb/config/sparc/tm-sparc.h
gdb/config/vax/nm-vax.h
gdb/corefile.c
gdb/cp-support.c
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/disasm.c
gdb/doc/ChangeLog
gdb/doc/gdbint.texinfo
gdb/dummy-frame.c
gdb/dwarf2loc.c
gdb/eval.c
gdb/frame.c
gdb/frame.h
gdb/frv-tdep.c
gdb/gcore.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbserver/ChangeLog
gdb/gdbserver/low-nbsd.c
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/infcall.c
gdb/infcmd.c
gdb/inferior.h
gdb/linespec.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/mcore-tdep.c
gdb/mips-nat.c
gdb/mips-tdep.c
gdb/mipsv4-nat.c
gdb/mn10300-tdep.c
gdb/nlm/i386.c
gdb/nlm/i386.h
gdb/ns32k-tdep.c
gdb/ns32knbsd-nat.c
gdb/objc-lang.c
gdb/printcmd.c
gdb/procfs.c
gdb/regcache.c
gdb/remote-e7000.c
gdb/remote-mips.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/scm-lang.c
gdb/sh-tdep.c
gdb/sparc-tdep.c
gdb/std-regs.c
gdb/symtab.c
gdb/target.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/signals.exp
gdb/testsuite/gdb.c++/maint.exp
gdb/tui/ChangeLog
gdb/tui/tuiDisassem.c
gdb/v850-tdep.c
gdb/valarith.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/bfdlink.h
include/coff/ChangeLog
include/coff/h8300.h
include/elf/ChangeLog
include/elf/common.h
include/elf/h8.h
libiberty/ChangeLog
libiberty/vsnprintf.c
opcodes/ChangeLog
opcodes/fr30-desc.c
opcodes/fr30-desc.h
opcodes/fr30-opc.c
opcodes/fr30-opc.h
opcodes/frv-desc.c
opcodes/frv-desc.h
opcodes/frv-opc.c
opcodes/frv-opc.h
opcodes/ip2k-desc.c
opcodes/ip2k-desc.h
opcodes/ip2k-opc.c
opcodes/ip2k-opc.h
opcodes/m32r-desc.c
opcodes/m32r-desc.h
opcodes/m32r-opc.c
opcodes/m32r-opc.h
opcodes/m32r-opinst.c
opcodes/openrisc-desc.c
opcodes/openrisc-desc.h
opcodes/openrisc-opc.c
opcodes/openrisc-opc.h
opcodes/xstormy16-desc.c
opcodes/xstormy16-desc.h
opcodes/xstormy16-opc.c
opcodes/xstormy16-opc.h
159 files changed, 6128 insertions, 4386 deletions
@@ -1,3 +1,8 @@ +2003-04-27 Daniel Jacobowitz <drow@mvista.com> + + * Makefile.tpl: Clean $(BUILD_SUBDIR). + * Makefile.in: Regenerated. + 2003-04-18 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> * Makefile.tpl (MAKEINFOFLAGS): Default to --split-size=5000000. diff --git a/Makefile.in b/Makefile.in index 1b993f5..754329e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1112,6 +1112,7 @@ local-distclean: -if [ "$(TARGET_SUBDIR)" != "." ]; then \ rm -rf $(TARGET_SUBDIR); \ else true; fi + -rm -rf $(BUILD_SUBDIR) -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile -rm -f texinfo/doc/Makefile texinfo/po/POTFILES -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null diff --git a/Makefile.tpl b/Makefile.tpl index 314c449..018f18f 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -672,6 +672,7 @@ local-distclean: -if [ "$(TARGET_SUBDIR)" != "." ]; then \ rm -rf $(TARGET_SUBDIR); \ else true; fi + -rm -rf $(BUILD_SUBDIR) -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile -rm -f texinfo/doc/Makefile texinfo/po/POTFILES -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0004267..34883f6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,193 @@ +2003-04-30 Nick Clifton <nickc@redhat.com> + + * elf32-h8300.c (elf32_h8_relax_section): Do not crash when + encountering relocs against the *ABS* section. + +2003-04-28 H.J. Lu <hjl@gnu.org> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during + the relax finalize pass. + + * section.c (struct sec): Add need_finalize_relax and remove + flag11. + (STD_SECTION): Update struct sec initializer. + * bfd-in2.h: Regenerated. + +2003-04-28 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_merge_symbol): Call elf_backend_copy_indirect_symbol + to copy any information related to dynamic linking when we flip + the indirection. + +2003-04-27 H.J. Lu <hjl@gnu.org> + + * elf-bfd.h (ELF_LINK_DYNAMIC_DEF): New. + (ELF_LINK_DYNAMIC_WEAK): New. + + * elflink.h (elf_merge_symbol): Add one argument to indicate if + a symbol should be skipped. Ignore definitions in dynamic + objects for symbols with non-default visibility. + (elf_add_default_symbol): Adjusted. + (elf_link_add_object_symbols): Check if a symbol should be + skipped. Don't merge the visibility field with the one from + a dynamic object. + (elf_link_check_versioned_symbol): Use undef_bfd. + (elf_link_output_extsym): Warn if a forced local symbol is + referenced from dynamic objects. Make non-weak undefined symbol + with non-default visibility a fatal error. + +2003-04-27 Daniel Jacobowitz <drow@mvista.com> + + * configure.in: Bump version on HEAD to 2.14.90. + * configure: Regenerated. + +2003-04-26 Stephane Carrez <stcarrez@nerim.fr> + + PR savannah/3331: + * elf32-m68hc11.c (m68hc11_elf_relax_section): Clear prev_insn_group + when we couldn't relax something. + +2003-04-25 Alan Modra <amodra@bigpond.net.au> + + * elflink.h (elf_merge_symbol): When we find a regular definition + for an indirect symbol, flip the indirection so that the old + direct symbol now points to the new definition. + +2003-04-24 Roland McGrath <roland@redhat.com> + + * elf.c (bfd_section_from_phdr): Map PT_GNU_EH_FRAME to "eh_frame_hdr". + +2003-04-24 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c: Formatting and comment fixes. + (ELIMINATE_COPY_RELOCS): Move before ppc_elf_copy_indirect_symbol. + (ppc_elf_copy_indirect_symbol): Copy flags here for weakdefs. + +2003-04-24 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * archures.c (bfd_mach_h8300hn, bfd_mach_h8300sn): Added. + * bfd-in2.h: Rebuilt. + * coff-h8300.c (BADMAG): Add check for H8300HNBADMAG & H8300SNBADMAG. + * coffcode.h (coff_set_arch_mach_hook): Add case for H8300HNMAGIC + & H8300SNMAGIC. + (coff_set_flags): Add case for bfd_mach_h8300hn & bfd_mach_h8300sn. + * cpu-h8300.c (h8300_scan): Handle h8300hn, h8300sn. + (h8300sn_info_struct, h8300hn_info_struct): New. + * elf32-h8300.c (elf32_h8_mach): Handle case for h8300hn & h8300sn + (elf32_h8_final_write_processing): Likewise. + +2003-04-23 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * elf32-sh.c (tpoff): New. + (struct elf_sh_dyn_relocs): Remove tls_tpoff32. + (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO. + (allocate_dynrelocs): Don't make unnecessary dynamic TLS + relocations. Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses. + (sh_elf_relocate_section): Likewise. Remove unnecessary tests. + (dtpoff_base): Fix wrong indentation. + (sh_elf_check_relocs): Don't set DF_STATIC_TLS flag with non-TLS + relocations. Don't set tls_tpoff32 flag. Don't make unnecessary + R_SH_TLS_TPOFF32 relocations. + +2003-04-23 J"orn Rennecke <joern.rennecke@superh.com> + + * archures.c (enum bfd_architecture): Amend comment to refer to SuperH. + * cpu-sh.c: Likewise. + * elf32-sh.c: Likewise. + * reloc.c (bfd_reloc_code_real): Likewise. + * elf32-sh64-com.c: Change comment to refer to SuperH. + * elf32-sh64.c: Likewise. + * elf64-sh64.c: Likewise. + * bfd-in2.h (enum bfd_architecture): Regenerate. + +2003-04-23 Alan Modra <amodra@bigpond.net.au> + + From Julien LEMOINE <speedblue@debian.org> + * elf32-i386.c (elf_i386_info_to_howto): Delete. + (elf_info_to_howto): Define as elf_i386_info_to_howto_rel. + +2003-04-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * archures.c: Replace references to Mitsubishi M32R with references + to Renesas M32R. + * relocs.c: Likewise. + * bfd-in2.h: Regenerate. + +2003-04-21 Richard Henderson <rth@redhat.com> + + * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Return false for an + executable when a symbol is defined both regular and dynamic. + +2003-04-21 Stephane Carrez <stcarrez@nerim.fr> + + * Makefile.am (BFD32_BACKENDS): Add elf32-m68hc1x.lo. + (elf32-m68hc1x.lo): Update dependencies + * configure.in: Add elf32-m68hc1x.lo. + * configure: Rebuild. + * Makefile.in: Rebuild. + +2003-04-21 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc1x.c: New file (from elf32-m68hc11.c and elf32-m68hc12.c) + (m68hc11_elf_hash_table_create): New function. + (elf32_m68hc11_link_hash_table_free): New function. + (stub_hash_newfunc): New function. + (m68hc11_add_stub): New function. + (elf32_m68hc11_add_symbol_hook): New function. + (elf32_m68hc11_setup_section_lists): New function. + (elf32_m68hc11_next_input_section): New function. + (elf32_m68hc11_size_stubs): New function. + (elf32_m68hc11_build_stubs): New function. + (m68hc11_get_relocation_value): New function. + (elf32_m68hc11_relocate_section): Call the above to redirect + some relocations to the trampoline code. + (m68hc11_elf_export_one_stub): New function. + (m68hc11_elf_set_symbol): New function. + (elf32_m68hc11_build_stubs): Call it via bfd_hash_traverse. + (m68hc11_elf_get_bank_parameters): Get parameters only when the info + is not yet initialized. + + * elf32-m68hc1x.h: New file (from elf32-m68hc11.c and elf32-m68hc12.c) + (elf32_m68hc11_stub_hash_entry): New struct. + (m68hc11_page_info): Add trampoline handler address. + (m68hc11_elf_link_hash_table): Add stubs generation members. + (elf32_m68hc11_add_symbol_hook): Declare. + (elf32_m68hc11_setup_section_lists): Declare. + (elf32_m68hc11_size_stubs): Declare. + (elf32_m68hc11_build_stubs): Declare. + + * elf32-m68hc11.c (m68hc11_elf_ignore_reloc): Move to elf32-m68hc1x.c. + (elf32_m68hc11_gc_mark_hook, elf32_m68hc11_gc_sweep_hook): Likewise. + (elf32_m68hc11_check_relocs, elf32_m68hc11_relocate_section): Ditto. + (_bfd_m68hc11_elf_set_private_flags): Ditto. + (_bfd_m68hc11_elf_merge_private_bfd_data): Ditto. + (_bfd_m68hc11_elf_print_private_bfd_data): Ditto. + (bfd_elf32_bfd_link_hash_table_create): Define. + (elf_backend_add_symbol_hook): Define. + (m68hc11_elf_bfd_link_hash_table_create): New function. + (m68hc11_elf_build_one_stub): New function. + (m68hc11_elf_size_one_stub): New function. + (m68hc11_elf_bfd_link_hash_table_create): Install the above. + (bfd_elf32_bfd_link_hash_table_create): Define. + + * elf32-m68hc12.c (m68hc11_elf_ignore_reloc): Remove. + (m68hc12_addr_is_banked): Remove, use m68hc11_addr_is_banked. + (m68hc12_phys_addr): Ditto. + (m68hc12_phys_page): Ditto. + (m68hc12_elf_special_reloc): Move to elf32-m68hc1x.c. + (elf32_m68hc11_gc_mark_hook): Likewise. + (elf32_m68hc11_gc_sweep_hook): Likewise. + (elf32_m68hc11_check_relocs): Likewise. + (elf32_m68hc11_relocate_section): Likewise. + (_bfd_m68hc12_elf_set_private_flags): Likewise. + (_bfd_m68hc12_elf_merge_private_bfd_data): Likewise. + (_bfd_m68hc12_elf_print_private_bfd_data): Likewise. + (m68hc12_elf_build_one_stub): New function. + (m68hc12_elf_size_one_stub): New function. + (m68hc12_elf_bfd_link_hash_table_create): New function, use the above. + (elf_backend_add_symbol_hook): Define. + (elf_m68hc11_howto_table): Use TRUE for pcrel relocs; fix masks. + 2003-04-18 Nick Clifton <nickc@redhat.com> * format.c (bfd_check_format_matches): Only check associated @@ -147,33 +337,33 @@ 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. + * 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> @@ -198,7 +388,7 @@ 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. @@ -250,7 +440,7 @@ * 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 @@ -277,7 +467,7 @@ 2003-03-25 Stan Cox <scox@redhat.com> Nick Clifton <nickc@redhat.com> - + Contribute support for Intel's iWMMXt chip - an ARM variant: * archures.c: Add bfd_mach_arm_iWMMXt. @@ -332,8 +522,8 @@ 2003-03-18 Richard Henderson <rth@redhat.com> - * elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for - local symbols that have no dyninfo. + * elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for + local symbols that have no dyninfo. 2003-03-14 Gene Smith <gene.smith@siemens.com> @@ -509,7 +699,7 @@ (elfNN_ia64_relax_section): Handle LTOFF22X, LDXMOV. (elfNN_ia64_choose_gp): Split out from ... (elfNN_ia64_final_link): ... here. - + 2003-02-27 Andrew Cagney <cagney@redhat.com> * bfd.c (struct bfd): Rename "struct _bfd". diff --git a/bfd/Makefile.am b/bfd/Makefile.am index ee04261..5ecaa5b 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -231,6 +231,7 @@ BFD32_BACKENDS = \ elf32-m32r.lo \ elf32-m68hc11.lo \ elf32-m68hc12.lo \ + elf32-m68hc1x.lo \ elf32-m68k.lo \ elf32-m88k.lo \ elf-m10200.lo \ @@ -394,6 +395,7 @@ BFD32_BACKENDS_CFILES = \ elf32-m68k.c \ elf32-m68hc11.c \ elf32-m68hc12.c \ + elf32-m68hc1x.c \ elf32-m88k.c \ elf-m10200.c \ elf-m10300.c \ @@ -1206,12 +1208,16 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ - elf32-target.h + elf32-target.h elf32-m68hc1x.h +elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 3de6121..87c96ed 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -358,6 +358,7 @@ BFD32_BACKENDS = \ elf32-m32r.lo \ elf32-m68hc11.lo \ elf32-m68hc12.lo \ + elf32-m68hc1x.lo \ elf32-m68k.lo \ elf32-m88k.lo \ elf-m10200.lo \ @@ -522,6 +523,7 @@ BFD32_BACKENDS_CFILES = \ elf32-m68k.c \ elf32-m68hc11.c \ elf32-m68hc12.c \ + elf32-m68hc1x.c \ elf32-m88k.c \ elf-m10200.c \ elf-m10300.c \ @@ -1739,12 +1741,17 @@ elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-m68hc1x.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ - elf32-target.h + elf32-target.h elf32-m68hc1x.h +elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68hc11.h \ + elf32-target.h elf32-m68hc1x.h elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf32-target.h diff --git a/bfd/archures.c b/bfd/archures.c index 20087b2..3d473c3 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -164,9 +164,11 @@ DESCRIPTION . bfd_arch_m98k, {* Motorola 98xxx *} . bfd_arch_pyramid, {* Pyramid Technology *} . bfd_arch_h8300, {* Renesas H8/300 (formerly Hitachi H8/300) *} -.#define bfd_mach_h8300 1 -.#define bfd_mach_h8300h 2 -.#define bfd_mach_h8300s 3 +.#define bfd_mach_h8300 1 +.#define bfd_mach_h8300h 2 +.#define bfd_mach_h8300s 3 +.#define bfd_mach_h8300hn 4 +.#define bfd_mach_h8300sn 5 . bfd_arch_pdp11, {* DEC PDP-11 *} . bfd_arch_powerpc, {* PowerPC *} .#define bfd_mach_ppc 32 @@ -209,7 +211,7 @@ DESCRIPTION .#define bfd_mach_z8001 1 .#define bfd_mach_z8002 2 . bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *} -. bfd_arch_sh, {* Renesas SH (formerly Hitachi SH) *} +. bfd_arch_sh, {* Renesas / SuperH SH (formerly Hitachi SH) *} .#define bfd_mach_sh 1 .#define bfd_mach_sh2 0x20 .#define bfd_mach_sh_dsp 0x2d @@ -253,7 +255,7 @@ DESCRIPTION .#define bfd_mach_arc_6 6 .#define bfd_mach_arc_7 7 .#define bfd_mach_arc_8 8 -. bfd_arch_m32r, {* Mitsubishi M32R/D *} +. bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *} .#define bfd_mach_m32r 1 {* For backwards compatibility. *} .#define bfd_mach_m32rx 'x' . bfd_arch_mn10200, {* Matsushita MN10200 *} diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index d349f77..9b6b5a3 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1291,8 +1291,10 @@ typedef struct sec /* Bits used by various backends. */ unsigned int has_tls_reloc:1; + /* Nonzero if this section needs the relax finalize pass. */ + unsigned int need_finalize_relax:1; + /* Usused bits. */ - unsigned int flag11:1; unsigned int flag12:1; unsigned int flag13:1; unsigned int flag14:1; @@ -1630,9 +1632,11 @@ enum bfd_architecture bfd_arch_m98k, /* Motorola 98xxx */ bfd_arch_pyramid, /* Pyramid Technology */ bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */ -#define bfd_mach_h8300 1 -#define bfd_mach_h8300h 2 -#define bfd_mach_h8300s 3 +#define bfd_mach_h8300 1 +#define bfd_mach_h8300h 2 +#define bfd_mach_h8300s 3 +#define bfd_mach_h8300hn 4 +#define bfd_mach_h8300sn 5 bfd_arch_pdp11, /* DEC PDP-11 */ bfd_arch_powerpc, /* PowerPC */ #define bfd_mach_ppc 32 @@ -1675,7 +1679,7 @@ enum bfd_architecture #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ - bfd_arch_sh, /* Renesas SH (formerly Hitachi SH) */ + bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */ #define bfd_mach_sh 1 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d @@ -1719,7 +1723,7 @@ enum bfd_architecture #define bfd_mach_arc_6 6 #define bfd_mach_arc_7 7 #define bfd_mach_arc_8 8 - bfd_arch_m32r, /* Mitsubishi M32R/D */ + bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ #define bfd_mach_m32r 1 /* For backwards compatibility. */ #define bfd_mach_m32rx 'x' bfd_arch_mn10200, /* Matsushita MN10200 */ @@ -2598,7 +2602,7 @@ field in the instruction. */ BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, -/* Renesas SH relocs. Not all of these appear in object files. */ +/* Renesas / SuperH SH relocs. Not all of these appear in object files. */ BFD_RELOC_SH_PCDISP8BY2, BFD_RELOC_SH_PCDISP12BY2, BFD_RELOC_SH_IMM4, @@ -2776,7 +2780,7 @@ of the container. */ /* DLX relocs */ BFD_RELOC_DLX_JMP26, -/* Mitsubishi M32R relocs. +/* Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit absolute address. */ BFD_RELOC_M32R_24, diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index dab7e01..ac09153 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -281,8 +281,9 @@ static reloc_howto_type howto_table[] = { #define SELECT_RELOC(x,howto) \ { x.r_type = select_reloc (howto); } -#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x)) -#define H8300 1 /* Customize coffcode.h */ +#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x) \ + && H8300HNBADMAG(x) && H8300SNBADMAG(x)) +#define H8300 1 /* Customize coffcode.h */ #define __A_MAGIC_SET__ /* Code to swap in the reloc. */ diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 5c6c286..31338ee 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2071,7 +2071,7 @@ coff_set_arch_mach_hook (abfd, filehdr) case H8300MAGIC: arch = bfd_arch_h8300; machine = bfd_mach_h8300; - /* !! FIXME this probably isn't the right place for this */ + /* !! FIXME this probably isn't the right place for this. */ abfd->flags |= BFD_IS_RELAXABLE; break; #endif @@ -2080,7 +2080,7 @@ coff_set_arch_mach_hook (abfd, filehdr) case H8300HMAGIC: arch = bfd_arch_h8300; machine = bfd_mach_h8300h; - /* !! FIXME this probably isn't the right place for this */ + /* !! FIXME this probably isn't the right place for this. */ abfd->flags |= BFD_IS_RELAXABLE; break; #endif @@ -2089,7 +2089,25 @@ coff_set_arch_mach_hook (abfd, filehdr) case H8300SMAGIC: arch = bfd_arch_h8300; machine = bfd_mach_h8300s; - /* !! FIXME this probably isn't the right place for this */ + /* !! FIXME this probably isn't the right place for this. */ + abfd->flags |= BFD_IS_RELAXABLE; + break; +#endif + +#ifdef H8300HNMAGIC + case H8300HNMAGIC: + arch = bfd_arch_h8300; + machine = bfd_mach_h8300hn; + /* !! FIXME this probably isn't the right place for this. */ + abfd->flags |= BFD_IS_RELAXABLE; + break; +#endif + +#ifdef H8300SNMAGIC + case H8300SNMAGIC: + arch = bfd_arch_h8300; + machine = bfd_mach_h8300sn; + /* !! FIXME this probably isn't the right place for this. */ abfd->flags |= BFD_IS_RELAXABLE; break; #endif @@ -2739,6 +2757,12 @@ coff_set_flags (abfd, magicp, flagsp) case bfd_mach_h8300s: *magicp = H8300SMAGIC; return TRUE; + case bfd_mach_h8300hn: + *magicp = H8300HNMAGIC; + return TRUE; + case bfd_mach_h8300sn: + *magicp = H8300SNMAGIC; + return TRUE; } break; #endif diff --git a/bfd/configure b/bfd/configure index ad1475d..a3a9671 100755 --- a/bfd/configure +++ b/bfd/configure @@ -1129,7 +1129,7 @@ fi PACKAGE=bfd -VERSION=2.13.90 +VERSION=2.14.90 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -6113,8 +6113,8 @@ do bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; - bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;; - bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;; + bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;; + bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;; bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;; bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; diff --git a/bfd/configure.in b/bfd/configure.in index 347ad97..a2b56d2 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -7,7 +7,7 @@ AC_INIT(libbfd.c) AC_CANONICAL_SYSTEM AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.13.90) +AM_INIT_AUTOMAKE(bfd, 2.14.90) # Uncomment the next line to remove the date from the reported bfd version #is_release=y @@ -597,8 +597,8 @@ do bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; - bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;; - bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;; + bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32-m68hc1x.lo elf32.lo $elf" ;; + bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32-m68hc1x.lo elf32.lo $elf" ;; bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;; bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;; bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index daef763..2a5c604 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -69,16 +69,22 @@ h8300_scan (info, string) if (*string == 'h' || *string == 'H') { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300hn); + return (info->mach == bfd_mach_h8300h); } else if (*string == 's' || *string == 'S') { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300sn); + return (info->mach == bfd_mach_h8300s); } else - { - return info->mach == bfd_mach_h8300; - } + return info->mach == bfd_mach_h8300; } /* This routine is provided two arch_infos and works out the machine @@ -97,33 +103,66 @@ compatible (in, out) return in; } +static const bfd_arch_info_type h8300sn_info_struct = +{ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300sn, + "h8300sn", /* Architecture name. */ + "h8300sn", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + 0 +}; + + +static const bfd_arch_info_type h8300hn_info_struct = +{ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300hn, + "h8300hn", /* Architecture name. */ + "h8300hn", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + &h8300sn_info_struct +}; + static const bfd_arch_info_type h8300s_info_struct = { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ bfd_arch_h8300, bfd_mach_h8300s, - "h8300s", /* arch_name */ - "h8300s", /* printable name */ + "h8300s", /* Architecture name. */ + "h8300s", /* Printable name. */ 1, - FALSE, /* the default machine */ + FALSE, /* The default machine. */ compatible, h8300_scan, - 0 + & h8300hn_info_struct }; static const bfd_arch_info_type h8300h_info_struct = { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ - 8, /* 8 bits in a byte */ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ bfd_arch_h8300, bfd_mach_h8300h, - "h8300h", /* arch_name */ - "h8300h", /* printable name */ + "h8300h", /* Architecture name. */ + "h8300h", /* Printable name. */ 1, - FALSE, /* the default machine */ + FALSE, /* The default machine. */ compatible, h8300_scan, &h8300s_info_struct @@ -131,15 +170,15 @@ static const bfd_arch_info_type h8300h_info_struct = const bfd_arch_info_type bfd_h8300_arch = { - 16, /* 16 bits in a word */ - 16, /* 16 bits in an address */ - 8, /* 8 bits in a byte */ + 16, /* 16 bits in a word. */ + 16, /* 16 bits in an address. */ + 8, /* 8 bits in a byte. */ bfd_arch_h8300, bfd_mach_h8300, - "h8300", /* arch_name */ - "h8300", /* printable name */ + "h8300", /* Architecture name. */ + "h8300", /* Printable name. */ 1, - TRUE, /* the default machine */ + TRUE, /* The default machine. */ compatible, h8300_scan, &h8300h_info_struct diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c index fc4bf42..e247cb8 100644 --- a/bfd/cpu-sh.c +++ b/bfd/cpu-sh.c @@ -1,4 +1,4 @@ -/* BFD library support routines for the Renesas SH architecture. +/* BFD library support routines for the Renesas / SuperH SH architecture. Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 2e5587c..f15353c 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -204,6 +204,10 @@ struct elf_link_hash_entry /* Symbol is referenced by a non-GOT/non-PLT relocation. This is not currently set by all the backends. */ #define ELF_LINK_NON_GOT_REF 010000 + /* Symbol has a definition in a shared object. */ +#define ELF_LINK_DYNAMIC_DEF 020000 + /* Symbol is weak in all shared objects. */ +#define ELF_LINK_DYNAMIC_WEAK 040000 }; /* Records local symbols to be emitted in the dynamic symbol table. */ @@ -2292,6 +2292,10 @@ bfd_section_from_phdr (abfd, hdr, index) case PT_PHDR: return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "phdr"); + case PT_GNU_EH_FRAME: + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, + "eh_frame_hdr"); + default: /* Check for any processor-specific program segment types. If no handler for them, default to making "segment" sections. */ @@ -4778,7 +4782,7 @@ copy_private_bfd_data (ibfd, obfd) section = section->next) if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed)) ++section_count; - + /* Allocate a segment map big enough to contain all of the sections we have selected. */ amt = sizeof (struct elf_segment_map); @@ -5458,11 +5462,11 @@ swap_out_syms (abfd, sttp, relocatable_p) 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_set_error (bfd_error_invalid_operation); _bfd_stringtab_free (stt); return FALSE; } - + shndx = _bfd_elf_section_from_bfd_section (abfd, sec2); BFD_ASSERT (shndx != -1); } @@ -7071,7 +7075,7 @@ elfcore_grok_nto_note (abfd, note) Elf_Internal_Note *note; { /* Every GREG section has a STATUS section before it. Store the - tid from the previous call to pass down to the next gregs + tid from the previous call to pass down to the next gregs function. */ static pid_t tid = 1; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index c79688a..e43ed9d 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -573,6 +573,12 @@ elf32_h8_mach (flags) case E_H8_MACH_H8300S: return bfd_mach_h8300s; + + case E_H8_MACH_H8300HN: + return bfd_mach_h8300hn; + + case E_H8_MACH_H8300SN: + return bfd_mach_h8300sn; } } @@ -601,6 +607,14 @@ elf32_h8_final_write_processing (abfd, linker) case bfd_mach_h8300s: val = E_H8_MACH_H8300S; break; + + case bfd_mach_h8300hn: + val = E_H8_MACH_H8300HN; + break; + + case bfd_mach_h8300sn: + val = E_H8_MACH_H8300SN; + break; } elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH); @@ -764,9 +778,12 @@ elf32_h8_relax_section (abfd, sec, link_info, again) isym = isymbuf + ELF32_R_SYM (irel->r_info); sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); - symval = (isym->st_value - + sym_sec->output_section->vma - + sym_sec->output_offset); + symval = isym->st_value; + /* If the reloc is absolute, it will not have + a symbol or section associated with it. */ + if (sym_sec) + symval += sym_sec->output_section->vma + + sym_sec->output_offset; } else { @@ -1068,6 +1085,7 @@ elf32_h8_relax_section (abfd, sec, link_info, again) && value >= 0xffff00 && value <= 0xffffff)) { + bfd_boolean skip = FALSE; unsigned char code; /* Note that we've changed the relocs, section contents, @@ -1085,16 +1103,27 @@ elf32_h8_relax_section (abfd, sec, link_info, again) code = bfd_get_8 (abfd, contents + irel->r_offset - 1); - if ((code & 0xf0) == 0x00) - bfd_put_8 (abfd, - (code & 0xf) | 0x20, - contents + irel->r_offset - 2); - else if ((code & 0xf0) == 0x80) - bfd_put_8 (abfd, - (code & 0xf) | 0x30, - contents + irel->r_offset - 2); - else - abort (); + switch (code & 0xf0) + { + case 0x00: + bfd_put_8 (abfd, (code & 0xf) | 0x20, + contents + irel->r_offset - 2); + break; + case 0x80: + bfd_put_8 (abfd, (code & 0xf) | 0x30, + contents + irel->r_offset - 2); + break; + case 0x20: + case 0xa0: + /* Skip 32bit versions. */ + skip = TRUE; + break; + default: + abort (); + } + + if (skip) + break; /* Fix the relocation's type. */ irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index eae3190..4f6bd80 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -26,8 +26,6 @@ static reloc_howto_type *elf_i386_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void elf_i386_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); static void elf_i386_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); static bfd_boolean elf_i386_is_local_label_name @@ -373,15 +371,6 @@ elf_i386_reloc_type_lookup (abfd, code) } static void -elf_i386_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; -{ - abort (); -} - -static void elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) bfd *abfd ATTRIBUTE_UNUSED; arelent *cache_ptr; @@ -3367,7 +3356,8 @@ elf_i386_finish_dynamic_sections (output_bfd, info) #define elf_backend_got_header_size 12 #define elf_backend_plt_header_size PLT_ENTRY_SIZE -#define elf_info_to_howto elf_i386_info_to_howto +/* Support RELA for objdump of prelink objects. */ +#define elf_info_to_howto elf_i386_info_to_howto_rel #define elf_info_to_howto_rel elf_i386_info_to_howto_rel #define bfd_elf32_mkobject elf_i386_mkobject diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 26fa393..bb0f9e9 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -24,29 +24,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" +#include "elf32-m68hc1x.h" #include "elf/m68hc11.h" +#include "opcode/m68hc11.h" +/* Relocation functions. */ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static void m68hc11_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_reloc_status_type m68hc11_elf_ignore_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); - -/* GC mark and sweep. */ -static asection *elf32_m68hc11_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf32_m68hc11_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf32_m68hc11_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf32_m68hc11_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +/* Trampoline generation. */ +static bfd_boolean m68hc11_elf_size_one_stub + PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); +static bfd_boolean m68hc11_elf_build_one_stub + PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); +static struct bfd_link_hash_table* m68hc11_elf_bfd_link_hash_table_create + PARAMS ((bfd* abfd)); + +/* Linker relaxation. */ static bfd_boolean m68hc11_elf_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); static void m68hc11_elf_relax_delete_bytes @@ -56,18 +52,14 @@ static void m68hc11_relax_group unsigned long, unsigned long)); static int compare_reloc PARAMS ((const void *, const void *)); - -bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); -bfd_boolean _bfd_m68hc11_elf_set_private_flags PARAMS ((bfd *, flagword)); -bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); - /* Use REL instead of RELA to save space */ #define USE_REL 1 -/* The Motorola 68HC11 microcontroler only addresses 64Kb. +/* The Motorola 68HC11 microcontroller only addresses 64Kb but we also + support a memory bank switching mechanism similar to 68HC12. We must handle 8 and 16-bit relocations. The 32-bit relocation - is defined but not used except by gas when -gstabs is used (which - is wrong). + are used for debugging sections (DWARF2) to represent a virtual + address. The 3-bit and 16-bit PC rel relocation is only used by 68HC12. */ static reloc_howto_type elf_m68hc11_howto_table[] = { /* This reloc does nothing. */ @@ -367,25 +359,6 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return NULL; } -/* This function is used for relocs which are only used for relaxing, - which the linker should otherwise ignore. */ - -static bfd_reloc_status_type -m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd != NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; -} - /* Set the howto pointer for an M68HC11 ELF reloc. */ static void @@ -401,50 +374,106 @@ m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; } -static asection * -elf32_m68hc11_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)) - { - 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; + +/* Far trampoline generation. */ - default: - break; - } - } - } - else - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); +/* Build a 68HC11 trampoline stub. */ +static bfd_boolean +m68hc11_elf_build_one_stub (gen_entry, in_arg) + struct bfd_hash_entry *gen_entry; + PTR in_arg; +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value, phys_page, phys_addr; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + info = (struct bfd_link_info *) in_arg; + + htab = m68hc11_elf_hash_table (info); + + stub_sec = stub_entry->stub_sec; + + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->_raw_size; + stub_sec->_raw_size += 10; + loc = stub_sec->contents + stub_entry->stub_offset; + + stub_bfd = stub_sec->owner; + + /* Create the trampoline call stub: + + pshb + ldab #%page(symbol) + ldy #%addr(symbol) + jmp __trampoline + + */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + phys_addr = m68hc11_phys_addr (&htab->pinfo, sym_value); + phys_page = m68hc11_phys_page (&htab->pinfo, sym_value); + + /* pshb; ldab #%page(sym) */ + bfd_put_8 (stub_bfd, 0x37, loc); + bfd_put_8 (stub_bfd, 0xC6, loc + 1); + bfd_put_8 (stub_bfd, phys_page, loc + 2); + loc += 3; + + /* ldy #%addr(sym) */ + bfd_put_8 (stub_bfd, 0x18, loc); + bfd_put_8 (stub_bfd, 0xCE, loc + 1); + bfd_put_16 (stub_bfd, phys_addr, loc + 2); + loc += 4; + + /* jmp __trampoline */ + bfd_put_8 (stub_bfd, 0x7E, loc); + bfd_put_16 (stub_bfd, htab->pinfo.trampoline_addr, loc + 1); - return NULL; + return TRUE; } +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ + static bfd_boolean -elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +m68hc11_elf_size_one_stub (gen_entry, in_arg) + struct bfd_hash_entry *gen_entry; + PTR in_arg ATTRIBUTE_UNUSED; { - /* We don't use got and plt entries for 68hc11/68hc12. */ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + stub_entry->stub_sec->_raw_size += 10; return TRUE; } +/* Create a 68HC11 ELF linker hash table. */ + +static struct bfd_link_hash_table * +m68hc11_elf_bfd_link_hash_table_create (abfd) + bfd *abfd; +{ + struct m68hc11_elf_link_hash_table *ret; + + ret = m68hc11_elf_hash_table_create (abfd); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; + + ret->size_one_stub = m68hc11_elf_size_one_stub; + ret->build_one_stub = m68hc11_elf_build_one_stub; + + return &ret->root.root; +} + /* 68HC11 Linker Relaxation. */ @@ -1044,6 +1073,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) } } prev_insn_branch = 0; + prev_insn_group = 0; } if (free_relocs != NULL) @@ -1251,365 +1281,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) } } -/* Look through the relocs for a section during the first phase. - Since we don't do .gots or .plts, we just need to consider the - virtual table relocs for gc. */ - -static bfd_boolean -elf32_m68hc11_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; - struct elf_link_hash_entry ** sym_hashes_end; - const Elf_Internal_Rela * rel; - const Elf_Internal_Rela * rel_end; - - if (info->relocateable) - return TRUE; - - symtab_hdr = & elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); - if (!elf_bad_symtab (abfd)) - sym_hashes_end -= symtab_hdr->sh_info; - - rel_end = relocs + sec->reloc_count; - - for (rel = relocs; rel < rel_end; rel++) - { - struct elf_link_hash_entry * h; - unsigned long r_symndx; - - 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]; - - switch (ELF32_R_TYPE (rel->r_info)) - { - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_M68HC11_GNU_VTINHERIT: - if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return FALSE; - break; - - /* This relocation describes which C++ vtable entries are actually - used. Record for later use during GC. */ - case R_M68HC11_GNU_VTENTRY: - if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return FALSE; - break; - } - } - - return TRUE; -} - -/* Relocate a 68hc11/68hc12 ELF section. */ -static bfd_boolean -elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd ATTRIBUTE_UNUSED; - 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; - struct elf_link_hash_entry **sym_hashes; - Elf_Internal_Rela *rel, *relend; - const char *name; - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type *howto; - unsigned long r_symndx; - Elf_Internal_Sym *sym; - asection *sec; - struct elf_link_hash_entry *h; - bfd_vma relocation; - bfd_reloc_status_type r; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_type == R_M68HC11_GNU_VTENTRY - || r_type == R_M68HC11_GNU_VTINHERIT ) - continue; - - howto = elf_m68hc11_howto_table + r_type; - - if (info->relocateable) - { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; - } - } - - continue; - } - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); - } - 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; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - if (!((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, TRUE))) - return FALSE; - relocation = 0; - } - } - - 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 == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); - } - - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, rel->r_addend); - - if (r != bfd_reloc_ok) - { - const char * msg = (const char *) 0; - - switch (r) - { - case bfd_reloc_overflow: - if (!((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return FALSE; - break; - - case bfd_reloc_undefined: - if (!((*info->callbacks->undefined_symbol) - (info, name, input_bfd, input_section, - rel->r_offset, TRUE))) - return FALSE; - break; - - case bfd_reloc_outofrange: - msg = _ ("internal error: out of range error"); - goto common_error; - - case bfd_reloc_notsupported: - msg = _ ("internal error: unsupported relocation error"); - goto common_error; - - case bfd_reloc_dangerous: - msg = _ ("internal error: dangerous error"); - goto common_error; - - default: - msg = _ ("internal error: unknown error"); - /* fall through */ - - common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, - rel->r_offset))) - return FALSE; - break; - } - } - } - - return TRUE; -} - - -/* Set and control ELF flags in ELF header. */ - -bfd_boolean -_bfd_m68hc11_elf_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; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -bfd_boolean -_bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword old_flags; - flagword new_flags; - bfd_boolean ok = TRUE; - - /* Check if we have the same endianess */ - if (!_bfd_generic_verify_endian_match (ibfd, obfd)) - return FALSE; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return TRUE; - - new_flags = elf_elfheader (ibfd)->e_flags; - elf_elfheader (obfd)->e_flags |= new_flags & EF_M68HC11_ABI; - old_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - elf_flags_init (obfd) = TRUE; - elf_elfheader (obfd)->e_flags = new_flags; - elf_elfheader (obfd)->e_ident[EI_CLASS] - = elf_elfheader (ibfd)->e_ident[EI_CLASS]; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), - bfd_get_mach (ibfd))) - return FALSE; - } - - return TRUE; - } - - /* Check ABI compatibility. */ - if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32)) - { - (*_bfd_error_handler) - (_("%s: linking files compiled for 16-bit integers (-mshort) " - "and others for 32-bit integers"), - bfd_archive_filename (ibfd)); - ok = FALSE; - } - if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64)) - { - (*_bfd_error_handler) - (_("%s: linking files compiled for 32-bit double (-fshort-double) " - "and others for 64-bit double"), - bfd_archive_filename (ibfd)); - ok = FALSE; - } - new_flags &= ~EF_M68HC11_ABI; - old_flags &= ~EF_M68HC11_ABI; - - /* Warn about any other mismatches */ - if (new_flags != old_flags) - { - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); - ok = FALSE; - } - - if (! ok) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - return TRUE; -} - -bfd_boolean -_bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if (elf_elfheader (abfd)->e_flags & E_M68HC11_I32) - fprintf (file, _("[abi=32-bit int,")); - else - fprintf (file, _("[abi=16-bit int,")); - - if (elf_elfheader (abfd)->e_flags & E_M68HC11_F64) - fprintf (file, _(" 64-bit double]")); - else - fprintf (file, _(" 32-bit double]")); - - if (elf_elfheader (abfd)->e_flags & E_M68HC12_BANKS) - fprintf (file, _(" [memory=bank-model]")); - else - fprintf (file, _(" [memory=flat]")); - - fputc ('\n', file); - - return TRUE; -} - -/* Below is the only difference between elf32-m68hc12.c and elf32-m68hc11.c. - The Motorola spec says to use a different Elf machine code. */ #define ELF_ARCH bfd_arch_m68hc11 #define ELF_MACHINE_CODE EM_68HC11 #define ELF_MAXPAGESIZE 0x1000 @@ -1624,9 +1296,15 @@ _bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) #define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook #define elf_backend_check_relocs elf32_m68hc11_check_relocs #define elf_backend_relocate_section elf32_m68hc11_relocate_section +#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook #define elf_backend_object_p 0 #define elf_backend_final_write_processing 0 #define elf_backend_can_gc_sections 1 + +#define bfd_elf32_bfd_link_hash_table_create \ + m68hc11_elf_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + m68hc11_elf_bfd_link_hash_table_free #define bfd_elf32_bfd_merge_private_bfd_data \ _bfd_m68hc11_elf_merge_private_bfd_data #define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c index 219fd6b..54fdca2 100644 --- a/bfd/elf32-m68hc12.c +++ b/bfd/elf32-m68hc12.c @@ -1,5 +1,5 @@ /* Motorola 68HC12-specific support for 32-bit ELF - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Stephane Carrez (stcarrez@nerim.fr) (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) @@ -21,49 +21,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" +#include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" +#include "elf32-m68hc1x.h" #include "elf/m68hc11.h" #include "opcode/m68hc11.h" +/* Relocation functions. */ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static void m68hc11_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_reloc_status_type m68hc11_elf_ignore_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type m68hc12_elf_special_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static int m68hc12_addr_is_banked PARAMS ((bfd_vma)); -static bfd_vma m68hc12_phys_addr PARAMS ((bfd_vma)); -static bfd_vma m68hc12_phys_page PARAMS ((bfd_vma)); - -/* GC mark and sweep. */ -static asection *elf32_m68hc11_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf32_m68hc11_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); +/* Trampoline generation. */ +static bfd_boolean m68hc12_elf_size_one_stub + PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); +static bfd_boolean m68hc12_elf_build_one_stub + PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); +static struct bfd_link_hash_table* m68hc12_elf_bfd_link_hash_table_create + PARAMS((bfd*)); static bfd_boolean m68hc12_elf_set_mach_from_flags PARAMS ((bfd *)); -bfd_boolean _bfd_m68hc12_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); -bfd_boolean _bfd_m68hc12_elf_set_private_flags PARAMS ((bfd *, flagword)); -bfd_boolean _bfd_m68hc12_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); - - - /* Use REL instead of RELA to save space */ #define USE_REL 1 -/* The Motorola 68HC11 microcontroler only addresses 64Kb. - We must handle 8 and 16-bit relocations. The 32-bit relocation - is defined but not used except by gas when -gstabs is used (which - is wrong). - - The 68HC12 microcontroler has a memory bank switching system +/* The 68HC12 microcontroler has a memory bank switching system with a 16Kb window in the 64Kb address space. The extended memory is mapped in the 16Kb window (at 0x8000). The page register controls which 16Kb bank is mapped. The call/rtc instructions take care of @@ -199,7 +183,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0x00ff, /* src_mask */ 0x00ff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* A 16 bit absolute relocation */ HOWTO (R_M68HC11_16, /* type */ @@ -209,7 +193,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont /*bitfield */ , /* complain_on_overflow */ - m68hc12_elf_special_reloc, /* special_function */ + bfd_elf_generic_reloc, /* special_function */ "R_M68HC12_16", /* name */ FALSE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -260,7 +244,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ - FALSE), /* pcrel_offset */ + TRUE), /* pcrel_offset */ /* GNU extension to record C++ vtable hierarchy */ HOWTO (R_M68HC11_GNU_VTINHERIT, /* type */ @@ -295,16 +279,16 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { /* A 24 bit relocation */ HOWTO (R_M68HC11_24, /* type */ 0, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ 24, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - m68hc12_elf_special_reloc, /* special_function */ + m68hc11_elf_special_reloc, /* special_function */ "R_M68HC12_24", /* name */ FALSE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ FALSE), /* pcrel_offset */ /* A 16-bit low relocation */ @@ -315,7 +299,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - m68hc12_elf_special_reloc,/* special_function */ + m68hc11_elf_special_reloc,/* special_function */ "R_M68HC12_LO16", /* name */ FALSE, /* partial_inplace */ 0xffff, /* src_mask */ @@ -330,7 +314,7 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - m68hc12_elf_special_reloc,/* special_function */ + m68hc11_elf_special_reloc,/* special_function */ "R_M68HC12_PAGE", /* name */ FALSE, /* partial_inplace */ 0x00ff, /* src_mask */ @@ -423,217 +407,112 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return NULL; } -/* This function is used for relocs which are only used for relaxing, - which the linker should otherwise ignore. */ +/* Set the howto pointer for an M68HC11 ELF reloc. */ -static bfd_reloc_status_type -m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) +static void +m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; { - if (output_bfd != NULL) - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; -} + unsigned int r_type; -static int -m68hc12_addr_is_banked (addr) - bfd_vma addr; -{ - return (addr >= M68HC12_BANK_VIRT) ? 1 : 0; + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); + cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; } -/* Return the physical address seen by the processor, taking - into account banked memory. */ -static bfd_vma -m68hc12_phys_addr (addr) - bfd_vma addr; -{ - if (addr < M68HC12_BANK_VIRT) - return addr; - - /* Map the address to the memory bank. */ - addr -= M68HC12_BANK_VIRT; - addr &= M68HC12_BANK_MASK; - addr += M68HC12_BANK_BASE; - return addr; -} + +/* Far trampoline generation. */ -/* Return the page number corresponding to an address in banked memory. */ -static bfd_vma -m68hc12_phys_page (addr) - bfd_vma addr; +/* Build a 68HC12 trampoline stub. */ +static bfd_boolean +m68hc12_elf_build_one_stub (gen_entry, in_arg) + struct bfd_hash_entry *gen_entry; + PTR in_arg; { - if (addr < M68HC12_BANK_VIRT) - return 0; - - /* Map the address to the memory bank. */ - addr -= M68HC12_BANK_VIRT; - addr >>= M68HC12_BANK_SHIFT; - addr &= M68HC12_BANK_PAGE_MASK; - return addr; -} + struct elf32_m68hc11_stub_hash_entry *stub_entry; + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value, phys_page, phys_addr; -static bfd_reloc_status_type -m68hc12_elf_special_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 ATTRIBUTE_UNUSED; -{ - reloc_howto_type *howto; - bfd_vma relocation; - bfd_vma phys_addr; - bfd_vma phys_page; - bfd_vma insn_page; - bfd_vma insn_addr; - - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + info = (struct bfd_link_info *) in_arg; - if (output_bfd != NULL) - return bfd_reloc_continue; + htab = m68hc11_elf_hash_table (info); - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; + stub_sec = stub_entry->stub_sec; - /* Compute relocation. */ - relocation = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - relocation += reloc_entry->addend; - relocation += bfd_get_16 (abfd, (bfd_byte*) data + reloc_entry->address); + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->_raw_size; + stub_sec->_raw_size += 7; + loc = stub_sec->contents + stub_entry->stub_offset; - /* Do the memory bank mapping. */ - phys_addr = m68hc12_phys_addr (relocation); - phys_page = m68hc12_phys_page (relocation); + stub_bfd = stub_sec->owner; - howto = reloc_entry->howto; - if (howto->complain_on_overflow != complain_overflow_dont - && (phys_addr & (((bfd_vma) -1) << 16))) - return bfd_reloc_overflow; + /* Create the trampoline call stub: - switch (howto->type) - { - case R_M68HC11_16: - /* Get virtual address of instruction having the relocation. */ - insn_addr = input_section->output_section->vma - + input_section->output_offset - + reloc_entry->address; - - insn_page = m68hc12_phys_page (insn_addr); - - if (m68hc12_addr_is_banked (relocation) - && m68hc12_addr_is_banked (insn_addr) - && phys_page != insn_page) - { - *error_message = _("address is not in the same bank"); - return bfd_reloc_dangerous; - } - if (m68hc12_addr_is_banked (relocation) - && !m68hc12_addr_is_banked (insn_addr)) - { - *error_message = _("reference to a banked address in " - "the normal address space"); - return bfd_reloc_dangerous; - } - - case R_M68HC11_LO16: - bfd_put_16 (abfd, phys_addr, (bfd_byte*) data + reloc_entry->address); - break; + ldy #%addr(symbol) + call %page(symbol), __trampoline - case R_M68HC11_24: - bfd_put_16 (abfd, phys_addr, (bfd_byte*) data + reloc_entry->address); - bfd_put_8 (abfd, phys_page, (bfd_byte*) data + reloc_entry->address + 2); - break; + */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + phys_addr = m68hc11_phys_addr (&htab->pinfo, sym_value); + phys_page = m68hc11_phys_page (&htab->pinfo, sym_value); - case R_M68HC11_PAGE: - bfd_put_8 (abfd, phys_page, (bfd_byte*) data + reloc_entry->address); - break; + /* ldy #%page(sym) */ + bfd_put_8 (stub_bfd, 0xCD, loc); + bfd_put_16 (stub_bfd, phys_addr, loc + 1); + loc += 3; - default: - abort (); - break; - } + /* call %page(sym), __trampoline */ + bfd_put_8 (stub_bfd, 0x4a, loc); + bfd_put_16 (stub_bfd, htab->pinfo.trampoline_addr, loc + 1); + bfd_put_8 (stub_bfd, phys_page, loc + 3); - return bfd_reloc_ok; + return TRUE; } -/* Set the howto pointer for an M68HC11 ELF reloc. */ +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ -static void -m68hc11_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +static bfd_boolean +m68hc12_elf_size_one_stub (gen_entry, in_arg) + struct bfd_hash_entry *gen_entry; + PTR in_arg ATTRIBUTE_UNUSED; { - unsigned int r_type; + struct elf32_m68hc11_stub_hash_entry *stub_entry; - r_type = ELF32_R_TYPE (dst->r_info); - BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); - cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + stub_entry->stub_sec->_raw_size += 7; + return TRUE; } -static asection * -elf32_m68hc11_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; +/* Create a 68HC12 ELF linker hash table. */ + +static struct bfd_link_hash_table * +m68hc12_elf_bfd_link_hash_table_create (abfd) + bfd *abfd; { - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - 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); + struct m68hc11_elf_link_hash_table *ret; - return NULL; -} + ret = m68hc11_elf_hash_table_create (abfd); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; -static bfd_boolean -elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; -{ - /* We don't use got and plt entries for 68hc11/68hc12. */ - return TRUE; -} + ret->size_one_stub = m68hc12_elf_size_one_stub; + ret->build_one_stub = m68hc12_elf_build_one_stub; + return &ret->root.root; +} static bfd_boolean m68hc12_elf_set_mach_from_flags (abfd) @@ -659,149 +538,6 @@ m68hc12_elf_set_mach_from_flags (abfd) return TRUE; } -/* Set and control ELF flags in ELF header. */ - -bfd_boolean -_bfd_m68hc12_elf_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 m68hc12_elf_set_mach_from_flags (abfd); -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -bfd_boolean -_bfd_m68hc12_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword old_flags; - flagword new_flags; - bfd_boolean ok = TRUE; - - /* Check if we have the same endianess */ - if (!_bfd_generic_verify_endian_match (ibfd, obfd)) - return FALSE; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return TRUE; - - new_flags = elf_elfheader (ibfd)->e_flags; - old_flags = elf_elfheader (obfd)->e_flags; - - if (! elf_flags_init (obfd)) - { - elf_flags_init (obfd) = TRUE; - elf_elfheader (obfd)->e_flags = new_flags; - elf_elfheader (obfd)->e_ident[EI_CLASS] - = elf_elfheader (ibfd)->e_ident[EI_CLASS]; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - { - if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), - bfd_get_mach (ibfd))) - return FALSE; - } - - return TRUE; - } - - /* Check ABI compatibility. */ - if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32)) - { - (*_bfd_error_handler) - (_("%s: linking files compiled for 16-bit integers (-mshort) " - "and others for 32-bit integers"), - bfd_archive_filename (ibfd)); - ok = FALSE; - } - if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64)) - { - (*_bfd_error_handler) - (_("%s: linking files compiled for 32-bit double (-fshort-double) " - "and others for 64-bit double"), - bfd_archive_filename (ibfd)); - ok = FALSE; - } - - /* Processor compatibility. */ - if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags)) - { - (*_bfd_error_handler) - (_("%s: linking files compiled for HCS12 with " - "others compiled for HC12"), - bfd_archive_filename (ibfd)); - ok = FALSE; - } - new_flags = ((new_flags & ~EF_M68HC11_MACH_MASK) - | (EF_M68HC11_MERGE_MACH (new_flags, old_flags))); - - elf_elfheader (obfd)->e_flags = new_flags; - - /* Warn about any other mismatches */ - new_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); - old_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); - if (new_flags != old_flags) - { - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); - ok = FALSE; - } - - if (! ok) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - return TRUE; -} - -bfd_boolean -_bfd_m68hc12_elf_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE *file = (FILE *) ptr; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - if (elf_elfheader (abfd)->e_flags & E_M68HC11_I32) - fprintf (file, _("[abi=32-bit int,")); - else - fprintf (file, _("[abi=16-bit int,")); - - if (elf_elfheader (abfd)->e_flags & E_M68HC11_F64) - fprintf (file, _(" 64-bit double,")); - else - fprintf (file, _(" 32-bit double,")); - - if (elf_elfheader (abfd)->e_flags & EF_M68HCS12_MACH) - fprintf (file, _(" cpu=HCS12]")); - else - fprintf (file, _(" cpu=HC12]")); - fputc ('\n', file); - - return TRUE; -} - #define ELF_ARCH bfd_arch_m68hc12 #define ELF_MACHINE_CODE EM_68HC12 #define ELF_MAXPAGESIZE 0x1000 @@ -813,15 +549,22 @@ _bfd_m68hc12_elf_print_private_bfd_data (abfd, ptr) #define elf_info_to_howto_rel m68hc11_info_to_howto_rel #define elf_backend_gc_mark_hook elf32_m68hc11_gc_mark_hook #define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook +#define elf_backend_check_relocs elf32_m68hc11_check_relocs +#define elf_backend_relocate_section elf32_m68hc11_relocate_section #define elf_backend_object_p m68hc12_elf_set_mach_from_flags #define elf_backend_final_write_processing 0 -/* Disabled as this backend uses the generic linker. */ -#define elf_backend_can_gc_sections 0 - +#define elf_backend_can_gc_sections 1 +#define elf_backend_post_process_headers elf32_m68hc11_post_process_headers +#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook + +#define bfd_elf32_bfd_link_hash_table_create \ + m68hc12_elf_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + m68hc11_elf_bfd_link_hash_table_free #define bfd_elf32_bfd_merge_private_bfd_data \ - _bfd_m68hc12_elf_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags _bfd_m68hc12_elf_set_private_flags + _bfd_m68hc11_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data \ - _bfd_m68hc12_elf_print_private_bfd_data + _bfd_m68hc11_elf_print_private_bfd_data #include "elf32-target.h" diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c new file mode 100644 index 0000000..0696a36 --- /dev/null +++ b/bfd/elf32-m68hc1x.c @@ -0,0 +1,1508 @@ +/* Motorola 68HC11/HC12-specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + +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 "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf32-m68hc1x.h" +#include "elf/m68hc11.h" +#include "opcode/m68hc11.h" + + +#define m68hc12_stub_hash_lookup(table, string, create, copy) \ + ((struct elf32_m68hc11_stub_hash_entry *) \ + bfd_hash_lookup ((table), (string), (create), (copy))) + +static struct elf32_m68hc11_stub_hash_entry* m68hc12_add_stub + PARAMS((const char *stub_name, + asection *section, + struct m68hc11_elf_link_hash_table *htab)); + +static struct bfd_hash_entry *stub_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + +static void m68hc11_elf_set_symbol + PARAMS ((bfd* abfd, struct bfd_link_info *info, + const char* name, bfd_vma value, asection* sec)); + +static bfd_boolean m68hc11_elf_export_one_stub + PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); + +static bfd_boolean m68hc11_get_relocation_value + PARAMS ((bfd* abfd, + struct bfd_link_info* info, + asection **local_sections, + Elf_Internal_Sym* local_syms, + Elf_Internal_Rela* rel, + const char** name, + bfd_vma* relocation, + bfd_boolean* is_far)); + +static void scan_sections_for_abi PARAMS ((bfd*, asection*, PTR)); + +struct m68hc11_scan_param +{ + struct m68hc11_page_info* pinfo; + bfd_boolean use_memory_banks; +}; + + +/* Create a 68HC11/68HC12 ELF linker hash table. */ + +struct m68hc11_elf_link_hash_table* +m68hc11_elf_hash_table_create (abfd) + bfd *abfd; +{ + struct m68hc11_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); + + ret = (struct m68hc11_elf_link_hash_table *) bfd_zalloc (abfd, amt); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + _bfd_elf_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return NULL; + } + + /* Init the stub hash table too. */ + amt = sizeof (struct bfd_hash_table); + ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt); + if (ret->stub_hash_table == NULL) + { + bfd_release (abfd, ret); + return NULL; + } + if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc)) + return NULL; + + ret->stub_bfd = NULL; + ret->stub_section = 0; + ret->add_stub_section = NULL; + ret->sym_sec.abfd = NULL; + + return ret; +} + +/* Free the derived linker hash table. */ + +void +m68hc11_elf_bfd_link_hash_table_free (hash) + struct bfd_link_hash_table *hash; +{ + struct m68hc11_elf_link_hash_table *ret + = (struct m68hc11_elf_link_hash_table *) hash; + + bfd_hash_table_free (ret->stub_hash_table); + free (ret->stub_hash_table); + _bfd_generic_link_hash_table_free (hash); +} + +/* Assorted hash table functions. */ + +/* Initialize an entry in the stub hash table. */ + +static struct bfd_hash_entry * +stub_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf32_m68hc11_stub_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct elf32_m68hc11_stub_hash_entry *eh; + + /* Initialize the local fields. */ + eh = (struct elf32_m68hc11_stub_hash_entry *) entry; + eh->stub_sec = NULL; + eh->stub_offset = 0; + eh->target_value = 0; + eh->target_section = NULL; + } + + return entry; +} + +/* Add a new stub entry to the stub hash. Not all fields of the new + stub entry are initialised. */ + +static struct elf32_m68hc11_stub_hash_entry * +m68hc12_add_stub (stub_name, section, htab) + const char *stub_name; + asection *section; + struct m68hc11_elf_link_hash_table *htab; +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + + /* Enter this entry into the linker stub hash table. */ + stub_entry = m68hc12_stub_hash_lookup (htab->stub_hash_table, stub_name, + TRUE, FALSE); + if (stub_entry == NULL) + { + (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), + bfd_archive_filename (section->owner), + stub_name); + return NULL; + } + + if (htab->stub_section == 0) + { + htab->stub_section = (*htab->add_stub_section) (".tramp", + htab->tramp_section); + } + + stub_entry->stub_sec = htab->stub_section; + stub_entry->stub_offset = 0; + return stub_entry; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it for identify far symbols and force a loading of + the trampoline handler. */ + +bfd_boolean +elf32_m68hc11_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info; + const Elf_Internal_Sym *sym; + const char **namep ATTRIBUTE_UNUSED; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp ATTRIBUTE_UNUSED; + bfd_vma *valp ATTRIBUTE_UNUSED; +{ + if (sym->st_other & STO_M68HC12_FAR) + { + struct elf_link_hash_entry *h; + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, "__far_trampoline", + FALSE, FALSE, FALSE); + if (h == NULL) + { + struct bfd_link_hash_entry* entry = NULL; + + _bfd_generic_link_add_one_symbol (info, abfd, + "__far_trampoline", + BSF_GLOBAL, + bfd_und_section_ptr, + (bfd_vma) 0, (const char*) NULL, + FALSE, FALSE, &entry); + } + + } + return TRUE; +} + +/* External entry points for sizing and building linker stubs. */ + +/* Set up various things so that we can make a list of input sections + for each output section included in the link. Returns -1 on error, + 0 when no stubs will be needed, and 1 on success. */ + +int +elf32_m68hc11_setup_section_lists (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *input_bfd; + unsigned int bfd_count; + int top_id, top_index; + asection *section; + asection **input_list, **list; + bfd_size_type amt; + asection *text_section; + struct m68hc11_elf_link_hash_table *htab; + + htab = m68hc11_elf_hash_table (info); + + if (htab->root.root.creator->flavour != bfd_target_elf_flavour) + return 0; + + /* Count the number of input BFDs and find the top input section id. + Also search for an existing ".tramp" section so that we know + where generated trampolines must go. Default to ".text" if we + can't find it. */ + htab->tramp_section = 0; + text_section = 0; + for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + bfd_count += 1; + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + const char* name = bfd_get_section_name (input_bfd, section); + + if (!strcmp (name, ".tramp")) + htab->tramp_section = section; + + if (!strcmp (name, ".text")) + text_section = section; + + if (top_id < section->id) + top_id = section->id; + } + } + htab->bfd_count = bfd_count; + if (htab->tramp_section == 0) + htab->tramp_section = text_section; + + /* We can't use output_bfd->section_count here to find the top output + section index as some sections may have been removed, and + _bfd_strip_section_from_output doesn't renumber the indices. */ + for (section = output_bfd->sections, top_index = 0; + section != NULL; + section = section->next) + { + if (top_index < section->index) + top_index = section->index; + } + + htab->top_index = top_index; + amt = sizeof (asection *) * (top_index + 1); + input_list = (asection **) bfd_malloc (amt); + htab->input_list = input_list; + if (input_list == NULL) + return -1; + + /* For sections we aren't interested in, mark their entries with a + value we can check later. */ + list = input_list + top_index; + do + *list = bfd_abs_section_ptr; + while (list-- != input_list); + + for (section = output_bfd->sections; + section != NULL; + section = section->next) + { + if ((section->flags & SEC_CODE) != 0) + input_list[section->index] = NULL; + } + + return 1; +} + +/* Determine and set the size of the stub section for a final link. + + The basic idea here is to examine all the relocations looking for + PC-relative calls to a target that is unreachable with a "bl" + instruction. */ + +bfd_boolean +elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section) + bfd *output_bfd; + bfd *stub_bfd; + struct bfd_link_info *info; + asection * (*add_stub_section) PARAMS ((const char *, asection *)); +{ + bfd *input_bfd; + asection *section; + Elf_Internal_Sym *local_syms, **all_local_syms; + unsigned int bfd_indx, bfd_count; + bfd_size_type amt; + asection *stub_sec; + + struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info); + + /* Stash our params away. */ + htab->stub_bfd = stub_bfd; + htab->add_stub_section = add_stub_section; + + /* Count the number of input BFDs and find the top input section id. */ + for (input_bfd = info->input_bfds, bfd_count = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + bfd_count += 1; + } + + /* We want to read in symbol extension records only once. To do this + we need to read in the local symbols in parallel and save them for + later use; so hold pointers to the local symbols in an array. */ + amt = sizeof (Elf_Internal_Sym *) * bfd_count; + all_local_syms = (Elf_Internal_Sym **) bfd_zmalloc (amt); + if (all_local_syms == NULL) + return FALSE; + + /* Walk over all the input BFDs, swapping in local symbols. */ + for (input_bfd = info->input_bfds, bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *shndx_hdr; + Elf_Internal_Sym *isym; + Elf32_External_Sym *extsyms, *esym, *end_sy; + Elf_External_Sym_Shndx *shndx_buf, *shndx; + bfd_size_type sec_size; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + /* We need an array of the local symbols attached to the input bfd. + Unfortunately, we're going to have to read & swap them in. */ + sec_size = symtab_hdr->sh_info; + sec_size *= sizeof (Elf_Internal_Sym); + local_syms = (Elf_Internal_Sym *) bfd_malloc (sec_size); + if (local_syms == NULL) + goto error_ret_free_local; + + all_local_syms[bfd_indx] = local_syms; + sec_size = symtab_hdr->sh_info; + sec_size *= sizeof (Elf32_External_Sym); + + /* Get the cached copy. */ + if (symtab_hdr->contents != NULL) + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + else + { + /* Go get them off disk. */ + bfd_size_type amt = symtab_hdr->sh_size; + extsyms = (Elf32_External_Sym *) bfd_malloc (amt); + if (extsyms == NULL) + goto error_ret_free_local; + + if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread ((PTR) extsyms, amt, input_bfd) != amt) + { + error_ret_free_ext_syms: + free (extsyms); + goto error_ret_free_local; + } + } + shndx_buf = NULL; + shndx_hdr = &elf_tdata (input_bfd)->symtab_shndx_hdr; + if (shndx_hdr->sh_size != 0) + { + bfd_size_type amt; + + amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx); + shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); + if (shndx_buf == NULL) + goto error_ret_free_ext_syms; + if (bfd_seek (input_bfd, shndx_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread ((PTR) shndx_buf, amt, input_bfd) != amt) + { + free (shndx_buf); + goto error_ret_free_ext_syms; + } + shndx_hdr->contents = (PTR) shndx_buf; + } + + /* Swap the local symbols in. */ + for (esym = extsyms, end_sy = esym + symtab_hdr->sh_info, + isym = local_syms, shndx = shndx_buf; + esym < end_sy; + esym++, isym++, shndx = (shndx ? shndx + 1 : NULL)) + bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isym); + + /* Now we can free the external symbols. */ + free (shndx_buf); + } + + for (input_bfd = info->input_bfds, bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *local_syms; + struct elf_link_hash_entry ** sym_hashes; + + sym_hashes = elf_sym_hashes (input_bfd); + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + local_syms = all_local_syms[bfd_indx]; + + /* Walk over each section attached to the input bfd. */ + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + + /* If there aren't any relocs, then there's nothing more + to do. */ + if ((section->flags & SEC_RELOC) == 0 + || section->reloc_count == 0) + continue; + + /* If this section is a link-once section that will be + discarded, then don't create any stubs. */ + if (section->output_section == NULL + || section->output_section->owner != output_bfd) + continue; + + /* Get the relocs. */ + internal_relocs + = _bfd_elf32_link_read_relocs (input_bfd, section, NULL, + (Elf_Internal_Rela *) NULL, + info->keep_memory); + if (internal_relocs == NULL) + goto error_ret_free_local; + + /* Now examine each relocation. */ + irela = internal_relocs; + irelaend = irela + section->reloc_count; + for (; irela < irelaend; irela++) + { + unsigned int r_type, r_indx; + struct elf32_m68hc11_stub_hash_entry *stub_entry; + asection *sym_sec; + bfd_vma sym_value; + struct elf_link_hash_entry *hash; + const char *stub_name; + Elf_Internal_Sym *sym; + + r_type = ELF32_R_TYPE (irela->r_info); + + /* Only look at 16-bit relocs. */ + if (r_type != (unsigned int) R_M68HC11_16) + continue; + + /* Now determine the call target, its name, value, + section. */ + r_indx = ELF32_R_SYM (irela->r_info); + if (r_indx < symtab_hdr->sh_info) + { + /* It's a local symbol. */ + Elf_Internal_Shdr *hdr; + bfd_boolean is_far; + + sym = local_syms + r_indx; + hdr = elf_elfsections (input_bfd)[sym->st_shndx]; + sym_sec = hdr->bfd_section; + is_far = (sym && (sym->st_other & STO_M68HC12_FAR)); + if (!is_far) + continue; + stub_name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, + sym->st_name)); + sym_value = sym->st_value; + hash = NULL; + } + else + { + /* It's an external symbol. */ + int e_indx; + + e_indx = r_indx - symtab_hdr->sh_info; + hash = (struct elf_link_hash_entry *) + (sym_hashes[e_indx]); + + while (hash->root.type == bfd_link_hash_indirect + || hash->root.type == bfd_link_hash_warning) + hash = ((struct elf_link_hash_entry *) + hash->root.u.i.link); + + if (hash->root.type == bfd_link_hash_defined + || hash->root.type == bfd_link_hash_defweak) + { + if (!(hash->other & STO_M68HC12_FAR)) + continue; + } + else if (hash->root.type == bfd_link_hash_undefweak) + { + continue; + } + else if (hash->root.type == bfd_link_hash_undefined) + { + continue; + } + else + { + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + sym_sec = hash->root.u.def.section; + sym_value = hash->root.u.def.value; + stub_name = hash->root.root.string; + } + + if (!stub_name) + goto error_ret_free_internal; + + stub_entry = m68hc12_stub_hash_lookup + (htab->stub_hash_table, + stub_name, + FALSE, FALSE); + if (stub_entry == NULL) + { + if (add_stub_section == 0) + continue; + + stub_entry = m68hc12_add_stub (stub_name, section, htab); + if (stub_entry == NULL) + { + error_ret_free_internal: + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + goto error_ret_free_local; + } + } + + stub_entry->target_value = sym_value; + stub_entry->target_section = sym_sec; + } + + /* We're done with the internal relocs, free them. */ + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + } + } + + if (add_stub_section) + { + /* OK, we've added some stubs. Find out the new size of the + stub sections. */ + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + stub_sec->_raw_size = 0; + stub_sec->_cooked_size = 0; + } + + bfd_hash_traverse (htab->stub_hash_table, htab->size_one_stub, htab); + } + free (htab->all_local_syms); + return TRUE; + + error_ret_free_local: + free (htab->all_local_syms); + return FALSE; +} + +/* Export the trampoline addresses in the symbol table. */ +static bfd_boolean +m68hc11_elf_export_one_stub (gen_entry, in_arg) + struct bfd_hash_entry *gen_entry; + PTR in_arg; +{ + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + struct elf32_m68hc11_stub_hash_entry *stub_entry; + char* name; + bfd_boolean result; + + info = (struct bfd_link_info *) in_arg; + htab = m68hc11_elf_hash_table (info); + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + /* Generate the trampoline according to HC11 or HC12. */ + result = (* htab->build_one_stub) (gen_entry, in_arg); + + /* Make a printable name that does not conflict with the real function. */ + name = alloca (strlen (stub_entry->root.string) + 16); + sprintf (name, "tramp.%s", stub_entry->root.string); + + /* Export the symbol for debugging/disassembling. */ + m68hc11_elf_set_symbol (htab->stub_bfd, info, name, + stub_entry->stub_offset, + stub_entry->stub_sec); + return result; +} + +/* Export a symbol or set its value and section. */ +static void +m68hc11_elf_set_symbol (abfd, info, name, value, sec) + bfd* abfd; + struct bfd_link_info *info; + const char* name; + bfd_vma value; + asection* sec; +{ + struct elf_link_hash_entry *h; + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, FALSE); + if (h == NULL) + { + _bfd_generic_link_add_one_symbol (info, abfd, + name, + BSF_GLOBAL, + sec, + value, + (const char*) NULL, + TRUE, FALSE, NULL); + } + else + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.value = value; + h->root.u.def.section = sec; + } +} + + +/* Build all the stubs associated with the current output file. The + stubs are kept in a hash table attached to the main linker hash + table. This function is called via m68hc12elf_finish in the + linker. */ + +bfd_boolean +elf32_m68hc11_build_stubs (abfd, info) + bfd* abfd; + struct bfd_link_info *info; +{ + asection *stub_sec; + struct bfd_hash_table *table; + struct m68hc11_elf_link_hash_table *htab; + struct m68hc11_scan_param param; + + m68hc11_elf_get_bank_parameters (info); + htab = m68hc11_elf_hash_table (info); + + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + bfd_size_type size; + + /* Allocate memory to hold the linker stubs. */ + size = stub_sec->_raw_size; + stub_sec->contents = (unsigned char *) bfd_zalloc (htab->stub_bfd, size); + if (stub_sec->contents == NULL && size != 0) + return FALSE; + stub_sec->_raw_size = 0; + } + + /* Build the stubs as directed by the stub hash table. */ + table = htab->stub_hash_table; + bfd_hash_traverse (table, m68hc11_elf_export_one_stub, info); + + /* Scan the output sections to see if we use the memory banks. + If so, export the symbols that define how the memory banks + are mapped. This is used by gdb and the simulator to obtain + the information. It can be used by programs to burn the eprom + at the good addresses. */ + param.use_memory_banks = FALSE; + param.pinfo = &htab->pinfo; + bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m); + if (param.use_memory_banks) + { + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_START_NAME, + htab->pinfo.bank_physical, + bfd_abs_section_ptr); + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_VIRTUAL_NAME, + htab->pinfo.bank_virtual, + bfd_abs_section_ptr); + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_SIZE_NAME, + htab->pinfo.bank_size, + bfd_abs_section_ptr); + } + + return TRUE; +} + +void +m68hc11_elf_get_bank_parameters (info) + struct bfd_link_info *info; +{ + unsigned i; + struct m68hc11_page_info *pinfo; + struct bfd_link_hash_entry *h; + + pinfo = &m68hc11_elf_hash_table (info)->pinfo; + if (pinfo->bank_param_initialized) + return; + + pinfo->bank_virtual = M68HC12_BANK_VIRT; + pinfo->bank_mask = M68HC12_BANK_MASK; + pinfo->bank_physical = M68HC12_BANK_BASE; + pinfo->bank_shift = M68HC12_BANK_SHIFT; + pinfo->bank_size = 1 << M68HC12_BANK_SHIFT; + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_START_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_physical = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_VIRTUAL_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_virtual = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_SIZE_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_size = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + pinfo->bank_shift = 0; + for (i = pinfo->bank_size; i != 0; i >>= 1) + pinfo->bank_shift++; + pinfo->bank_shift--; + pinfo->bank_mask = (1 << pinfo->bank_shift) - 1; + pinfo->bank_physical_end = pinfo->bank_physical + pinfo->bank_size; + pinfo->bank_param_initialized = 1; + + h = bfd_link_hash_lookup (info->hash, "__far_trampoline", FALSE, + FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->trampoline_addr = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); +} + +/* Return 1 if the address is in banked memory. + This can be applied to a virtual address and to a physical address. */ +int +m68hc11_addr_is_banked (pinfo, addr) + struct m68hc11_page_info *pinfo; + bfd_vma addr; +{ + if (addr >= pinfo->bank_virtual) + return 1; + + if (addr >= pinfo->bank_physical && addr <= pinfo->bank_physical_end) + return 1; + + return 0; +} + +/* Return the physical address seen by the processor, taking + into account banked memory. */ +bfd_vma +m68hc11_phys_addr (pinfo, addr) + struct m68hc11_page_info *pinfo; + bfd_vma addr; +{ + if (addr < pinfo->bank_virtual) + return addr; + + /* Map the address to the memory bank. */ + addr -= pinfo->bank_virtual; + addr &= pinfo->bank_mask; + addr += pinfo->bank_physical; + return addr; +} + +/* Return the page number corresponding to an address in banked memory. */ +bfd_vma +m68hc11_phys_page (pinfo, addr) + struct m68hc11_page_info *pinfo; + bfd_vma addr; +{ + if (addr < pinfo->bank_virtual) + return 0; + + /* Map the address to the memory bank. */ + addr -= pinfo->bank_virtual; + addr >>= pinfo->bank_shift; + addr &= 0x0ff; + return addr; +} + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +bfd_reloc_status_type +m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +bfd_reloc_status_type +m68hc11_elf_special_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + return bfd_reloc_continue; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + abort(); +} + +asection * +elf32_m68hc11_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)) + { + 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; +} + +bfd_boolean +elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* We don't use got and plt entries for 68hc11/68hc12. */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +bfd_boolean +elf32_m68hc11_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; + struct elf_link_hash_entry ** sym_hashes_end; + const Elf_Internal_Rela * rel; + const Elf_Internal_Rela * rel_end; + + if (info->relocateable) + return TRUE; + + symtab_hdr = & elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry * h; + unsigned long r_symndx; + + 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]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_M68HC11_GNU_VTINHERIT: + if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_M68HC11_GNU_VTENTRY: + if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +static bfd_boolean +m68hc11_get_relocation_value (abfd, info, local_sections, local_syms, + rel, name, + relocation, is_far) + bfd *abfd; + struct bfd_link_info *info; + asection **local_sections; + Elf_Internal_Sym* local_syms; + Elf_Internal_Rela* rel; + const char** name; + bfd_vma* relocation; + bfd_boolean* is_far; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + unsigned long r_symndx; + asection *sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + const char* stub_name = 0; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + + r_symndx = ELF32_R_SYM (rel->r_info); + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + *relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + *is_far = (sym && (sym->st_other & STO_M68HC12_FAR)); + if (*is_far) + stub_name = (bfd_elf_string_from_elf_section + (abfd, symtab_hdr->sh_link, + sym->st_name)); + } + 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; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + *relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + *relocation = 0; + else + { + if (!((*info->callbacks->undefined_symbol) + (info, h->root.root.string, abfd, + sec, rel->r_offset, TRUE))) + return FALSE; + *relocation = 0; + } + *is_far = (h && (h->other & STO_M68HC12_FAR)); + stub_name = h->root.root.string; + } + + if (h != NULL) + *name = h->root.root.string; + else + { + *name = (bfd_elf_string_from_elf_section + (abfd, symtab_hdr->sh_link, sym->st_name)); + if (*name == NULL || **name == '\0') + *name = bfd_section_name (input_bfd, sec); + } + + if (*is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16) + { + struct elf32_m68hc11_stub_hash_entry* stub; + struct m68hc11_elf_link_hash_table *htab; + + htab = m68hc11_elf_hash_table (info); + stub = m68hc12_stub_hash_lookup (htab->stub_hash_table, + *name, FALSE, FALSE); + if (stub) + { + *relocation = stub->stub_offset + + stub->stub_sec->output_section->vma + + stub->stub_sec->output_offset; + *is_far = FALSE; + } + } + return TRUE; +} + +/* Relocate a 68hc11/68hc12 ELF section. */ +bfd_boolean +elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + 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; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + const char *name; + struct m68hc11_page_info *pinfo; + struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + /* Get memory bank parameters. */ + m68hc11_elf_get_bank_parameters (info); + pinfo = &m68hc11_elf_hash_table (info)->pinfo; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + arelent arel; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_reloc_status_type r = bfd_reloc_undefined; + bfd_vma phys_page; + bfd_vma phys_addr; + bfd_vma insn_addr; + bfd_vma insn_page; + bfd_boolean is_far; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_type == R_M68HC11_GNU_VTENTRY + || r_type == R_M68HC11_GNU_VTINHERIT ) + continue; + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + (*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel); + howto = arel.howto; + + m68hc11_get_relocation_value (input_bfd, info, + local_sections, local_syms, + rel, &name, &relocation, &is_far); + + /* Do the memory bank mapping. */ + phys_addr = m68hc11_phys_addr (pinfo, relocation + rel->r_addend); + phys_page = m68hc11_phys_page (pinfo, relocation + rel->r_addend); + switch (r_type) + { + case R_M68HC11_24: + /* Reloc used by 68HC12 call instruction. */ + bfd_put_16 (input_bfd, phys_addr, + (bfd_byte*) contents + rel->r_offset); + bfd_put_8 (input_bfd, phys_page, + (bfd_byte*) contents + rel->r_offset + 2); + r = bfd_reloc_ok; + r_type = R_M68HC11_NONE; + break; + + case R_M68HC11_NONE: + r = bfd_reloc_ok; + break; + + case R_M68HC11_LO16: + /* Reloc generated by %addr(expr) gas to obtain the + address as mapped in the memory bank window. */ + relocation = phys_addr; + break; + + case R_M68HC11_PAGE: + /* Reloc generated by %page(expr) gas to obtain the + page number associated with the address. */ + relocation = phys_page; + break; + + case R_M68HC11_16: + /* Get virtual address of instruction having the relocation. */ + if (is_far) + { + const char* msg; + char* buf; + msg = _("Reference to the far symbol `%s' using a wrong " + "relocation may result in incorrect execution"); + buf = alloca (strlen (msg) + strlen (name) + 10); + sprintf (buf, msg, name); + + (* info->callbacks->warning) + (info, buf, name, input_bfd, NULL, rel->r_offset); + } + + /* Get virtual address of instruction having the relocation. */ + insn_addr = input_section->output_section->vma + + input_section->output_offset + + rel->r_offset; + + insn_page = m68hc11_phys_page (pinfo, insn_addr); + + if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend) + && m68hc11_addr_is_banked (pinfo, insn_addr) + && phys_page != insn_page) + { + const char* msg; + char* buf; + + msg = _("banked address [%lx:%04lx] (%lx) is not in the same bank " + "as current banked address [%lx:%04lx] (%lx)"); + + buf = alloca (strlen (msg) + 128); + sprintf (buf, msg, phys_page, phys_addr, + (long) (relocation + rel->r_addend), + insn_page, m68hc11_phys_addr (pinfo, insn_addr), + (long) (insn_addr)); + if (!((*info->callbacks->warning) + (info, buf, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + if (phys_page != 0 && insn_page == 0) + { + const char* msg; + char* buf; + + msg = _("reference to a banked address [%lx:%04lx] in the " + "normal address space at %04lx"); + + buf = alloca (strlen (msg) + 128); + sprintf (buf, msg, phys_page, phys_addr, insn_addr); + if (!((*info->callbacks->warning) + (info, buf, name, input_bfd, input_section, + insn_addr))) + return FALSE; + + relocation = phys_addr; + break; + } + + /* If this is a banked address use the phys_addr so that + we stay in the banked window. */ + if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend)) + relocation = phys_addr; + break; + } + if (r_type != R_M68HC11_NONE) + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) 0; + + switch (r) + { + case bfd_reloc_overflow: + if (!((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _ ("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _ ("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _ ("internal error: dangerous error"); + goto common_error; + + default: + msg = _ ("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + + + +/* Set and control ELF flags in ELF header. */ + +bfd_boolean +_bfd_m68hc11_elf_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; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +bfd_boolean +_bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags; + flagword new_flags; + bfd_boolean ok = TRUE; + + /* Check if we have the same endianess */ + if (!_bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + new_flags = elf_elfheader (ibfd)->e_flags; + elf_elfheader (obfd)->e_flags |= new_flags & EF_M68HC11_ABI; + old_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + elf_elfheader (obfd)->e_ident[EI_CLASS] + = elf_elfheader (ibfd)->e_ident[EI_CLASS]; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + { + if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd))) + return FALSE; + } + + return TRUE; + } + + /* Check ABI compatibility. */ + if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for 16-bit integers (-mshort) " + "and others for 32-bit integers"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for 32-bit double (-fshort-double) " + "and others for 64-bit double"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + new_flags &= ~EF_M68HC11_ABI; + old_flags &= ~EF_M68HC11_ABI; + + /* Warn about any other mismatches */ + if (new_flags != old_flags) + { + (*_bfd_error_handler) + (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + bfd_archive_filename (ibfd), (unsigned long) new_flags, + (unsigned long) old_flags); + ok = FALSE; + } + + if (! ok) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; +} + +bfd_boolean +_bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + if (elf_elfheader (abfd)->e_flags & E_M68HC11_I32) + fprintf (file, _("[abi=32-bit int, ")); + else + fprintf (file, _("[abi=16-bit int, ")); + + if (elf_elfheader (abfd)->e_flags & E_M68HC11_F64) + fprintf (file, _("64-bit double, ")); + else + fprintf (file, _("32-bit double, ")); + + if (strcmp (bfd_get_target (abfd), "elf32-m68hc11") == 0) + fprintf (file, _("cpu=HC11]")); + else if (elf_elfheader (abfd)->e_flags & EF_M68HCS12_MACH) + fprintf (file, _("cpu=HCS12]")); + else + fprintf (file, _("cpu=HC12]")); + + if (elf_elfheader (abfd)->e_flags & E_M68HC12_BANKS) + fprintf (file, _(" [memory=bank-model]")); + else + fprintf (file, _(" [memory=flat]")); + + fputc ('\n', file); + + return TRUE; +} + +static void scan_sections_for_abi (abfd, asect, arg) + bfd* abfd ATTRIBUTE_UNUSED; + asection* asect; + PTR arg; +{ + struct m68hc11_scan_param* p = (struct m68hc11_scan_param*) arg; + + if (asect->vma >= p->pinfo->bank_virtual) + p->use_memory_banks = TRUE; +} + +/* Tweak the OSABI field of the elf header. */ + +void +elf32_m68hc11_post_process_headers (abfd, link_info) + bfd *abfd; + struct bfd_link_info *link_info; +{ + struct m68hc11_scan_param param; + + if (link_info == 0) + return; + + m68hc11_elf_get_bank_parameters (link_info); + + param.use_memory_banks = FALSE; + param.pinfo = &m68hc11_elf_hash_table (link_info)->pinfo; + bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m); + if (param.use_memory_banks) + { + Elf_Internal_Ehdr * i_ehdrp; + + i_ehdrp = elf_elfheader (abfd); + i_ehdrp->e_flags |= E_M68HC12_BANKS; + } +} + diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h new file mode 100644 index 0000000..e70c172 --- /dev/null +++ b/bfd/elf32-m68hc1x.h @@ -0,0 +1,205 @@ +/* Motorola 68HC11/68HC12-specific support for 32-bit ELF + Copyright 2003 Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + +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 _ELF32_M68HC1X_H +#define _ELF32_M68HC1X_H + +#include "elf-bfd.h" +#include "bfdlink.h" +#include "elf/m68hc11.h" + +/* Name of symbols exported by HC11/HC12 linker when there is a memory + bank window. */ +#define BFD_M68HC11_BANK_START_NAME "__bank_start" +#define BFD_M68HC11_BANK_SIZE_NAME "__bank_size" +#define BFD_M68HC11_BANK_VIRTUAL_NAME "__bank_virtual" + +/* Set and control ELF flags in ELF header. */ +extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data PARAMS ((bfd*,bfd*)); +extern bfd_boolean _bfd_m68hc11_elf_set_private_flags PARAMS ((bfd*,flagword)); +extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data PARAMS ((bfd*,PTR)); + +/* This hash entry is used to record a trampoline that must be generated + to call a far function using a normal calling convention ('jsr'). + The trampoline is used when a pointer to a far function is used. + It takes care of installing the proper memory bank as well as creating + the 'call/rtc' calling convention. */ +struct elf32_m68hc11_stub_hash_entry { + + /* Base hash table entry structure. */ + struct bfd_hash_entry root; + + /* The stub section. */ + asection *stub_sec; + + /* Offset within stub_sec of the beginning of this stub. */ + bfd_vma stub_offset; + + /* Given the symbol's value and its section we can determine its final + value when building the stubs (so the stub knows where to jump. */ + bfd_vma target_value; + asection *target_section; +}; + +/* Placeholder for the parameters to compute memory page and physical address. + The following formulas are used: + + sym > bank_virtual => + %addr(sym) = (((sym - bank_virtual) & bank_mask) + bank_physical + %page(sym) = (((sym - bank_virtual) >> bank_shift) % 256 + + sym < bank_virtual => + %addr(sym) = sym + %page(sym) = 0 + + + These parameters are obtained from the symbol table by looking + at the following: + + __bank_start Symbol marking the start of memory bank window + (bank_physical) + __bank_virtual Logical address of symbols for which the transformation + must be computed + __bank_page_size Size in bytes of page size (this is *NOT* the memory + bank window size and the window size is always + less or equal to the page size) + + For 68HC12, the window is at 0x8000 and the page size is 16K (full window). + For 68HC11 this is board specific (implemented by external hardware). + +*/ +struct m68hc11_page_info +{ + bfd_vma bank_virtual; + bfd_vma bank_physical; + bfd_vma bank_physical_end; + bfd_vma bank_mask; + bfd_vma bank_size; + int bank_shift; + int bank_param_initialized; + bfd_vma trampoline_addr; +}; + +struct m68hc11_elf_link_hash_table +{ + struct elf_link_hash_table root; + struct m68hc11_page_info pinfo; + + /* The stub hash table. */ + struct bfd_hash_table* stub_hash_table; + + /* Linker stub bfd. */ + bfd *stub_bfd; + + asection* stub_section; + asection* tramp_section; + + /* Linker call-backs. */ + asection * (*add_stub_section) PARAMS ((const char *, asection *)); + + /* Assorted information used by elf32_hppa_size_stubs. */ + unsigned int bfd_count; + int top_index; + asection **input_list; + Elf_Internal_Sym **all_local_syms; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, PTR)); + bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, PTR)); +}; + +/* Get the Sparc64 ELF linker hash table from a link_info structure. */ + +#define m68hc11_elf_hash_table(p) \ + ((struct m68hc11_elf_link_hash_table *) ((p)->hash)) + +/* Create a 68HC11/68HC12 ELF linker hash table. */ + +extern struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create + PARAMS ((bfd*)); +extern void m68hc11_elf_bfd_link_hash_table_free + PARAMS ((struct bfd_link_hash_table*)); + +extern void m68hc11_elf_get_bank_parameters + PARAMS ((struct bfd_link_info*)); + +/* Return 1 if the address is in banked memory. + This can be applied to a virtual address and to a physical address. */ +extern int m68hc11_addr_is_banked + PARAMS ((struct m68hc11_page_info*, bfd_vma)); + +/* Return the physical address seen by the processor, taking + into account banked memory. */ +extern bfd_vma m68hc11_phys_addr + PARAMS ((struct m68hc11_page_info*, bfd_vma)); + +/* Return the page number corresponding to an address in banked memory. */ +extern bfd_vma m68hc11_phys_page + PARAMS ((struct m68hc11_page_info*, bfd_vma)); + +bfd_reloc_status_type m68hc11_elf_ignore_reloc + PARAMS ((bfd *abfd, arelent *reloc_entry, + asymbol *symbol, PTR data, asection *input_section, + bfd *output_bfd, char **error_message)); +bfd_reloc_status_type m68hc11_elf_special_reloc + PARAMS ((bfd *abfd, arelent *reloc_entry, + asymbol *symbol, PTR data, asection *input_section, + bfd *output_bfd, char **error_message)); + +/* GC mark and sweep. */ +asection *elf32_m68hc11_gc_mark_hook + PARAMS ((asection *sec, struct bfd_link_info *info, + Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym)); +bfd_boolean elf32_m68hc11_gc_sweep_hook + PARAMS ((bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs)); +bfd_boolean elf32_m68hc11_check_relocs + PARAMS ((bfd * abfd, struct bfd_link_info * info, + asection * sec, const Elf_Internal_Rela * relocs)); +bfd_boolean elf32_m68hc11_relocate_section + PARAMS ((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)); + +bfd_boolean elf32_m68hc11_add_symbol_hook + PARAMS ((bfd *abfd, struct bfd_link_info *info, + const Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp, asection **secp, + bfd_vma *valp)); + +/* Tweak the OSABI field of the elf header. */ + +extern void elf32_m68hc11_post_process_headers + PARAMS ((bfd*, struct bfd_link_info*)); + +int elf32_m68hc11_setup_section_lists + PARAMS ((bfd *, struct bfd_link_info *)); + +bfd_boolean elf32_m68hc11_size_stubs + PARAMS ((bfd *, bfd *, struct bfd_link_info *, + asection * (*) PARAMS ((const char *, asection *)))); + +bfd_boolean elf32_m68hc11_build_stubs + PARAMS ((bfd* abfd, struct bfd_link_info *)); +#endif diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 186f39d..22cff53 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -16,8 +16,9 @@ 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. */ + along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ /* This file is based on a preliminary PowerPC ELF ABI. The information may not match the final PowerPC ELF ABI. It includes @@ -152,7 +153,7 @@ static bfd_boolean ppc_elf_grok_psinfo 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) \ +#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ ((! INFO->shared \ || INFO->symbolic \ || H->dynindx == -1 \ @@ -161,7 +162,7 @@ static bfd_boolean ppc_elf_grok_psinfo && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) /* Will _calls_ to this symbol always call the version in this object? */ -#define SYMBOL_CALLS_LOCAL(INFO, H) \ +#define SYMBOL_CALLS_LOCAL(INFO, H) \ ((! INFO->shared \ || INFO->symbolic \ || H->dynindx == -1 \ @@ -198,7 +199,7 @@ struct ppc_elf_link_hash_entry struct ppc_elf_dyn_relocs *dyn_relocs; /* Contexts in which symbol is used in the GOT (or TOC). - TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the + TLS_GD .. TLS_TLS bits are or'd into the mask as the corresponding relocs are encountered during check_relocs. tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to indicate the corresponding GOT entry type is not needed. */ @@ -319,6 +320,12 @@ ppc_elf_link_hash_table_create (abfd) return &ret->elf.root; } +/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss + section, and instead use a dynamic relocation to point into the + shared lib. */ +#define ELIMINATE_COPY_RELOCS 1 + /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void @@ -367,7 +374,16 @@ ppc_elf_copy_indirect_symbol (bed, dir, ind) edir->tls_mask |= eind->tls_mask; - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect) + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->elf_link_hash_flags |= + (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + else + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max]; @@ -1613,10 +1629,14 @@ ppc_elf_howto_init () { unsigned int i, type; - for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++) + for (i = 0; + i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); + i++) { type = ppc_elf_howto_raw[i].type; - BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0])); + if (type >= (sizeof (ppc_elf_howto_table) + / sizeof (ppc_elf_howto_table[0]))) + abort (); ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i]; } } @@ -1630,7 +1650,8 @@ ppc_elf_howto_init () 2/ The branch is predicted as not taken. 3/ The branch is taken. 4/ The branch is located in the last 5 words of a page. - (The EOP limit is 5 by default but may be specified as any value from 1-10.) + (The EOP limit is 5 by default but may be specified as any value + from 1-10.) Our software solution is to detect these problematic branches in a linker pass and modify them as follows: @@ -2455,12 +2476,6 @@ ppc_elf_create_dynamic_sections (abfd, info) return bfd_set_section_flags (abfd, s, flags); } -/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid - copying dynamic variables from a shared lib into an app's dynbss - section, and instead use a dynamic relocation to point into the - shared lib. */ -#define ELIMINATE_COPY_RELOCS 1 - /* 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 @@ -2500,7 +2515,7 @@ ppc_elf_adjust_dynamic_symbol (info, h) /* Clear procedure linkage table information for any symbol that won't need a .plt entry. */ if (! htab->elf.dynamic_sections_created - || SYMBOL_CALLS_LOCAL (info, h) + || SYMBOL_CALLS_LOCAL (info, h) || h->plt.refcount <= 0) { /* A PLT entry is not required/allowed when: diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 8eb9a49..35a4dda 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -1,4 +1,4 @@ -/* Renesas SH specific support for 32-bit ELF +/* Renesas / SuperH SH specific support for 32-bit ELF Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. @@ -90,6 +90,8 @@ static bfd_boolean sh_elf_create_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); static bfd_vma dtpoff_base PARAMS ((struct bfd_link_info *)); +static bfd_vma tpoff + PARAMS ((struct bfd_link_info *, bfd_vma)); static asection * sh_elf_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); @@ -3525,9 +3527,6 @@ struct elf_sh_dyn_relocs /* Number of pc-relative relocs copied for the input section. */ bfd_size_type pc_count; - - /* If TRUE, R_SH_TLS_TPOFF32 relocation is generated. */ - bfd_boolean tls_tpoff32; }; /* sh ELF linker hash entry. */ @@ -4039,9 +4038,9 @@ sh_elf_adjust_dynamic_symbol (info, h) will be called from elflink.h. If elflink.h doesn't call our finish_dynamic_symbol routine, we'll need to do something about initializing any .plt and .got entries in sh_elf_relocate_section. */ -#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \ ((DYN) \ - && ((INFO)->shared \ + && ((SHARED) \ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ && ((H)->dynindx != -1 \ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) @@ -4095,7 +4094,8 @@ allocate_dynrelocs (h, inf) return FALSE; } - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) { asection *s = htab->splt; @@ -4162,14 +4162,15 @@ allocate_dynrelocs (h, inf) if (tls_type == GOT_TLS_GD) s->_raw_size += 4; dyn = htab->root.dynamic_sections_created; - /* R_SH_TLS_IE_32 needs one dynamic relocation, + /* R_SH_TLS_IE_32 needs one dynamic relocation if dynamic, R_SH_TLS_GD needs one if local symbol and two if global. */ if ((tls_type == GOT_TLS_GD && h->dynindx == -1) - || tls_type == GOT_TLS_IE) + || (tls_type == GOT_TLS_IE && dyn)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); else if (tls_type == GOT_TLS_GD) htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); - else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + else if (info->shared || + WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); } else @@ -4194,7 +4195,7 @@ allocate_dynrelocs (h, inf) eh->datalabel_got.offset = s->_raw_size; s->_raw_size += 4; dyn = htab->root.dynamic_sections_created; - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); } else @@ -4231,10 +4232,6 @@ allocate_dynrelocs (h, inf) } else { - for (p = eh->dyn_relocs; p; p = p->next) - if (p->tls_tpoff32) - goto keep; - /* For the non-shared case, discard space for relocs against symbols which turn out to need copy relocs or are not dynamic. */ @@ -4752,7 +4749,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_SH_GOT_MEDLOW16 || r_type == R_SH_GOT_MEDHI16 || r_type == R_SH_GOT_HI16) - && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) && (! info->shared || (! info->symbolic && h->dynindx != -1) || (h->elf_link_hash_flags @@ -5052,7 +5049,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (off != (bfd_vma) -1); dyn = htab->root.dynamic_sections_created; - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) || (info->shared && (info->symbolic || h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) @@ -5280,17 +5277,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (! info->shared && (h->dynindx == -1 || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - struct elf_sh_dyn_relocs *p; - - /* If TPOFF32 relocation can be created, convert it. */ - for (p = sh_elf_hash_entry (h)->dyn_relocs; p; p = p->next) - if (p->sec == input_section && p->tls_tpoff32) - { - r_type = R_SH_TLS_LE_32; - break; - } - } + r_type = R_SH_TLS_LE_32; } if (r_type == R_SH_TLS_GD_32 && tls_type == GOT_TLS_IE) @@ -5300,9 +5287,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma offset; unsigned short insn; - int indx; - Elf_Internal_Rela outrel; - bfd_byte *loc; if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32) { @@ -5379,45 +5363,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); } - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - if (h == NULL - || h->dynindx == -1 - || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - indx = 0; - else - indx = h->dynindx; - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - outrel.r_info = ELF32_R_INFO (indx, R_SH_TLS_TPOFF32); - if (indx == 0) - outrel.r_addend = relocation - dtpoff_base (info); - else - outrel.r_addend = 0; - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset); continue; } @@ -5435,6 +5382,18 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, off = local_got_offsets[r_symndx]; } + /* Relocate R_SH_TLS_IE_32 directly when statically linking. */ + if (r_type == R_SH_TLS_IE_32 + && ! htab->root.dynamic_sections_created) + { + off &= ~1; + bfd_put_32 (output_bfd, tpoff (info, relocation), + sgot->contents + off); + bfd_put_32 (output_bfd, sgot->output_offset + off, + contents + rel->r_offset); + continue; + } + if ((off & 1) != 0) off &= ~1; else @@ -5452,13 +5411,11 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset = (sgot->output_section->vma + sgot->output_offset + off); - if (h == NULL - || h->dynindx == -1 - || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + if (h == NULL || h->dynindx == -1) indx = 0; else indx = h->dynindx; + dr_type = (r_type == R_SH_TLS_GD_32 ? R_SH_TLS_DTPMOD32 : R_SH_TLS_TPOFF32); if (dr_type == R_SH_TLS_TPOFF32 && indx == 0) @@ -5640,46 +5597,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_SH_TLS_LDO_32: if (! info->shared) - { - int indx; - Elf_Internal_Rela outrel; - bfd_byte *loc; - - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - indx = (h && h->dynindx != -1) ? h->dynindx : 0; - outrel.r_offset = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - outrel.r_info = ELF32_R_INFO (indx, R_SH_TLS_TPOFF32); - if (indx == 0) - outrel.r_addend = relocation - dtpoff_base (info); - else - outrel.r_addend = 0; - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - continue; - } + relocation = tpoff (info, relocation); else relocation -= dtpoff_base (info); @@ -5692,6 +5610,13 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Rela outrel; bfd_byte *loc; + if (! info->shared) + { + relocation = tpoff (info, relocation); + addend = rel->r_addend; + goto final_link_relocate; + } + if (sreloc == NULL) { const char *name; @@ -5712,7 +5637,11 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (sreloc != NULL); } - indx = (h && h->dynindx != -1) ? h->dynindx : 0; + if (h == NULL || h->dynindx == -1) + indx = 0; + else + indx = h->dynindx; + outrel.r_offset = (input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -5882,12 +5811,27 @@ static bfd_vma dtpoff_base (info) struct bfd_link_info *info; { - /* If tls_segment is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_segment == NULL) - return 0; + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; return elf_hash_table (info)->tls_segment->start; } +/* Return the relocation value for R_SH_TLS_TPOFF32.. */ + +static bfd_vma +tpoff (info, address) + struct bfd_link_info *info; + bfd_vma address; +{ + /* If tls_segment is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_segment == NULL) + return 0; + /* SH TLS ABI is variant I and static TLS block start just after tcbhead + structure which has 2 pointer fields. */ + return (address - dtpoff_base (info) + 8); +} + static asection * sh_elf_gc_mark_hook (sec, info, rel, h, sym) asection *sec; @@ -6349,12 +6293,12 @@ sh_elf_check_relocs (abfd, info, sec, relocs) return FALSE; break; - force_got: case R_SH_TLS_IE_32: if (info->shared) info->flags |= DF_STATIC_TLS; /* FALLTHROUGH */ + force_got: case R_SH_TLS_GD_32: case R_SH_GOT32: #ifdef INCLUDE_SHMEDIA @@ -6633,7 +6577,6 @@ sh_elf_check_relocs (abfd, info, sec, relocs) p->sec = sec; p->count = 0; p->pc_count = 0; - p->tls_tpoff32 = FALSE; } p->count += 1; @@ -6651,92 +6594,10 @@ sh_elf_check_relocs (abfd, info, sec, relocs) return FALSE; } - if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_LD_32) - break; + break; - /* FALLTHROUGH */ case R_SH_TLS_LDO_32: - /* We make a R_SH_TLS_TPOFF32 relocation. Count it as a - copy relocation. */ - if (! info->shared) - { - struct elf_sh_dyn_relocs *p; - struct elf_sh_dyn_relocs **head; - - if (dynobj == NULL) - htab->root.dynobj = dynobj = abfd; - - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, name); - flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 2)) - return FALSE; - } - elf_section_data (sec)->sreloc = sreloc; - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; - } - - /* If this is a global symbol, we count the number of - relocations we need for this symbol. */ - if (h != NULL) - head = &((struct elf_sh_link_hash_entry *) h)->dyn_relocs; - else - { - asection *s; - - /* Track dynamic relocs needed for local syms too. */ - s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, - sec, r_symndx); - if (s == NULL) - return FALSE; - - head = ((struct elf_sh_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - } - - p = *head; - if (p == NULL || p->sec != sec) - { - bfd_size_type amt = sizeof (*p); - p = ((struct elf_sh_dyn_relocs *) bfd_alloc (dynobj, amt)); - if (p == NULL) - return FALSE; - p->next = *head; - *head = p; - p->sec = sec; - p->count = 0; - p->pc_count = 0; - p->tls_tpoff32 = FALSE; - } - - p->count += 1; - p->tls_tpoff32 = TRUE; - } + /* Nothing to do. */ break; default: diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c index f14a042..b7ae364 100644 --- a/bfd/elf32-sh64-com.c +++ b/bfd/elf32-sh64-com.c @@ -1,4 +1,4 @@ -/* Renesas SH64-specific support for 32-bit ELF +/* SuperH SH64-specific support for 32-bit ELF Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index dc21b54..1a2acc1 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -1,4 +1,4 @@ -/* Renesas SH64-specific support for 32-bit ELF +/* SuperH SH64-specific support for 32-bit ELF Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index bf18e205..4a2658a 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -305,7 +305,9 @@ alpha_elf_dynamic_symbol_p (h, info) if ((info->shared && !info->symbolic) || ((h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) + & (ELF_LINK_HASH_DEF_DYNAMIC + | ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR)) == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) return TRUE; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 5a2f89a..122490e 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1,4 +1,4 @@ -/* Renesas SH64-specific support for 64-bit ELF +/* SuperH SH64-specific support for 64-bit ELF Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elflink.h b/bfd/elflink.h index 12f91ef..61505e0 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -42,7 +42,7 @@ static bfd_boolean elf_merge_symbol PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection **, bfd_vma *, struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *, - bfd_boolean *, bfd_boolean)); + bfd_boolean *, bfd_boolean *, bfd_boolean)); static bfd_boolean elf_add_default_symbol PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, const char *, Elf_Internal_Sym *, asection **, bfd_vma *, @@ -463,7 +463,7 @@ elf_link_add_archive_symbols (abfd, info) a shared object. */ static bfd_boolean -elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, +elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, skip, override, type_change_ok, size_change_ok, dt_needed) bfd *abfd; struct bfd_link_info *info; @@ -472,6 +472,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, asection **psec; bfd_vma *pvalue; struct elf_link_hash_entry **sym_hash; + bfd_boolean *skip; bfd_boolean *override; bfd_boolean *type_change_ok; bfd_boolean *size_change_ok; @@ -479,10 +480,12 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, { asection *sec; struct elf_link_hash_entry *h; + struct elf_link_hash_entry *flip; int bind; bfd *oldbfd; bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon; + *skip = FALSE; *override = FALSE; sec = *psec; @@ -605,6 +608,57 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, else olddef = TRUE; + /* We need to rememeber if a symbol has a definition in a dynamic + object or is weak in all dynamic objects. Internal and hidden + visibility will make it unavailable to dynamic objects. */ + if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0) + { + if (!bfd_is_und_section (sec)) + h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_DEF; + else + { + /* Check if this symbol is weak in all dynamic objects. If it + is the first time we see it in a dynamic object, we mark + if it is weak. Otherwise, we clear it. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + { + if (bind == STB_WEAK) + h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_WEAK; + } + else if (bind != STB_WEAK) + h->elf_link_hash_flags &= ~ELF_LINK_DYNAMIC_WEAK; + } + } + + /* If the old symbol has non-default visibility, we ignore the new + definition from a dynamic object. */ + if (newdyn + && ELF_ST_VISIBILITY (h->other) + && !bfd_is_und_section (sec)) + { + *skip = TRUE; + /* Make sure this symbol is dynamic. */ + h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + /* FIXME: Should we check type and size for protected symbol? */ + return _bfd_elf_link_record_dynamic_symbol (info, h); + } + else if (!newdyn + && ELF_ST_VISIBILITY (sym->st_other) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) + { + /* If the new symbol with non-default visibility comes from a + relocatable file and the old definition comes from a dynamic + object, we remove the old definition. */ + h->root.type = bfd_link_hash_new; + h->root.u.undef.abfd = NULL; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC; + h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + /* FIXME: Should we check type and size for protected symbol? */ + h->size = 0; + h->type = 0; + return TRUE; + } + /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old symbol, respectively, appears to be a common symbol in a dynamic object. If a symbol appears in an uninitialized section, and is @@ -769,6 +823,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, As above, we permit a non-weak definition in a shared object to override a weak definition in a regular object. */ + flip = NULL; if (! newdyn && (newdef || (bfd_is_com_section (sec) @@ -797,19 +852,13 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, if (bfd_is_com_section (sec)) *type_change_ok = TRUE; - /* This union may have been set to be non-NULL when this symbol - was seen in a dynamic object. We must force the union to be - NULL, so that it is correct for a regular symbol. */ - - h->verinfo.vertree = NULL; - - /* In this special case, if H is the target of an indirection, - we want the caller to frob with H rather than with the - indirect symbol. That will permit the caller to redefine the - target of the indirection, rather than the indirect symbol - itself. FIXME: This will break the -y option if we store a - symbol with a different name. */ - *sym_hash = h; + if ((*sym_hash)->root.type == bfd_link_hash_indirect) + flip = *sym_hash; + else + /* This union may have been set to be non-NULL when this symbol + was seen in a dynamic object. We must force the union to be + NULL, so that it is correct for a regular symbol. */ + h->verinfo.vertree = NULL; } /* Handle the special case of a new common symbol merging with an @@ -849,7 +898,28 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, *size_change_ok = TRUE; *type_change_ok = TRUE; - h->verinfo.vertree = NULL; + if ((*sym_hash)->root.type == bfd_link_hash_indirect) + flip = *sym_hash; + else + h->verinfo.vertree = NULL; + } + + if (flip != NULL) + { + /* Handle the case where we had a versioned symbol in a dynamic + library and now find a definition in a normal object. In this + case, we make the versioned symbol point to the normal one. */ + struct elf_backend_data *bed = get_elf_backend_data (abfd); + flip->root.type = h->root.type; + h->root.type = bfd_link_hash_indirect; + h->root.u.i.link = (struct bfd_link_hash_entry *) flip; + (*bed->elf_backend_copy_indirect_symbol) (bed, flip, h); + flip->root.u.undef.abfd = h->root.u.undef.abfd; + if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC; + flip->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + } } /* Handle the special case of a weak definition in a regular object @@ -883,7 +953,7 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, /* Handle the special case of a non-weak definition in a shared object followed by a weak definition in a regular object. In - this case we prefer to definition in the shared object. To make + this case we prefer the definition in the shared object. To make this work we have to tell the caller to not treat the new symbol as a definition. */ if (olddef @@ -919,6 +989,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value, { bfd_boolean type_change_ok; bfd_boolean size_change_ok; + bfd_boolean skip; char *shortname; struct elf_link_hash_entry *hi; struct bfd_link_hash_entry *bh; @@ -974,7 +1045,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value, size_change_ok = FALSE; sec = *psec; if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &override, &type_change_ok, + &hi, &skip, &override, &type_change_ok, &size_change_ok, dt_needed)) return FALSE; @@ -1083,7 +1154,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value, size_change_ok = FALSE; sec = *psec; if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &override, &type_change_ok, + &hi, &skip, &override, &type_change_ok, &size_change_ok, dt_needed)) return FALSE; @@ -1725,6 +1796,7 @@ elf_link_add_object_symbols (abfd, info) { Elf_Internal_Versym iver; unsigned int vernum = 0; + bfd_boolean skip; if (ever != NULL) { @@ -1822,10 +1894,14 @@ elf_link_add_object_symbols (abfd, info) } if (! elf_merge_symbol (abfd, info, name, isym, &sec, &value, - sym_hash, &override, &type_change_ok, - &size_change_ok, dt_needed)) + sym_hash, &skip, &override, + &type_change_ok, &size_change_ok, + dt_needed)) goto error_free_vers; + if (skip) + continue; + if (override) definition = FALSE; @@ -2005,9 +2081,10 @@ elf_link_add_object_symbols (abfd, info) h->type = ELF_ST_TYPE (isym->st_info); } - /* If st_other has a processor-specific meaning, specific code - might be needed here. */ - if (isym->st_other != 0) + /* If st_other has a processor-specific meaning, specific + code might be needed here. We never merge the visibility + attribute with the one from a dynamic object. */ + if (isym->st_other != 0 && !dynamic) { unsigned char hvis, symvis, other, nvis; @@ -2074,7 +2151,7 @@ elf_link_add_object_symbols (abfd, info) override, dt_needed)) goto error_free_vers; - if (definition && (abfd->flags & DYNAMIC) == 0) + if (definition && !dynamic) { char *p = strchr (name, ELF_VER_CHR); if (p != NULL && p[1] != ELF_VER_CHR) @@ -6091,7 +6168,7 @@ elf_link_check_versioned_symbol (info, h) if ((undef_bfd->flags & DYNAMIC) == 0 || info->hash->creator->flavour != bfd_target_elf_flavour - || elf_dt_soname (h->root.u.undef.abfd) == NULL) + || elf_dt_soname (undef_bfd) == NULL) return FALSE; for (loaded = elf_hash_table (info)->loaded; @@ -6258,6 +6335,28 @@ elf_link_output_extsym (h, data) } } + /* We should also warn if a forced local symbol is referenced from + shared libraries. */ + if (! finfo->info->relocateable + && (! finfo->info->shared || ! finfo->info->allow_shlib_undefined) + && (h->elf_link_hash_flags + & (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_DYNAMIC_DEF | ELF_LINK_DYNAMIC_WEAK)) + == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC)) + { + (*_bfd_error_handler) + (_("%s: %s symbol `%s' in %s is referenced by DSO"), + bfd_get_filename (finfo->output_bfd), + ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + ? "internal" + : ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + ? "hidden" : "local", + h->root.root.string, + bfd_archive_filename (h->root.u.def.section->owner)); + eoinfo->failed = TRUE; + return FALSE; + } + /* We don't want to output symbols that have never been mentioned by a regular file, or that we have been told to strip. However, if h->indx is set to -2, the symbol is used by a reloc and we must @@ -6418,10 +6517,25 @@ elf_link_output_extsym (h, data) sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info)); } - /* If a symbol is not defined locally, we clear the visibility field. */ + /* If a non-weak symbol with non-default visibility is not defined + locally, it is a fatal error. */ if (! finfo->info->relocateable + && ELF_ST_VISIBILITY (sym.st_other) + && ELF_ST_BIND (sym.st_info) != STB_WEAK + && h->root.type != bfd_link_hash_undefweak && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - sym.st_other &= ~ ELF_ST_VISIBILITY (-1); + { + (*_bfd_error_handler) + (_("%s: %s symbol `%s' isn't defined"), + bfd_get_filename (finfo->output_bfd), + ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED + ? "protected" + : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL + ? "internal" : "hidden", + h->root.root.string); + eoinfo->failed = TRUE; + return FALSE; + } /* If this symbol should be put in the .dynsym section, then put it there now. We already know the symbol index. We also fill in diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index bff78c8..946157f 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -704,9 +704,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) if (link_info->hash->creator->flavour != bfd_target_elf_flavour) return FALSE; - /* Nothing to do if there are no relocations. */ + /* Nothing to do if there are no relocations or there is no need for + the relax finalize pass. */ if ((sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) + || sec->reloc_count == 0 + || (link_info->relax_finalizing + && sec->need_finalize_relax == 0)) return TRUE; /* If this is the first time we have been called for this section, @@ -756,11 +759,18 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: + if (link_info->relax_finalizing) + continue; is_branch = TRUE; break; case R_IA64_LTOFF22X: case R_IA64_LDXMOV: + if (!link_info->relax_finalizing) + { + sec->need_finalize_relax = 1; + continue; + } is_branch = FALSE; break; @@ -1047,6 +1057,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* ??? Resize .rela.got too. */ } + if (link_info->relax_finalizing) + sec->need_finalize_relax = 0; + *again = changed_contents || changed_relocs; return TRUE; diff --git a/bfd/reloc.c b/bfd/reloc.c index f3f6428..6aea881 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2727,7 +2727,7 @@ ENUMX ENUMX BFD_RELOC_SH_TLS_TPOFF32 ENUMDOC - Renesas SH relocs. Not all of these appear in object files. + Renesas / SuperH SH relocs. Not all of these appear in object files. ENUM BFD_RELOC_THUMB_PCREL_BRANCH9 @@ -2854,7 +2854,7 @@ ENUMDOC ENUM BFD_RELOC_M32R_24 ENUMDOC - Mitsubishi M32R relocs. + Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit absolute address. ENUM BFD_RELOC_M32R_10_PCREL diff --git a/bfd/section.c b/bfd/section.c index 89f8126..04f439e 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -396,8 +396,10 @@ CODE_FRAGMENT . {* Bits used by various backends. *} . unsigned int has_tls_reloc:1; . +. {* Nonzero if this section needs the relax finalize pass. *} +. unsigned int need_finalize_relax:1; +. . {* Usused bits. *} -. unsigned int flag11:1; . unsigned int flag12:1; . unsigned int flag13:1; . unsigned int flag14:1; @@ -615,8 +617,8 @@ static const asymbol global_syms[] = /* linker_mark, linker_has_input, gc_mark, segment_mark, */ \ 0, 0, 1, 0, \ \ - /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, */ \ - 0, 0, 0, 0, 0, \ + /* sec_info_type, use_rela_p, has_tls_reloc, need_finalize_relax, flag12, */ \ + 0, 0, 0, 0, 0, \ \ /* flag13, flag14, flag15, flag16, flag20, flag24, */ \ 0, 0, 0, 0, 0, 0, \ diff --git a/bfd/version.h b/bfd/version.h index 0d88243..a3d70e0 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030419 +#define BFD_VERSION_DATE 20030430 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/config-ml.in b/config-ml.in index aae3f87..e69de29 100644 --- a/config-ml.in +++ b/config-ml.in @@ -1,843 +0,0 @@ -# Configure fragment invoked in the post-target section for subdirs -# wanting multilib support. -# -# It is advisable to support a few --enable/--disable options to let the -# user select which libraries s/he really wants. -# -# Subdirectories wishing to use multilib should put the following lines -# in the "post-target" section of configure.in. -# -# if [ "${srcdir}" = "." ] ; then -# if [ "${with_target_subdir}" != "." ] ; then -# . ${with_multisrctop}../../config-ml.in -# else -# . ${with_multisrctop}../config-ml.in -# fi -# else -# . ${srcdir}/../config-ml.in -# fi -# -# See librx/configure.in in the libg++ distribution for an example of how -# to handle autoconf'd libraries. -# -# Things are complicated because 6 separate cases must be handled: -# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6. -# -# srcdir=. is special. It must handle make programs that don't handle VPATH. -# To implement this, a symlink tree is built for each library and for each -# multilib subdir. -# -# The build tree is layed out as -# -# ./ -# libg++ -# newlib -# m68020/ -# libg++ -# newlib -# m68881/ -# libg++ -# newlib -# -# The nice feature about this arrangement is that inter-library references -# in the build tree work without having to care where you are. Note that -# inter-library references also work in the source tree because symlink trees -# are built when srcdir=. -# -# Unfortunately, trying to access the libraries in the build tree requires -# the user to manually choose which library to use as GCC won't be able to -# find the right one. This is viewed as the lesser of two evils. -# -# Configure variables: -# ${with_target_subdir} = "." for native, or ${target_alias} for cross. -# Set by top level Makefile. -# ${with_multisrctop} = how many levels of multilibs there are in the source -# tree. It exists to handle the case of configuring in the source tree: -# ${srcdir} is not constant. -# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). -# -# Makefile variables: -# MULTISRCTOP = number of multilib levels in source tree (+1 if cross) -# (FIXME: note that this is different than ${with_multisrctop}. Check out.). -# MULTIBUILDTOP = number of multilib levels in build tree -# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) -# (only defined in each library's main Makefile). -# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) -# (only defined in each multilib subdir). - -# FIXME: Multilib is currently disabled by default for everything other than -# newlib. It is up to each target to turn on multilib support for the other -# libraries as desired. - -# We have to handle being invoked by both Cygnus configure and Autoconf. -# -# Cygnus configure incoming variables: -# srcdir, subdir, host, arguments -# -# Autoconf incoming variables: -# srcdir, host, ac_configure_args -# -# We *could* figure srcdir and host out, but we'd have to do work that -# our caller has already done to figure them out and requiring these two -# seems reasonable. -# Note that `host' in this case is GCC's `target'. Target libraries are -# configured for a particular host. - -if [ -n "${ac_configure_args}" ]; then - Makefile=${ac_file-Makefile} - ml_config_shell=${CONFIG_SHELL-/bin/sh} - ml_arguments="${ac_configure_args}" - ml_realsrcdir=${srcdir} -else - Makefile=${Makefile-Makefile} - ml_config_shell=${config_shell-/bin/sh} - ml_arguments="${arguments}" - if [ -n "${subdir}" -a "${subdir}" != "." ] ; then - ml_realsrcdir=${srcdir}/${subdir} - else - ml_realsrcdir=${srcdir} - fi -fi - -# Scan all the arguments and set all the ones we need. - -ml_verbose=--verbose -for option in ${ml_arguments} -do - case $option in - --*) ;; - -*) option=-$option ;; - esac - - case $option in - --*=*) - optarg=`echo $option | sed -e 's/^[^=]*=//'` - ;; - esac - - case $option in - --disable-*) - enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` - eval $enableopt=no - ;; - --enable-*) - case "$option" in - *=*) ;; - *) optarg=yes ;; - esac - enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` - eval $enableopt="$optarg" - ;; - --norecursion | --no*) - ml_norecursion=yes - ;; - --silent | --sil* | --quiet | --q*) - ml_verbose=--silent - ;; - --verbose | --v | --verb*) - ml_verbose=--verbose - ;; - --with-*) - case "$option" in - *=*) ;; - *) optarg=yes ;; - esac - withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` - eval $withopt="$optarg" - ;; - --without-*) - withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` - eval $withopt=no - ;; - esac -done - -# Only do this if --enable-multilib. -if [ "${enable_multilib}" = yes ]; then - -# Compute whether this is the library's top level directory -# (ie: not a multilib subdirectory, and not a subdirectory like libg++/src). -# ${with_multisubdir} tells us we're in the right branch, but we could be -# in a subdir of that. -# ??? The previous version could void this test by separating the process into -# two files: one that only the library's toplevel configure.in ran (to -# configure the multilib subdirs), and another that all configure.in's ran to -# update the Makefile. It seemed reasonable to collapse all multilib support -# into one file, but it does leave us with having to perform this test. -ml_toplevel_p=no -if [ -z "${with_multisubdir}" ]; then - if [ "${srcdir}" = "." ]; then - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. - # ${with_target_subdir} = "." for native, otherwise target alias. - if [ "${with_target_subdir}" = "." ]; then - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then - ml_toplevel_p=yes - fi - else - if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then - ml_toplevel_p=yes - fi - fi - else - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then - ml_toplevel_p=yes - fi - fi -fi - -# If this is the library's top level directory, set multidirs to the -# multilib subdirs to support. This lives at the top because we need -# `multidirs' set right away. - -if [ "${ml_toplevel_p}" = yes ]; then - -multidirs= -for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do - dir=`echo $i | sed -e 's/;.*$//'` - if [ "${dir}" = "." ]; then - true - else - if [ -z "${multidirs}" ]; then - multidirs="${dir}" - else - multidirs="${multidirs} ${dir}" - fi - fi -done - -# Target libraries are configured for the host they run on, so we check -# $host here, not $target. - -case "${host}" in -arc-*-elf*) - if [ x$enable_biendian != xyes ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *be*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -arm-*-*) - if [ x"$enable_fpu" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *fpu*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_26bit" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *26bit*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_underscore" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *under*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_interwork" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *interwork*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *le* ) : ;; - *be* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_nofmult" = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *nofmult* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -m68*-*-*) - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68881 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68881* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68000 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68000* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68020 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68020* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -mips*-*-*) - if [ x$enable_single_float = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *single* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *el* ) : ;; - *eb* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - case " $multidirs " in - *" mabi=64 "*) - # We will not be able to create libraries with -mabi=64 if - # we cannot even link a trivial program. It usually - # indicates the 64bit libraries are missing. - if echo 'main() {}' > conftest.c && - ${CC-gcc} -mabi=64 conftest.c -o conftest; then - : - else - echo Could not link program with -mabi=64, disabling it. - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mabi=64* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - rm -f conftest.c conftest - ;; - esac - ;; -powerpc*-*-* | rs6000*-*-*) - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powercpu = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - power | */power | */power/* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powerpccpu = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *powerpc* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powerpcos = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mcall-linux* | *mcall-solaris* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mlittle* | *mbig* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_sysv = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mcall-sysv* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_aix = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mcall-aix* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -sparc*-*-*) - case " $multidirs " in - *" m64 "*) - # We will not be able to create libraries with -m64 if - # we cannot even link a trivial program. It usually - # indicates the 64bit libraries are missing. - if echo 'main() {}' > conftest.c && - ${CC-gcc} -m64 conftest.c -o conftest; then - : - else - echo Could not link program with -m64, disabling it. - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m64* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - rm -f conftest.c conftest - ;; - esac - ;; -esac - -# Remove extraneous blanks from multidirs. -# Tests like `if [ -n "$multidirs" ]' require it. -multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'` - -# Add code to library's top level makefile to handle building the multilib -# subdirs. - -cat > Multi.tem <<\EOF - -PWD=$${PWDCMD-pwd} - -# FIXME: There should be an @-sign in front of the `if'. -# Leave out until this is tested a bit more. -multi-do: - if [ -z "$(MULTIDIRS)" ]; then \ - true; \ - else \ - rootpre=`${PWD}`/; export rootpre; \ - srcrootpre=`cd $(srcdir); ${PWD}`/; export srcrootpre; \ - lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ - compiler="$(CC)"; \ - for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ - dir=`echo $$i | sed -e 's/;.*$$//'`; \ - if [ "$${dir}" = "." ]; then \ - true; \ - else \ - if [ -d ../$${dir}/$${lib} ]; then \ - flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ - if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ - CFLAGS="$(CFLAGS) $${flags}" \ - prefix="$(prefix)" \ - exec_prefix="$(exec_prefix)" \ - CXXFLAGS="$(CXXFLAGS) $${flags}" \ - LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ - LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ - LDFLAGS="$(LDFLAGS) $${flags}" \ - DESTDIR="$(DESTDIR)" \ - $(DO)); then \ - true; \ - else \ - exit 1; \ - fi; \ - else true; \ - fi; \ - fi; \ - done; \ - fi - -# FIXME: There should be an @-sign in front of the `if'. -# Leave out until this is tested a bit more. -multi-clean: - if [ -z "$(MULTIDIRS)" ]; then \ - true; \ - else \ - lib=`${PWD} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ - for dir in Makefile $(MULTIDIRS); do \ - if [ -f ../$${dir}/$${lib}/Makefile ]; then \ - if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ - then true; \ - else exit 1; \ - fi; \ - else true; \ - fi; \ - done; \ - fi -EOF - -cat ${Makefile} Multi.tem > Makefile.tem -rm -f ${Makefile} Multi.tem -mv Makefile.tem ${Makefile} - -fi # ${ml_toplevel_p} = yes - -if [ "${ml_verbose}" = --verbose ]; then - echo "Adding multilib support to Makefile in ${ml_realsrcdir}" - if [ "${ml_toplevel_p}" = yes ]; then - echo "multidirs=${multidirs}" - fi - echo "with_multisubdir=${with_multisubdir}" -fi - -if [ "${srcdir}" = "." ]; then - if [ "${with_target_subdir}" != "." ]; then - ml_srcdotdot="../" - else - ml_srcdotdot="" - fi -else - ml_srcdotdot="" -fi - -if [ -z "${with_multisubdir}" ]; then - ml_subdir= - ml_builddotdot= - : # ml_srcdotdot= # already set -else - ml_subdir="/${with_multisubdir}" - # The '[^/][^/]*' appears that way to work around a SunOS sed bug. - ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ - if [ "$srcdir" = "." ]; then - ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} - else - : # ml_srcdotdot= # already set - fi -fi - -if [ "${ml_toplevel_p}" = yes ]; then - ml_do='$(MAKE)' - ml_clean='$(MAKE)' -else - ml_do=true - ml_clean=true -fi - -# TOP is used by newlib and should not be used elsewhere for this purpose. -# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty -# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. -# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can -# delete TOP. Newlib may wish to continue to use TOP for its own purposes -# of course. -# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) -# and lists the subdirectories to recurse into. -# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile -# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with -# a leading '/'. -# MULTIDO is used for targets like all, install, and check where -# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. -# MULTICLEAN is used for the *clean targets. -# -# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are -# currently kept separate because we don't want the *clean targets to require -# the existence of the compiler (which MULTIDO currently requires) and -# therefore we'd have to record the directory options as well as names -# (currently we just record the names and use --print-multi-lib to get the -# options). - -sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ - -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ - -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ - -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ - -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ - -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ - -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ - ${Makefile} > Makefile.tem -rm -f ${Makefile} -mv Makefile.tem ${Makefile} - -# If this is the library's top level, configure each multilib subdir. -# This is done at the end because this is the loop that runs configure -# in each multilib subdir and it seemed reasonable to finish updating the -# Makefile before going on to configure the subdirs. - -if [ "${ml_toplevel_p}" = yes ]; then - -# We must freshly configure each subdirectory. This bit of code is -# actually partially stolen from the main configure script. FIXME. - -if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then - - if [ "${ml_verbose}" = --verbose ]; then - echo "Running configure in multilib subdirs ${multidirs}" - echo "pwd: `${PWDCMD-pwd}`" - fi - - ml_origdir=`${PWDCMD-pwd}` - ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` - # cd to top-level-build-dir/${with_target_subdir} - cd .. - - for ml_dir in ${multidirs}; do - - if [ "${ml_verbose}" = --verbose ]; then - echo "Running configure in multilib subdir ${ml_dir}" - echo "pwd: `${PWDCMD-pwd}`" - fi - - if [ -d ${ml_dir} ]; then true; else - # ``mkdir -p ${ml_dir}'' See also mkinstalldirs. - pathcomp="" - for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? - fi - if test ! -d "$pathcomp"; then - exit $lasterr - fi - pathcomp="$pathcomp/" - done - fi - if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi - - # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../ - dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` - - case ${srcdir} in - ".") - echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir} - if [ "${with_target_subdir}" != "." ]; then - ml_unsubdir="../" - else - ml_unsubdir="" - fi - (cd ${ml_dir}/${ml_libdir}; - ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") - if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then - if [ x"${MAKE}" = x ]; then - (cd ${ml_dir}/${ml_libdir}; make distclean) - else - (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean) - fi - fi - ml_newsrcdir="." - ml_srcdiroption= - multisrctop=${dotdot} - ;; - *) - case "${srcdir}" in - /*) # absolute path - ml_newsrcdir=${srcdir} - ;; - *) # otherwise relative - ml_newsrcdir=${dotdot}${srcdir} - ;; - esac - ml_srcdiroption="-srcdir=${ml_newsrcdir}" - multisrctop= - ;; - esac - - case "${progname}" in - /*) ml_recprog=${progname} ;; - *) ml_recprog=${dotdot}${progname} ;; - esac - - # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. - ML_POPDIR=`pwd` - cd ${ml_dir}/${ml_libdir} - - if [ -f ${ml_newsrcdir}/configure ]; then - ml_recprog="${ml_newsrcdir}/configure --cache-file=../config.cache" - fi - - # find compiler flag corresponding to ${ml_dir} - for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do - dir=`echo $i | sed -e 's/;.*$//'` - if [ "${dir}" = "${ml_dir}" ]; then - flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'` - break - fi - done - ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags"' - - if [ "${with_target_subdir}" = "." ]; then - CC_=$CC' ' - CXX_=$CXX' ' - else - # Create a regular expression that matches any string as long - # as ML_POPDIR. - popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'` - CC_= - for arg in ${CC}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;; - "${ML_POPDIR}"/*) - CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - CC_="${CC_}${arg} " ;; - esac - done - - CXX_= - for arg in ${CXX}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - CXX_="${CXX_}${arg} " ;; - esac - done - - if test "x${LD_LIBRARY_PATH+set}" = xset; then - LD_LIBRARY_PATH_= - for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do - case "$arg" in - "${ML_POPDIR}"/*) - arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` - ;; - esac - if test "x$LD_LIBRARY_PATH_" != x; then - LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg - else - LD_LIBRARY_PATH_=$arg - fi - done - ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_" - fi - - if test "x${SHLIB_PATH+set}" = xset; then - SHLIB_PATH_= - for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do - case "$arg" in - "${ML_POPDIR}"/*) - arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` - ;; - esac - if test "x$SHLIB_PATH_" != x; then - SHLIB_PATH_=$SHLIB_PATH_:$arg - else - SHLIB_PATH_=$arg - fi - done - ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_" - fi - fi - - if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \ - --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ - ${ml_arguments} ${ml_srcdiroption} ; then - true - else - exit 1 - fi - - cd ${ML_POPDIR} - - done - - cd ${ml_origdir} -fi - -fi # ${ml_toplevel_p} = yes -fi # ${enable_multilib} = yes diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ad86a90..6af65d1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,398 @@ +2003-04-30 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (deprecated_tm_print_insn_info): Rename + "tm_print_insn_info". + (TARGET_PRINT_INSN_INFO): Delete macro. + (dis_asm_read_memory): Delete function declaration. + (dis_asm_memory_error, dis_asm_print_address): Ditto. + (tm_print_insn_info): Delete variable definition. + (_initialize_gdbarch): Do not initialize "tm_print_insn_info". + * gdbarch.h, gdbarch.c: Re-generate. + * d10v-tdep.c (display_trace): Replace "tm_print_insn_info" with + "deprecated_tm_print_insn_info". + * mcore-tdep.c (mcore_dump_insn): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * sparc-tdep.c (_initialize_sparc_tdep): Ditto. + * v850-tdep.c (v850_scan_prologue, v850_gdbarch_init): Ditto. + * ia64-tdep.c (_initialize_ia64_tdep): Ditto. + * printcmd.c (print_insn): Use "deprecated_tm_print_insn_info" + instead of TARGET_PRINT_INSN_INFO, add comment. + * s390-tdep.c (s390_get_frame_info): Instead of + "dis_asm_read_memory", use "deprecated_tm_print_insn_info". + (s390_check_function_end, s390_is_sigreturn): Ditto. + * corefile.c (dis_asm_read_memory): Move to "disasm.c". + (dis_asm_memory_error, dis_asm_print_address): Ditto. + * disasm.c: Include "gdbcore.h". + (_initialize_disasm): New function, initialize + "deprecated_tm_print_insn_info". + (deprecated_tm_print_insn_info): New variable. + (dis_asm_read_memory): Moved from "corefile.c", made static. + (dis_asm_print_address, dis_asm_memory_error): Ditto. + * Makefile.in (disasm.o): Update dependencies. + +2003-04-30 Andrew Cagney <cagney@redhat.com> + + * sparc-tdep.c (SPARC_HAS_FPU): When multi-arch, define as 1. + +2003-04-29 Adam Fedor <fedor@gnu.org> + + * eval.c (evaluate_subexp_standard): Handle ObjC ops. + * infcall.c (find_function_addr): Make non-static. + * infcall.h (find_function_addr): Declare. + * Makefile.in (eval.o): Update dependencies. + +2003-04-28 Adam Fedor <fedor@gnu.org> + + * symtab.c (symbol_find_demangled_name): Check for and demangle + ObjC symbols. + (symbol_init_demangled_name): Init for language_objc as well. + +2003-04-28 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_TARGET_READ_FP): Replace TARGET_READ_FP. + (DEPRECATED_FP_REGNUM): Replace FP_REGNUM. + * gdbarch.h, gdbarch.c: Re-generate. + * infcall.c (call_function_by_hand): Use DEPRECATED_FP_REGNUM, + DEPRECATED_TARGET_READ_FP, or "sp" to create the dummy frame ID. + * inferior.h (deprecated_read_fp): Rename read_fp. + (generic_target_read_fp): Delete declaration. + * regcache.c (generic_target_read_fp): Delete function. + (deprecated_read_fp): Replace read_fp, use + DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM. + * d10v-tdep.c (d10v_read_fp): Delete function. + (d10v_gdbarch_init): Do not set deprecated_read_fp. + + * sparc-tdep.c (sparc_gdbarch_init): Do not set + deprecated_target_read_fp to generic_target_read_fp. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + + * xstormy16-tdep.c (xstormy16_gdbarch_init): Set + deprecated_fp_regnum. + * x86-64-tdep.c (x86_64_init_abi): Ditto. + * vax-tdep.c (vax_gdbarch_init): Ditto. + * 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. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * hppa-tdep.c (hppa_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * arm-tdep.c (arm_gdbarch_init): Ditto. + * alpha-tdep.c (alpha_gdbarch_init): Ditto. + + * x86-64-tdep.c (x86_64_init_abi): Set deprecated_target_read_fp. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * hppa-tdep.c (hppa_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * arm-tdep.c (arm_gdbarch_init): Ditto. + + * vax-tdep.c (vax_frame_init_saved_regs): Replace FP_REGNUM with + DEPRECATED_FP_REGNUM. + (vax_push_dummy_frame, vax_pop_frame): Ditto. + * std-regs.c (value_of_builtin_frame_fp_reg): Ditto. + * sparc-tdep.c (sparc_init_extra_frame_info): Ditto. + (sparc_push_dummy_frame, sparc64_read_fp): Ditto. + (sparc32_register_virtual_type): Ditto. + * sh-tdep.c (sh64_frame_chain): Ditto. + (sh64_get_saved_register, sh64_pop_frame): Ditto. + (sh_nofp_frame_init_saved_regs): Ditto. + (sh64_nofp_frame_init_saved_regs): Ditto. + (sh_fp_frame_init_saved_regs): Ditto. + * remote-mips.c (mips_wait, mips_fetch_registers): Ditto. + * remote-e7000.c (fetch_regs_from_dump): Ditto. + * procfs.c (procfs_fetch_registers): Ditto. + (procfs_store_registers): Ditto. + * ns32knbsd-nat.c (fetch_inferior_registers): Ditto. + (store_inferior_registers, fetch_core_registers): Ditto. + (fetch_kcore_registers, clear_regs): Ditto. + * ns32k-tdep.c (ns32k_frame_init_saved_regs): Ditto. + (ns32k_push_dummy_frame, ns32k_pop_frame): Ditto. + * nlm/i386.h (DEPRECATED_FP_REGNUM): Ditto. + * nlm/i386.c (do_status): Ditto. + * mipsv4-nat.c (supply_gregset): Ditto. + * mips-tdep.c: Ditto for comments. + * mips-nat.c (fetch_inferior_registers): Ditto. + (store_inferior_registers, fetch_core_registers): Ditto. + * m68k-tdep.c (m68k_push_dummy_frame): Ditto. + (m68k_pop_frame, m68k_frame_init_saved_regs): Ditto. + * i386-tdep.c (i386_frame_init_saved_regs): Ditto. + (i386_do_pop_frame, i386_register_type): Ditto. + * hppa-tdep.c (hppa_frame_chain): Ditto. + (hppa_push_dummy_frame, find_dummy_frame_regs): Ditto. + (hppa_pop_frame, hppa_read_fp): Ditto. + (skip_prologue_hard_way, hppa_frame_find_saved_regs): Ditto. + * cris-tdep.c (cris_examine, cris_pop_frame): Ditto. + * config/vax/nm-vax.h (REGISTER_U_ADDR): Ditto. + * config/sparc/tm-sparc.h (DEPRECATED_FP_REGNUM): Ditto. + * config/sparc/tm-sp64.h (DEPRECATED_FP_REGNUM): Ditto. + * config/s390/tm-s390.h (DEPRECATED_FP_REGNUM): Ditto. + * config/pa/tm-hppa64.h (DEPRECATED_FP_REGNUM): Ditto. + * config/ia64/tm-ia64.h (DEPRECATED_FP_REGNUM): Ditto. + * blockframe.c: Ditto for comments. + * arch-utils.h: Ditto for comments. + * arch-utils.c (legacy_virtual_frame_pointer): Ditto. + * alphanbsd-tdep.c (fetch_core_registers): Ditto. + * alphabsd-nat.c (fetch_inferior_registers): Ditto. + * alpha-tdep.h: Ditto for comments. + * alpha-tdep.c (alpha_cannot_fetch_register): Ditto. + (alpha_cannot_store_register): Ditto. + (alpha_push_dummy_frame): Ditto. + * alpha-nat.c (supply_gregset): Ditto. + + * config/sparc/tm-sp64.h (DEPRECATED_TARGET_READ_FP): Update. + * config/pa/tm-hppa64.h (DEPRECATED_TARGET_READ_FP): Update. + * config/sparc/tm-sparc.h: Update comment. + + * hppa-tdep.c (hppa_init_extra_frame_info): Use + deprecated_read_fp instead of TARGET_READ_FP. + (hppa_init_extra_frame_info, hppa_frame_chain): Ditto. + (hppa_push_dummy_frame, hppa_read_fp): Ditto. + * sparc-tdep.c (sparc_init_extra_frame_info): Use + deprecated_read_fp instead of read_fp. + * s390-tdep.c (s390_push_arguments): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * frame.h: Ditto in comments. + * frame.c (legacy_get_prev_frame): Ditto. + * dummy-frame.c (dummy_frame_this_id): Ditto. + * arm-tdep.c (arm_init_extra_frame_info): Ditto. + +2003-04-28 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (deprecated_tm_print_insn): Rename tm_print_insn. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (_initialize_xstormy16_tdep): Update. + * vax-tdep.c (_initialize_vax_tdep): Update. + * v850-tdep.c (_initialize_v850_tdep): Update. + * sparc-tdep.c (_initialize_sparc_tdep): Update. + * s390-tdep.c (_initialize_s390_tdep): Update. + * ns32k-tdep.c (_initialize_ns32k_tdep): Update. + * mn10300-tdep.c (_initialize_mn10300_tdep): Update. + * mips-tdep.c (_initialize_mips_tdep): Update. + * mcore-tdep.c (_initialize_mcore_tdep): Update. + * m68k-tdep.c (_initialize_m68k_tdep): Update. + * ia64-tdep.c (_initialize_ia64_tdep): Update. + * hppa-tdep.c (_initialize_hppa_tdep): Update. + * h8300-tdep.c (_initialize_h8300_tdep): Update. + * frv-tdep.c (_initialize_frv_tdep): Update. + * cris-tdep.c (cris_delayed_get_disassembler): Update. + (_initialize_cris_tdep): Update. + * arch-utils.c (legacy_print_insn): Update. + * alpha-tdep.c (_initialize_alpha_tdep): Update. + +2003-04-26 Adam Fedor <fedor@gnu.org> + + * linespec.c (decode_objc): New function to decode ObjC calls + (decode_line_1): Check for ObjC calls (using decode_objc) + * Makefile (linespec.o): Update dependencies. + +2003-04-26 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.h (struct breakpoint_ops): New. + (struct breakpoint): Add ops member. + + * breakpoint.c (print_bp_stop_message, print_one_breakpoint) + (mention): Use new breakpoint ops member. + (set_raw_breakpoint): Initialize ops field to NULL. + (print_exception_catchpoint, print_one_exception_catchpoint) + (print_mention_exception_catchpoint, handle_gnu_v3_exceptions): New. + (gnu_v3_exception_catchpoint_ops): New. + (catch_exception_command_1): Call handle_gnu_v3_exceptions. + +2003-04-25 Adam Fedor <fedor@gnu.org> + + * Makefile.in (COMMON_OBS): Add objc-lang.o + +2003-04-25 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (print_insn): Delete function. + (display_trace): Use TARGET_PRINT_INSN. + (_initialize_d10v_tdep): Do not set tm_print_insn. + (d10v_gdbarch_init): Set print_insn. + +2003-04-25 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_extract_return_value): Delete call to printf. + (_initialize_d10v_tdep): Use add_setshow_boolean_cmd. + (d10v_frame_unwind_cache): Use FRAME_OBSTACK_CALLOC. + (NR_DMAP_REGS, A0_REGNUM): Delete, replaced by ... + (nr_dmap_regs, a0_regnum): ... new functions. + (d10v_print_registers_info): Use a0_regnum, use register_size. + (d10v_register_byte): Delete function. + (d10v_register_raw_size): Delete function. + (d10v_register_type): Use a0_regnum. + (d10v_print_registers_info): Use a0_regnum. + (D10V_SP_REGNUM): Rename _SP_REGNUM, replace it and SP_REGNUM. + (d10v_gdbarch_init): Do not set register_byte or + register_raw_size, use D10V_SP_REGNUM to set sp_regnum. + (d10v_pointer_to_address): Use extract_unsigned_integer instead of + extract_address. + (trace_command): Use XCALLOC. + (print_insn): Delete reference to tm_print_insn. + (saved_regs_unwinder): Use store_unsigned_integer instead of + store_address. + * frame.h (FRAME_OBSTACK_CALLOC): Define + +2003-04-25 David Carlton <carlton@bactrian.org> + + * config/djgpp/fnchange.lst: Add testsuite/gdb.c++/maint.exp. + +2003-04-24 Adam Fedor <fedor@gnu.org> + + * objc-lang.c: Include "valprint.h" + * Makefile.in (objc-lang.o): Update dependencies. + +2003-04-24 Adam Fedor <fedor@gnu.org> + + * objc-lang.c (FETCH_ARGUMENT, CONVERT_FUNCPTR): Remove + architecture dependant compilation and mark as unimplemented + (until they get put in the gdbarch vector). + +2003-04-23 David Carlton <carlton@bactrian.org> + + * cp-support.c (cp_find_first_component): Accept 'operator' in + more locations. + +2003-04-23 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Eliminate redundant + indentation. Move "saved_async" and "old_cleanups" to where they + are needed. + +2003-04-23 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Eliminate the variables "rc" + and "buffer". Move the "name" code to where it is needed. + +2003-04-23 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Move variables "start_sp", + "dummy", "sizeof_dummy1" and "dummy1" and corresponding dummy call + code to ON_STACK switch branch. + +2003-04-23 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Make declaration of "i", + "sal", "bpt" and "old_sp" more local to their use. Delete #if + lint. + +2003-04-23 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Delete variable + "n_method_args". Localize "param_type"'s declaration to the loop + that it is used. Reinstate code assigning to said variable - + deleted on 2002-06-14. Rationalize calls to value_args_coerce. + Rationalize code using "param_type". + +2003-04-22 Andrew Cagney <cagney@redhat.com> + + * infcall.c (call_function_by_hand): Use new variable "bp_addr" to + compute the breakpoint address. Only call FIX_CALL_DUMMY when + ON_STACK. Eliminate the variable "addr". Do not pass "real_pc" + to DEPRECATED_PUSH_RETURN_ADDRESS. + +2003-04-22 Kevin Buettner <kevinb@redhat.com> + + * dwarf2loc.c (dwarf2_evaluate_loc_desc): Invoke DWARF2_REG_TO_REGNUM + on the DWARF2 register number prior to fetching a register. + +2003-04-22 J. Brobecker <brobecker@gnat.com> + + * config/pa/tm-hppa.h (SOFT_FLOAT): Delete this macro. + Update all the tests using SOFT_FLOAT considering the fact that + this macro was always set to 0. + * config/pa/tm-hppa64.h: Update all the tests using SOFT_FLOAT + considering the fact that this macro was always set to 0. + * hppa-tdep.h (hppa_store_return_value): Likewise. + (hppa_extract_return_value): Likewise. + +2003-04-22 J. Brobecker <brobecker@gnat.com> + + * config/pa/tm-hppa.h: Remove obsolete code, was used by + the hppa-pro target only. + +2003-04-21 J. Brobecker <brobecker@gnat.com> + + Ongoing multi-arch conversion effort for HP/UX: + * config/pa/tm-hppa.h: Move all macro that are no longer + defined now that GDB_MULTI_ARCH is now set to 1 from here... + * config/pa/tm-hppa64.h: ... to here (hppa64 is not multiarch'ed yet). + +2003-04-21 J. Brobecker <brobecker@gnat.com> + + * config/pa/tm-hppa.h: Obsolete a section that was only used + for hppa-pro. + +2003-04-21 J. Brobecker <brobecker@gnat.com> + + Ongoing multi-arch conversion for HP/UX. + * config/pa/tm-hppa.h (GDB_MULTI_ARCH): Set to 1. Do not define + if already defined (allows hppa64 to stay non-multiarched for now). + * config/pa/tm-hppa64.h (GDB_MULTI_ARCH): Define. + +2003-04-21 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_id_eq): Fail when the code_addr's do not match. + +2003-04-21 Andrew Cagney <cagney@redhat.com> + + * i386-tdep.c (i386_gdbarch_init): Replace "mmx_num_regs" with + "i386_num_mmx_regs". + +2003-04-21 Andrew Cagney <cagney@redhat.com> + + * infcall.c: New file. + * infcall.h: New file. + * valarith.c: Include "infcall.h". + * scm-lang.c, objc-lang.cm, hppa-tdep.c, gcore.c: Ditto. + * eval.c, ada-valprint.c, ada-lang.c: Ditto. + * Makefile.in (valarith.o, scm-lang.o): Update dependencies. + (objc-lang.o, hppa-tdep.o, gcore.o): Update dependencies. + (eval.o, ada-valprint.o, ada-lang.o): Update dependencies. + (SFILES): Add "infcall.c" + (COMMON_OBS): Add "infcall.o". + (infcall.o): Specify dependencies. + * value.h (call_function_by_hand): Delete declaration. + * inferior.h (run_stack_dummy): Delete declaration. + * infcmd.c (breakpoint_auto_delete_contents): Move to "infcall.c". + (run_stack_dummy): Move to "infcall.c", merged into + call_function_by_hand. + * valops.c (call_function_by_hand): Moved to "infcall.c". + (find_function_addr, value_arg_coerce): Ditto. + (unwindonsignal_p, coerce_float_to_double): Ditto. + (_initialize_valops): Move "set/show coerce-float-to-double", and + "set/show unwindonsignal" commands to "infcall.c". + * v850-tdep.c, target.h: Update comments. + * sparc-tdep.c (sparc_fix_call_dummy): Update comments. + * sh-tdep.c (sh_init_extra_frame_info): Update comments. + (sh64_init_extra_frame_info): Update comments. + * mn10300-tdep.c: Update comments. + * mcore-tdep.c (mcore_init_extra_frame_info): Update comments. + * config/sparc/tm-sparc.h: Update comments. + * breakpoint.h: Update comments. + * avr-tdep.c (avr_init_extra_frame_info): Update comments. + * arm-tdep.c: Update comment. + 2003-04-19 Mark Kettenis <kettenis@gnu.org> * i386-tdep.c (i386_num_register_names): New variable. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a78ef16..6cce654 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -521,7 +521,9 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ frame-unwind.c \ gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ hpacc-abi.c \ - inf-loop.c infcmd.c inflow.c infrun.c \ + inf-loop.c \ + infcall.c \ + infcmd.c inflow.c infrun.c \ interps.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ kod.c kod-cisco.c \ @@ -669,6 +671,7 @@ i386_linux_tdep_h = i386-linux-tdep.h i386_tdep_h = i386-tdep.h i387_tdep_h = i387-tdep.h inf_loop_h = inf-loop.h +infcall_h = infcall.h inferior_h = inferior.h $(breakpoint_h) $(target_h) $(frame_h) inflow_h = inflow.h $(terminal_h) interps_h = interps.h @@ -834,7 +837,9 @@ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR) COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ charset.o disasm.o dummy-frame.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ - block.o symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \ + block.o symtab.o symfile.o symmisc.o linespec.o \ + infcall.o \ + infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ interps.o \ macrotab.o macrocmd.o macroexp.o macroscope.o \ @@ -849,7 +854,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ dbxread.o coffread.o coff-pe-read.o elfread.o \ dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \ dwarf2expr.o dwarf2loc.o \ - c-lang.o f-lang.o \ + c-lang.o f-lang.o objc-lang.o \ ui-out.o cli-out.o \ varobj.o wrapper.o \ jv-lang.o jv-valprint.o jv-typeprint.o \ @@ -1488,7 +1493,8 @@ abug-rom.o: abug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ ada-lang.o: ada-lang.c $(gdb_string_h) $(demangle_h) $(defs_h) $(symtab_h) \ $(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \ $(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \ - $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h) $(block_h) + $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h) $(block_h) \ + $(infcall_h) ada-tasks.o: ada-tasks.c $(defs_h) $(command_h) $(value_h) $(language_h) \ $(inferior_h) $(symtab_h) $(target_h) $(gdbcore_h) $(gregset_h) \ $(ada_lang_h) @@ -1498,7 +1504,7 @@ ada-typeprint.o: ada-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \ $(c_lang_h) $(typeprint_h) $(ada_lang_h) $(gdb_string_h) ada-valprint.o: ada-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(value_h) $(demangle_h) $(valprint_h) $(language_h) \ - $(annotate_h) $(ada_lang_h) $(c_lang_h) + $(annotate_h) $(ada_lang_h) $(c_lang_h) $(infcall_h) aix-thread.o: aix-thread.c $(defs_h) $(gdb_assert_h) $(gdbthread_h) \ $(target_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) $(language_h) \ $(ppc_tdep_h) @@ -1650,7 +1656,7 @@ demangle.o: demangle.c $(defs_h) $(command_h) $(gdbcmd_h) $(demangle_h) \ dink32-rom.o: dink32-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(symfile_h) $(inferior_h) $(regcache_h) disasm.o: disasm.c $(defs_h) $(gdb_string_h) $(target_h) $(value_h) \ - $(disasm_h) $(ui_out_h) + $(disasm_h) $(ui_out_h) $(gdbcore_h) doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) \ $(gdb_assert_h) $(gdb_string_h) $(gdbtypes_h) dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h) @@ -1681,7 +1687,7 @@ elfread.o: elfread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(elf_bfd_h) \ environ.o: environ.c $(defs_h) $(environ_h) $(gdb_string_h) eval.o: eval.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(expression_h) $(target_h) $(frame_h) $(language_h) \ - $(f_lang_h) $(cp_abi_h) + $(f_lang_h) $(cp_abi_h) $(infcall_h) $(objc-lang.h) $(block_h) event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \ $(gdb_string_h) event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \ @@ -1723,7 +1729,7 @@ frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \ frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(regcache_h) gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \ - $(elf_bfd_h) $(symfile_h) $(objfiles_h) + $(elf_bfd_h) $(symfile_h) $(objfiles_h) $(infcall_h) gdb.o: gdb.c $(defs_h) $(main_h) $(gdb_string_h) $(interps_h) gdb-events.o: gdb-events.c $(defs_h) $(gdb_events_h) $(gdbcmd_h) gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \ @@ -1758,9 +1764,9 @@ 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) $(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) + $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(infcall_h) \ + $(a_out_encap_h) $(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) \ + $(gdbcmd_h) $(target_h) $(symfile_h) $(objfiles_h) hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \ $(osabi_h) $(gdb_string_h) hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) @@ -1830,6 +1836,9 @@ ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(value_h) $(objfiles_h) $(elf_common_h) $(elf_bfd_h) inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \ $(event_top_h) $(inf_loop_h) $(remote_h) +infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \ + $(inferior_h) $(gdb_assert_h) $(block_h) $(gdbcore_h) $(language_h) \ + $(symfile_h) $(gdbcmd_h) $(command_h) $(gdb_string_h) infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(frame_h) $(inferior_h) $(environ_h) $(value_h) $(gdbcmd_h) \ $(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \ @@ -1877,7 +1886,7 @@ lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(completer_h) \ - $(cp_abi_h) $(source_h) $(parser_defs_h) $(block_h) + $(cp_abi_h) $(source_h) $(parser_defs_h) $(block_h) $(objc_lang_h) linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \ $(cli_decode_h) $(gdb_string_h) @@ -1995,9 +2004,9 @@ ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_h) \ $(osabi_h) objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \ - $(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) \ - $(gdb_string_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) \ - $(gdb_regex_h) $(regcache_h) $(block_h) + $(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) $(gdb_string_h) \ + $(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) $(gdb_regex_h) \ + $(regcache_h) $(block_h) $(infcall_h) $(valprint_h) objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \ $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \ @@ -2150,7 +2159,7 @@ scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(scm_tags_h) scm-lang.o: scm-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(value_h) $(c_lang_h) $(scm_lang_h) \ - $(scm_tags_h) $(gdb_string_h) $(gdbcore_h) $(source_h) + $(scm_tags_h) $(source_h) $(gdb_string_h) $(gdbcore_h) $(infcall_h) scm-valprint.o: scm-valprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(parser_defs_h) $(language_h) $(value_h) \ $(scm_lang_h) $(valprint_h) $(gdbcore_h) @@ -2266,7 +2275,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \ $(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \ $(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \ - $(cp_abi_h) $(source_h) $(block_h) + $(cp_abi_h) $(source_h) $(block_h) $(objc_lang_h) target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \ $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \ $(gdb_wait_h) $(dcache_h) $(regcache_h) @@ -2308,7 +2317,7 @@ v850ice.o: v850ice.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \ $(gdbcore_h) $(value_h) $(command_h) $(regcache_h) valarith.o: valarith.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \ $(expression_h) $(target_h) $(language_h) $(gdb_string_h) \ - $(doublest_h) + $(doublest_h) $(infcall_h) valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \ $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \ $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(gdb_string_h) \ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index bc0809d..b047442 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -39,6 +39,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ada-lang.h" #include "ui-out.h" #include "block.h" +#include "infcall.h" struct cleanup *unresolved_names; diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 8633f2c..5b90c06 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "annotate.h" #include "ada-lang.h" #include "c-lang.h" +#include "infcall.h" /* Encapsulates arguments to ada_val_print. */ struct ada_val_print_args diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c index 548869b..af0a336 100644 --- a/gdb/alpha-nat.c +++ b/gdb/alpha-nat.c @@ -212,7 +212,7 @@ supply_gregset (gdb_gregset_t *gregsetp) /* Fill inaccessible registers with zero. */ supply_register (ALPHA_ZERO_REGNUM, zerobuf); - supply_register (FP_REGNUM, zerobuf); + supply_register (DEPRECATED_FP_REGNUM, zerobuf); } void diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index d61f359..067fc91 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -293,13 +293,13 @@ alpha_register_name (int regno) static int alpha_cannot_fetch_register (int regno) { - return (regno == FP_REGNUM || regno == ALPHA_ZERO_REGNUM); + return (regno == DEPRECATED_FP_REGNUM || regno == ALPHA_ZERO_REGNUM); } static int alpha_cannot_store_register (int regno) { - return (regno == FP_REGNUM || regno == ALPHA_ZERO_REGNUM); + return (regno == DEPRECATED_FP_REGNUM || regno == ALPHA_ZERO_REGNUM); } static int @@ -1269,7 +1269,7 @@ alpha_push_dummy_frame (void) be read as zero and will help us to catch any errors in the dummy frame retrieval code. */ PROC_DUMMY_FRAME (proc_desc) = sp; - PROC_FRAME_REG (proc_desc) = FP_REGNUM; + PROC_FRAME_REG (proc_desc) = DEPRECATED_FP_REGNUM; PROC_FRAME_OFFSET (proc_desc) = 0; sp += PROC_REG_OFFSET (proc_desc); write_register (SP_REGNUM, sp); @@ -1806,7 +1806,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Register info */ set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, ALPHA_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, ALPHA_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, ALPHA_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, ALPHA_PC_REGNUM); set_gdbarch_fp0_regnum (gdbarch, ALPHA_FP0_REGNUM); @@ -1925,7 +1925,7 @@ _initialize_alpha_tdep (void) gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, alpha_dump_tdep); - tm_print_insn = print_insn_alpha; + deprecated_tm_print_insn = print_insn_alpha; /* Let the user set the fence post for heuristic_proc_start. */ diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index 76f91f3..0e8aefb 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -40,12 +40,12 @@ /* Largest value REGISTER_VIRTUAL_SIZE can have. */ #define ALPHA_MAX_REGISTER_VIRTUAL_SIZE 8 -/* Register numbers of various important registers. - Note that most of these values are "real" register numbers, - and correspond to the general registers of the machine, - and FP_REGNUM is a "phony" register number which is too large - to be an actual register number as far as the user is concerned - but serves to get the desired value when passed to read_register. */ +/* Register numbers of various important registers. Note that most of + these values are "real" register numbers, and correspond to the + general registers of the machine, and DEPRECATED_FP_REGNUM is a + "phony" register number which is too large to be an actual register + number as far as the user is concerned but serves to get the + desired value when passed to read_register. */ #define ALPHA_V0_REGNUM 0 /* Function integer return value */ #define ALPHA_T7_REGNUM 8 /* Return address register for OSF/1 __add* */ diff --git a/gdb/alphabsd-nat.c b/gdb/alphabsd-nat.c index b26d3ea..a20b36f 100644 --- a/gdb/alphabsd-nat.c +++ b/gdb/alphabsd-nat.c @@ -113,7 +113,7 @@ fetch_inferior_registers (int regno) } /* Reset virtual frame pointer. */ - supply_register (FP_REGNUM, NULL); + supply_register (DEPRECATED_FP_REGNUM, NULL); } /* Store register REGNO back into the inferior. If REGNO is -1, do diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index 6137c5e..a4a77c1 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -70,7 +70,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, for (regno = 0; regno < ALPHA_ZERO_REGNUM; regno++) supply_register (regno, regs + (regmap[regno] * 8)); supply_register (ALPHA_ZERO_REGNUM, NULL); - supply_register (FP_REGNUM, NULL); + supply_register (DEPRECATED_FP_REGNUM, NULL); supply_register (PC_REGNUM, regs + (28 * 8)); /* Floating point registers. */ diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 825bd5c..fad8ed1 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -209,7 +209,7 @@ generic_prologue_frameless_p (CORE_ADDR ip) int legacy_print_insn (bfd_vma vma, disassemble_info *info) { - return (*tm_print_insn) (vma, info); + return (*deprecated_tm_print_insn) (vma, info); } /* Helper functions for INNER_THAN */ @@ -410,7 +410,8 @@ cannot_register_not (int regnum) } /* Legacy version of target_virtual_frame_pointer(). Assumes that - there is an FP_REGNUM and that it is the same, cooked or raw. */ + there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or + raw. */ void legacy_virtual_frame_pointer (CORE_ADDR pc, @@ -422,8 +423,8 @@ legacy_virtual_frame_pointer (CORE_ADDR pc, register and an offset can determine this. I think it should instead generate a byte code expression as that would work better with things like Dwarf2's CFI. */ - if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS) - *frame_regnum = FP_REGNUM; + if (DEPRECATED_FP_REGNUM >= 0 && DEPRECATED_FP_REGNUM < NUM_REGS) + *frame_regnum = DEPRECATED_FP_REGNUM; else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS) *frame_regnum = SP_REGNUM; else diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index f3874a0..cf515a4 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -141,7 +141,8 @@ void default_coff_make_msymbol_special (int val, struct minimal_symbol *msym); int cannot_register_not (int regnum); /* Legacy version of target_virtual_frame_pointer(). Assumes that - there is an FP_REGNUM and that it is the same, cooked or raw. */ + there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or + raw. */ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 0a029e8..ee07a362 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1118,7 +1118,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) else if (fromleaf) /* If we were called by a frameless fn. then our frame is still in the frame pointer register on the board... */ - deprecated_update_frame_base_hack (fi, read_fp ()); + deprecated_update_frame_base_hack (fi, deprecated_read_fp ()); } /* Calculate actual addresses of saved registers using offsets @@ -1257,8 +1257,8 @@ static LONGEST arm_call_dummy_words[] = FIXME rearnsha 2002-02018: Tweeking current_gdbarch is not an optimal solution, but the call to arm_fix_call_dummy is immediately - followed by a call to run_stack_dummy, which is the only function - where call_dummy_breakpoint_offset is actually used. */ + followed by a call to call_function_by_hand, which is the only + function where call_dummy_breakpoint_offset is actually used. */ static void @@ -2938,7 +2938,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Frame handling. */ set_gdbarch_deprecated_frame_chain_valid (gdbarch, arm_frame_chain_valid); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, arm_init_extra_frame_info); - set_gdbarch_read_fp (gdbarch, arm_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, arm_read_fp); set_gdbarch_deprecated_frame_chain (gdbarch, arm_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, arm_frameless_function_invocation); @@ -2972,7 +2972,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Information about registers, etc. */ set_gdbarch_print_float_info (gdbarch, arm_print_float_info); - set_gdbarch_fp_regnum (gdbarch, ARM_FP_REGNUM); /* ??? */ + set_gdbarch_deprecated_fp_regnum (gdbarch, ARM_FP_REGNUM); /* ??? */ set_gdbarch_sp_regnum (gdbarch, ARM_SP_REGNUM); set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM); set_gdbarch_register_byte (gdbarch, arm_register_byte); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index b787c81..314c0a1 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -753,8 +753,8 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) { - /* We need to setup fi->frame here because run_stack_dummy gets it wrong - by assuming it's always FP. */ + /* We need to setup fi->frame here because call_function_by_hand + gets it wrong by assuming it's always FP. */ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), AVR_PC_REGNUM)); } @@ -1145,14 +1145,14 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, avr_read_pc); set_gdbarch_write_pc (gdbarch, avr_write_pc); - set_gdbarch_read_fp (gdbarch, avr_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, avr_read_fp); set_gdbarch_read_sp (gdbarch, avr_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp); set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, AVR_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, AVR_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, AVR_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, AVR_PC_REGNUM); set_gdbarch_register_name (gdbarch, avr_register_name); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 47e576e..fce25e4 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -523,14 +523,14 @@ block_innermost_frame (struct block *block) top of the stack frame which we are checking, where "bottom" and "top" refer to some section of memory which contains the code for the call dummy. Calls to this macro assume that the contents of - SP_REGNUM and FP_REGNUM (or the saved values thereof), respectively, - are the things to pass. - - This won't work on the 29k, where SP_REGNUM and FP_REGNUM don't - have that meaning, but the 29k doesn't use ON_STACK. This could be - fixed by generalizing this scheme, perhaps by passing in a frame - and adding a few fields, at least on machines which need them for - DEPRECATED_PC_IN_CALL_DUMMY. + SP_REGNUM and DEPRECATED_FP_REGNUM (or the saved values thereof), + respectively, are the things to pass. + + This won't work on the 29k, where SP_REGNUM and + DEPRECATED_FP_REGNUM don't have that meaning, but the 29k doesn't + use ON_STACK. This could be fixed by generalizing this scheme, + perhaps by passing in a frame and adding a few fields, at least on + machines which need them for DEPRECATED_PC_IN_CALL_DUMMY. Something simpler, like checking for the stack segment, doesn't work, since various programs (threads implementations, gcc nested function diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8ab9e54..f6736a4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2271,9 +2271,15 @@ print_bp_stop_message (bpstat bs) break; case print_it_normal: - /* Normal case, we handle everything in print_it_typical. */ - return print_it_typical (bs); + /* Normal case. Call the breakpoint's print_it method, or + print_it_typical. */ + if (bs->breakpoint_at != NULL && bs->breakpoint_at->ops != NULL + && bs->breakpoint_at->ops->print_it != NULL) + return bs->breakpoint_at->ops->print_it (bs->breakpoint_at); + else + return print_it_typical (bs); break; + default: internal_error (__FILE__, __LINE__, "print_bp_stop_message: unrecognized enum value"); @@ -3265,143 +3271,147 @@ print_one_breakpoint (struct breakpoint *b, else strcat (wrap_indent, " "); } - switch (b->type) - { - case bp_none: - internal_error (__FILE__, __LINE__, - "print_one_breakpoint: bp_none encountered\n"); - break; - case bp_watchpoint: - case bp_hardware_watchpoint: - case bp_read_watchpoint: - case bp_access_watchpoint: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - print_expression (b->exp, stb->stream); - ui_out_field_stream (uiout, "what", stb); - break; - - case bp_catch_load: - case bp_catch_unload: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - if (b->dll_pathname == NULL) - { - ui_out_field_string (uiout, "what", "<any library>"); - ui_out_spaces (uiout, 1); - } - else - { - ui_out_text (uiout, "library \""); - ui_out_field_string (uiout, "what", b->dll_pathname); - ui_out_text (uiout, "\" "); - } - break; - - case bp_catch_fork: - case bp_catch_vfork: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - if (b->forked_inferior_pid != 0) - { - ui_out_text (uiout, "process "); - ui_out_field_int (uiout, "what", b->forked_inferior_pid); - ui_out_spaces (uiout, 1); - } - - case bp_catch_exec: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - if (b->exec_pathname != NULL) - { - ui_out_text (uiout, "program \""); - ui_out_field_string (uiout, "what", b->exec_pathname); - ui_out_text (uiout, "\" "); - } - break; + if (b->ops != NULL && b->ops->print_one != NULL) + b->ops->print_one (b, last_addr); + else + switch (b->type) + { + case bp_none: + internal_error (__FILE__, __LINE__, + "print_one_breakpoint: bp_none encountered\n"); + break; - case bp_catch_catch: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - ui_out_field_string (uiout, "what", "exception catch"); - ui_out_spaces (uiout, 1); - break; + case bp_watchpoint: + case bp_hardware_watchpoint: + case bp_read_watchpoint: + case bp_access_watchpoint: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "what", stb); + break; + + case bp_catch_load: + case bp_catch_unload: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->dll_pathname == NULL) + { + ui_out_field_string (uiout, "what", "<any library>"); + ui_out_spaces (uiout, 1); + } + else + { + ui_out_text (uiout, "library \""); + ui_out_field_string (uiout, "what", b->dll_pathname); + ui_out_text (uiout, "\" "); + } + break; + + case bp_catch_fork: + case bp_catch_vfork: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->forked_inferior_pid != 0) + { + ui_out_text (uiout, "process "); + ui_out_field_int (uiout, "what", b->forked_inferior_pid); + ui_out_spaces (uiout, 1); + } + + case bp_catch_exec: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->exec_pathname != NULL) + { + ui_out_text (uiout, "program \""); + ui_out_field_string (uiout, "what", b->exec_pathname); + ui_out_text (uiout, "\" "); + } + break; + + case bp_catch_catch: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + ui_out_field_string (uiout, "what", "exception catch"); + ui_out_spaces (uiout, 1); + break; + + case bp_catch_throw: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + ui_out_field_string (uiout, "what", "exception throw"); + ui_out_spaces (uiout, 1); + break; + + case bp_breakpoint: + case bp_hardware_breakpoint: + case bp_until: + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: + case bp_step_resume: + case bp_through_sigtramp: + case bp_watchpoint_scope: + case bp_call_dummy: + case bp_shlib_event: + case bp_thread_event: + case bp_overlay_event: + if (addressprint) + { + annotate_field (4); + ui_out_field_core_addr (uiout, "addr", b->address); + } + annotate_field (5); + *last_addr = b->address; + if (b->source_file) + { + sym = find_pc_sect_function (b->address, b->section); + if (sym) + { + ui_out_text (uiout, "in "); + ui_out_field_string (uiout, "func", + SYMBOL_PRINT_NAME (sym)); + ui_out_wrap_hint (uiout, wrap_indent); + ui_out_text (uiout, " at "); + } + ui_out_field_string (uiout, "file", b->source_file); + ui_out_text (uiout, ":"); + ui_out_field_int (uiout, "line", b->line_number); + } + else + { + print_address_symbolic (b->address, stb->stream, demangle, ""); + ui_out_field_stream (uiout, "at", stb); + } + break; + } - case bp_catch_throw: - /* Field 4, the address, is omitted (which makes the columns - not line up too nicely with the headers, but the effect - is relatively readable). */ - if (addressprint) - ui_out_field_skip (uiout, "addr"); - annotate_field (5); - ui_out_field_string (uiout, "what", "exception throw"); - ui_out_spaces (uiout, 1); - break; - - case bp_breakpoint: - case bp_hardware_breakpoint: - case bp_until: - case bp_finish: - case bp_longjmp: - case bp_longjmp_resume: - case bp_step_resume: - case bp_through_sigtramp: - case bp_watchpoint_scope: - case bp_call_dummy: - case bp_shlib_event: - case bp_thread_event: - case bp_overlay_event: - if (addressprint) - { - annotate_field (4); - ui_out_field_core_addr (uiout, "addr", b->address); - } - annotate_field (5); - *last_addr = b->address; - if (b->source_file) - { - sym = find_pc_sect_function (b->address, b->section); - if (sym) - { - ui_out_text (uiout, "in "); - ui_out_field_string (uiout, "func", - SYMBOL_PRINT_NAME (sym)); - ui_out_wrap_hint (uiout, wrap_indent); - ui_out_text (uiout, " at "); - } - ui_out_field_string (uiout, "file", b->source_file); - ui_out_text (uiout, ":"); - ui_out_field_int (uiout, "line", b->line_number); - } - else - { - print_address_symbolic (b->address, stb->stream, demangle, ""); - ui_out_field_stream (uiout, "at", stb); - } - break; - } - if (b->thread != -1) { /* FIXME: This seems to be redundant and lost here; see the @@ -3851,6 +3861,7 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype) b->triggered_dll_pathname = NULL; b->forked_inferior_pid = 0; b->exec_pathname = NULL; + b->ops = NULL; /* Add this breakpoint to the end of the chain so that a list of breakpoints will come out in order @@ -4413,103 +4424,107 @@ mention (struct breakpoint *b) create_breakpoint_hook (b); breakpoint_create_event (b->number); - switch (b->type) - { - case bp_none: - printf_filtered ("(apparently deleted?) Eventpoint %d: ", b->number); - break; - case bp_watchpoint: - ui_out_text (uiout, "Watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); - ui_out_field_int (uiout, "number", b->number); - ui_out_text (uiout, ": "); - print_expression (b->exp, stb->stream); - ui_out_field_stream (uiout, "exp", stb); - do_cleanups (ui_out_chain); - break; - case bp_hardware_watchpoint: - ui_out_text (uiout, "Hardware watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); - ui_out_field_int (uiout, "number", b->number); - ui_out_text (uiout, ": "); - print_expression (b->exp, stb->stream); - ui_out_field_stream (uiout, "exp", stb); - do_cleanups (ui_out_chain); - break; - case bp_read_watchpoint: - ui_out_text (uiout, "Hardware read watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt"); - ui_out_field_int (uiout, "number", b->number); - ui_out_text (uiout, ": "); - print_expression (b->exp, stb->stream); - ui_out_field_stream (uiout, "exp", stb); - do_cleanups (ui_out_chain); - break; - case bp_access_watchpoint: - ui_out_text (uiout, "Hardware access (read/write) watchpoint "); - ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt"); - ui_out_field_int (uiout, "number", b->number); - ui_out_text (uiout, ": "); - print_expression (b->exp, stb->stream); - ui_out_field_stream (uiout, "exp", stb); - do_cleanups (ui_out_chain); - break; - case bp_breakpoint: - if (ui_out_is_mi_like_p (uiout)) - { - say_where = 0; - break; - } - printf_filtered ("Breakpoint %d", b->number); - say_where = 1; - break; - case bp_hardware_breakpoint: - if (ui_out_is_mi_like_p (uiout)) - { - say_where = 0; - break; - } - printf_filtered ("Hardware assisted breakpoint %d", b->number); - say_where = 1; - break; - case bp_catch_load: - case bp_catch_unload: - printf_filtered ("Catchpoint %d (%s %s)", - b->number, - (b->type == bp_catch_load) ? "load" : "unload", - (b->dll_pathname != NULL) ? - b->dll_pathname : "<any library>"); - break; - case bp_catch_fork: - case bp_catch_vfork: - printf_filtered ("Catchpoint %d (%s)", - b->number, - (b->type == bp_catch_fork) ? "fork" : "vfork"); - break; - case bp_catch_exec: - printf_filtered ("Catchpoint %d (exec)", - b->number); - break; - case bp_catch_catch: - case bp_catch_throw: - printf_filtered ("Catchpoint %d (%s)", - b->number, - (b->type == bp_catch_catch) ? "catch" : "throw"); - break; + if (b->ops != NULL && b->ops->print_mention != NULL) + b->ops->print_mention (b); + else + switch (b->type) + { + case bp_none: + printf_filtered ("(apparently deleted?) Eventpoint %d: ", b->number); + break; + case bp_watchpoint: + ui_out_text (uiout, "Watchpoint "); + ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + do_cleanups (ui_out_chain); + break; + case bp_hardware_watchpoint: + ui_out_text (uiout, "Hardware watchpoint "); + ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + do_cleanups (ui_out_chain); + break; + case bp_read_watchpoint: + ui_out_text (uiout, "Hardware read watchpoint "); + ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + do_cleanups (ui_out_chain); + break; + case bp_access_watchpoint: + ui_out_text (uiout, "Hardware access (read/write) watchpoint "); + ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + do_cleanups (ui_out_chain); + break; + case bp_breakpoint: + if (ui_out_is_mi_like_p (uiout)) + { + say_where = 0; + break; + } + printf_filtered ("Breakpoint %d", b->number); + say_where = 1; + break; + case bp_hardware_breakpoint: + if (ui_out_is_mi_like_p (uiout)) + { + say_where = 0; + break; + } + printf_filtered ("Hardware assisted breakpoint %d", b->number); + say_where = 1; + break; + case bp_catch_load: + case bp_catch_unload: + printf_filtered ("Catchpoint %d (%s %s)", + b->number, + (b->type == bp_catch_load) ? "load" : "unload", + (b->dll_pathname != NULL) ? + b->dll_pathname : "<any library>"); + break; + case bp_catch_fork: + case bp_catch_vfork: + printf_filtered ("Catchpoint %d (%s)", + b->number, + (b->type == bp_catch_fork) ? "fork" : "vfork"); + break; + case bp_catch_exec: + printf_filtered ("Catchpoint %d (exec)", + b->number); + break; + case bp_catch_catch: + case bp_catch_throw: + printf_filtered ("Catchpoint %d (%s)", + b->number, + (b->type == bp_catch_catch) ? "catch" : "throw"); + break; + + case bp_until: + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: + case bp_step_resume: + case bp_through_sigtramp: + case bp_call_dummy: + case bp_watchpoint_scope: + case bp_shlib_event: + case bp_thread_event: + case bp_overlay_event: + break; + } - case bp_until: - case bp_finish: - case bp_longjmp: - case bp_longjmp_resume: - case bp_step_resume: - case bp_through_sigtramp: - case bp_call_dummy: - case bp_watchpoint_scope: - case bp_shlib_event: - case bp_thread_event: - case bp_overlay_event: - break; - } if (say_where) { if (addressprint || b->source_file == NULL) @@ -6004,6 +6019,90 @@ create_exception_catchpoint (int tempflag, char *cond_string, mention (b); } +static enum print_stop_action +print_exception_catchpoint (struct breakpoint *b) +{ + annotate_catchpoint (b->number); + + if (strstr (b->addr_string, "throw") != NULL) + printf_filtered ("\nCatchpoint %d (exception thrown)\n", + b->number); + else + printf_filtered ("\nCatchpoint %d (exception caught)\n", + b->number); + + return PRINT_SRC_AND_LOC; +} + +static void +print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr) +{ + if (addressprint) + { + annotate_field (4); + ui_out_field_core_addr (uiout, "addr", b->address); + } + annotate_field (5); + *last_addr = b->address; + if (strstr (b->addr_string, "throw") != NULL) + ui_out_field_string (uiout, "what", "exception throw"); + else + ui_out_field_string (uiout, "what", "exception catch"); +} + +static void +print_mention_exception_catchpoint (struct breakpoint *b) +{ + if (strstr (b->addr_string, "throw") != NULL) + printf_filtered ("Catchpoint %d (throw)", b->number); + else + printf_filtered ("Catchpoint %d (catch)", b->number); +} + +static struct breakpoint_ops gnu_v3_exception_catchpoint_ops = { + print_exception_catchpoint, + print_one_exception_catchpoint, + print_mention_exception_catchpoint +}; + +static int +handle_gnu_v3_exceptions (int tempflag, char *cond_string, + enum exception_event_kind ex_event, int from_tty) +{ + char *trigger_func_name, *nameptr; + struct symtabs_and_lines sals; + struct breakpoint *b; + + if (ex_event == EX_EVENT_CATCH) + trigger_func_name = xstrdup ("__cxa_begin_catch"); + else + trigger_func_name = xstrdup ("__cxa_throw"); + + nameptr = trigger_func_name; + sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL); + if (sals.nelts == 0) + { + free (trigger_func_name); + return 0; + } + + b = set_raw_breakpoint (sals.sals[0], bp_breakpoint); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = NULL; + b->cond_string = (cond_string == NULL) ? + NULL : savestring (cond_string, strlen (cond_string)); + b->thread = -1; + b->addr_string = trigger_func_name; + b->enable_state = bp_enabled; + b->disposition = tempflag ? disp_del : disp_donttouch; + b->ops = &gnu_v3_exception_catchpoint_ops; + + free (sals.sals); + mention (b); + return 1; +} + /* Deal with "catch catch" and "catch throw" commands */ static void @@ -6024,6 +6123,9 @@ catch_exception_command_1 (enum exception_event_kind ex_event, char *arg, (ex_event != EX_EVENT_CATCH)) error ("Unsupported or unknown exception event; cannot catch it"); + if (handle_gnu_v3_exceptions (tempflag, cond_string, ex_event, from_tty)) + return; + /* See if we can find a callback routine */ sal = target_enable_exception_callback (ex_event, 1); diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index e8c8750..86eec4a 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -184,6 +184,24 @@ enum target_hw_bp_type hw_execute = 3 /* Execute HW breakpoint */ }; +/* This structure is a collection of function pointers that, if available, + will be called instead of the performing the default action for this + bptype. */ + +struct breakpoint_ops +{ + /* The normal print routine for this breakpoint, called when we + hit it. */ + enum print_stop_action (*print_it) (struct breakpoint *); + + /* Display information about this breakpoint, for "info breakpoints". */ + void (*print_one) (struct breakpoint *, CORE_ADDR *); + + /* Display information about this breakpoint after setting it (roughly + speaking; this is called from "mention"). */ + void (*print_mention) (struct breakpoint *); +}; + /* Note that the ->silent field is not currently used by any commands (though the code is in there if it was to be, and set_raw_breakpoint does set it to 0). I implemented it because I thought it would be @@ -306,6 +324,9 @@ struct breakpoint char *exec_pathname; asection *section; + + /* Methods associated with this breakpoint. */ + struct breakpoint_ops *ops; }; /* The following stuff is an abstract data type "bpstat" ("breakpoint @@ -623,7 +644,7 @@ extern void set_longjmp_resume_breakpoint (CORE_ADDR, struct frame_id); enabled watchpoints. When disabled, the watchpoints are marked call_disabled. When reenabled, they are marked enabled. - The intended client of these functions is infcmd.c\run_stack_dummy. + The intended client of these functions is call_function_by_hand. The inferior must be stopped, and all breakpoints removed, when these functions are used. diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index b426652..9e87a63 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -232,6 +232,7 @@ @V@/gdb/testsuite/gdb.c++/m-static1.cc @V@/gdb/testsuite/gdb.cxx/m-stat1.cc @V@/gdb/testsuite/gdb.c++/m-static.exp @V@/gdb/testsuite/gdb.cxx/m-static.exp @V@/gdb/testsuite/gdb.c++/m-static.h @V@/gdb/testsuite/gdb.cxx/m-static.h +@V@/gdb/testsuite/gdb.c++/maint.exp @V@/gdb/testsuite/gdb.cxx/maint.exp @V@/gdb/testsuite/gdb.c++/member-ptr.cc @V@/gdb/testsuite/gdb.cxx/member-ptr.cc @V@/gdb/testsuite/gdb.c++/member-ptr.exp @V@/gdb/testsuite/gdb.cxx/member-ptr.exp @V@/gdb/testsuite/gdb.c++/method.cc @V@/gdb/testsuite/gdb.cxx/method.cc diff --git a/gdb/config/ia64/tm-ia64.h b/gdb/config/ia64/tm-ia64.h index 9ebe9ae..dc36127 100644 --- a/gdb/config/ia64/tm-ia64.h +++ b/gdb/config/ia64/tm-ia64.h @@ -40,7 +40,7 @@ #define PC_REGNUM IA64_IP_REGNUM #define SP_REGNUM IA64_GR12_REGNUM -#define FP_REGNUM IA64_VFP_REGNUM +#define DEPRECATED_FP_REGNUM IA64_VFP_REGNUM /* Total amount of space needed to store our copies of the machine's register state, the array `registers'. On the ia64, all registers diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index c0b3e26..8646ab0 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -27,7 +27,9 @@ /* 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 +#ifndef GDB_MULTI_ARCH +#define GDB_MULTI_ARCH 1 +#endif /* NOTE: cagney/2002-11-24: This is a guess. */ #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0 @@ -43,11 +45,6 @@ struct value; struct type; struct inferior_status; -/* By default assume we don't have to worry about software floating point. */ -#ifndef SOFT_FLOAT -#define SOFT_FLOAT 0 -#endif - /* Get at various relevent fields of an instruction word. */ #define MASK_5 0x1f @@ -61,96 +58,14 @@ struct inferior_status; ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1)) #endif -#if !GDB_MULTI_ARCH -extern int hppa_reg_struct_has_addr (int gcc_p, struct type *type); -#define REG_STRUCT_HAS_ADDR(gcc_p,type) hppa_reg_struct_has_addr (gcc_p,type) -#endif - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#if !GDB_MULTI_ARCH -#define FUNCTION_START_OFFSET 0 -#endif - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_skip_prologue (CORE_ADDR); -#define SKIP_PROLOGUE(pc) (hppa_skip_prologue (pc)) -#endif - -/* If PC is in some function-call trampoline code, return the PC - where the function itself actually starts. If not, return NULL. */ - -#if !GDB_MULTI_ARCH -#define SKIP_TRAMPOLINE_CODE(pc) hppa_skip_trampoline_code (pc) -extern CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR); -#endif - -/* Return non-zero if we are in an appropriate trampoline. */ - -#if !GDB_MULTI_ARCH -#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ - hppa_in_solib_call_trampoline (pc, name) -extern int hppa_in_solib_call_trampoline (CORE_ADDR, char *); -#endif - -#if !GDB_MULTI_ARCH -#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ - hppa_in_solib_return_trampoline (pc, name) -extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *); -#endif - -#if !GDB_MULTI_ARCH -#undef DEPRECATED_SAVED_PC_AFTER_CALL -#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame) -extern CORE_ADDR hppa_saved_pc_after_call (struct frame_info *); -#endif - -#if !GDB_MULTI_ARCH -extern int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs); -#define INNER_THAN(lhs,rhs) hppa_inner_than(lhs,rhs) -#endif - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); -#define STACK_ALIGN(sp) hppa_stack_align (sp) -#endif - /* Sequence of bytes for breakpoint instruction. */ #define BREAKPOINT {0x00, 0x01, 0x00, 0x04} #define BREAKPOINT32 0x10004 -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. - - Not on the PA-RISC */ - -#if !GDB_MULTI_ARCH -#define DECR_PC_AFTER_BREAK 0 -#endif - extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc) -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#if !GDB_MULTI_ARCH -#define REGISTER_SIZE 4 -#endif - -/* Number of machine registers */ - -#if !GDB_MULTI_ARCH -#define NUM_REGS 128 -#endif - /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. They are in rows of eight entries */ @@ -184,13 +99,6 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); other r registers. */ #define FLAGS_REGNUM 0 /* Various status flags */ #define RP_REGNUM 2 /* return pointer */ -#if !GDB_MULTI_ARCH -#define FP_REGNUM 3 /* Contains address of executing stack */ - /* frame */ -#endif -#if !GDB_MULTI_ARCH -#define SP_REGNUM 30 /* Contains address of top of stack */ -#endif #define SAR_REGNUM 32 /* Shift Amount Register */ #define IPSW_REGNUM 41 /* Interrupt Processor Status Word */ #define PCOQ_HEAD_REGNUM 33 /* instruction offset queue head */ @@ -205,9 +113,6 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define CCR_REGNUM 54 /* Coprocessor Configuration Register */ #define TR0_REGNUM 57 /* Temporary Registers (cr24 -> cr31) */ #define CR27_REGNUM 60 /* Base register for thread-local storage, cr27 */ -#if !GDB_MULTI_ARCH -#define FP0_REGNUM 64 /* floating point reg. 0 (fspr) */ -#endif #define FP4_REGNUM 72 #define ARG0_REGNUM 26 /* The first argument of a callee. */ @@ -215,14 +120,6 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define ARG2_REGNUM 24 /* The third argument of a callee. */ #define ARG3_REGNUM 23 /* The fourth argument of a callee. */ -/* compatibility with the rest of gdb. */ -#if !GDB_MULTI_ARCH -#define PC_REGNUM PCOQ_HEAD_REGNUM -#endif -#if !GDB_MULTI_ARCH -#define NPC_REGNUM PCOQ_TAIL_REGNUM -#endif - /* * Processor Status Word Masks */ @@ -260,107 +157,12 @@ extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define DEPRECATED_DO_REGISTERS_INFO(_regnum, fp) pa_do_registers_info (_regnum, fp) extern void pa_do_registers_info (int, int); -#if 0 -#define STRCAT_REGISTER(regnum, fpregs, stream, precision) pa_do_strcat_registers_info (regnum, fpregs, stream, precision) -extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precision_type); -#endif - /* PA specific macro to see if the current instruction is nullified. */ #ifndef INSTRUCTION_NULLIFIED extern int hppa_instruction_nullified (void); #define INSTRUCTION_NULLIFIED hppa_instruction_nullified () #endif -/* Number of bytes of storage in the actual machine representation - for register N. On the PA-RISC, all regs are 4 bytes, including - the FP registers (they're accessed as two 4 byte halves). */ - -#if !GDB_MULTI_ARCH -extern int hppa_register_raw_size (int reg_nr); -#define REGISTER_RAW_SIZE(N) hppa_register_raw_size (N) -#endif - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -#if !GDB_MULTI_ARCH -#define REGISTER_BYTES (NUM_REGS * 4) -#endif - -#if !GDB_MULTI_ARCH -extern int hppa_register_byte (int reg_nr); -#define REGISTER_BYTE(N) hppa_register_byte (N) -#endif - -/* Number of bytes of storage in the program's representation - for register N. */ - -#if !GDB_MULTI_ARCH -#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) -#endif - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#if !GDB_MULTI_ARCH -#define DEPRECATED_MAX_REGISTER_RAW_SIZE 4 -#endif - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#if !GDB_MULTI_ARCH -#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8 -#endif - -#if !GDB_MULTI_ARCH -extern struct type * hppa_register_virtual_type (int reg_nr); -#define REGISTER_VIRTUAL_TYPE(N) hppa_register_virtual_type (N) -#endif - -#if !GDB_MULTI_ARCH -extern void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); -#define STORE_STRUCT_RETURN(ADDR, SP) hppa_store_struct_return (ADDR, SP) -#endif - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -#if !GDB_MULTI_ARCH -void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf); -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - hppa_extract_return_value (TYPE, REGBUF, VALBUF); -#endif - - /* elz: decide whether the function returning a value of type type - will put it on the stack or in the registers. - The pa calling convention says that: - register 28 (called ret0 by gdb) contains any ASCII char, - and any non_floating point value up to 32-bits. - reg 28 and 29 contain non-floating point up tp 64 bits and larger - than 32 bits. (higer order word in reg 28). - fr4: floating point up to 64 bits - sr1: space identifier (32-bit) - stack: any lager than 64-bit, with the address in r28 - */ -#if !GDB_MULTI_ARCH -extern use_struct_convention_fn hppa_use_struct_convention; -#define USE_STRUCT_CONVENTION(gcc_p,type) hppa_use_struct_convention (gcc_p,type) -#endif - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ - -#if !GDB_MULTI_ARCH -extern void hppa_store_return_value (struct type *type, char *valbuf); -#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ - hppa_store_return_value (TYPE, VALBUF); -#endif - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_extract_struct_value_address (char *regbuf); -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - hppa_extract_struct_value_address (REGBUF) -#endif - /* elz: Return a large value, which is stored on the stack at addr. This is defined only for the hppa, at this moment. The above macro DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS is not called anymore, @@ -376,93 +178,12 @@ struct value *hppa_value_returned_from_stack (register struct type *valtype, #define VALUE_RETURNED_FROM_STACK(valtype,addr) \ hppa_value_returned_from_stack (valtype, addr) -#if !GDB_MULTI_ARCH -extern int hppa_cannot_store_register (int regnum); -#define CANNOT_STORE_REGISTER(regno) hppa_cannot_store_register (regno) -#endif - -#if !GDB_MULTI_ARCH -#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame) -extern void hppa_init_extra_frame_info (int, struct frame_info *); -#endif - -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ - -/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces - the frame's chain-pointer. */ - -/* In the case of the PA-RISC, the frame's nominal address - is the address of a 4-byte word containing the calling frame's - address (previous FP). */ - -#if !GDB_MULTI_ARCH -#define DEPRECATED_FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe) -extern CORE_ADDR hppa_frame_chain (struct frame_info *); -#endif - -#if !GDB_MULTI_ARCH -extern int hppa_frame_chain_valid (CORE_ADDR, struct frame_info *); -#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe) -#endif - -/* Define other aspects of the stack frame. */ - -/* A macro that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. If it - does not, FRAMELESS is set to 1, else 0. */ -#if !GDB_MULTI_ARCH -#define FRAMELESS_FUNCTION_INVOCATION(FI) \ - (hppa_frameless_function_invocation (FI)) -extern int hppa_frameless_function_invocation (struct frame_info *); -#endif - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); -#define DEPRECATED_FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) -#endif - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_frame_args_address (struct frame_info *fi); -#define FRAME_ARGS_ADDRESS(fi) hppa_frame_args_address (fi) -#endif - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); -#define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi) -#endif - -#if !GDB_MULTI_ARCH -extern int hppa_frame_num_args (struct frame_info *frame); -#define FRAME_NUM_ARGS(fi) hppa_frame_num_args (fi) -#endif - -#if !GDB_MULTI_ARCH -#define FRAME_ARGS_SKIP 0 -#endif - extern void hppa_frame_init_saved_regs (struct frame_info *); #define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) \ hppa_frame_init_saved_regs (FI) -/* Things needed for making the inferior call functions. */ - -#if !GDB_MULTI_ARCH -#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame () -extern void hppa_push_dummy_frame (void); -#endif - -/* Discard from the stack the innermost frame, - restoring all saved registers. */ -#if !GDB_MULTI_ARCH -#define DEPRECATED_POP_FRAME hppa_pop_frame () -extern void hppa_pop_frame (void); -#endif - #define INSTRUCTION_SIZE 4 -#ifndef PA_LEVEL_0 - /* Non-level zero PA's have space registers (but they don't always have floating-point, do they???? */ @@ -544,52 +265,8 @@ extern void hppa_pop_frame (void); 0xe6c00002, 0xe4202000, 0x6bdf3fd1, 0x00010004,\ 0x00151820, 0xe6c00002, 0x08000240, 0x08000240} -#if !GDB_MULTI_ARCH -#define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 28) -#endif #define REG_PARM_STACK_SPACE 16 -#else /* defined PA_LEVEL_0 */ - -/* FIXME: brobecker 2002-12-26. PA_LEVEL_0 is only defined for the - hppa-pro target, which should be obsoleted soon. The following - section will therefore not be included in the multiarch conversion. */ -/* This is the call dummy for a level 0 PA. Level 0's don't have space - registers (or floating point?), so we skip all that inter-space call stuff, - and avoid touching the fp regs. - - call_dummy - - ldw -36(%sp), %arg0 - ldw -40(%sp), %arg1 - ldw -44(%sp), %arg2 - ldw -48(%sp), %arg3 - ldil 0, %r31 ; FUNC_LDIL_OFFSET must point here - ldo 0(%r31), %r31 ; FUNC_LDO_OFFSET must point here - ble 0(%sr0, %r31) - copy %r31, %r2 - break 4, 8 - nop ; restore_pc_queue expects these - bv,n 0(%r22) ; instructions to be here... - nop - */ - -/* Define offsets into the call dummy for the target function address */ -#define FUNC_LDIL_OFFSET (INSTRUCTION_SIZE * 4) -#define FUNC_LDO_OFFSET (INSTRUCTION_SIZE * 5) - -#define CALL_DUMMY {0x4bda3fb9, 0x4bd93fb1, 0x4bd83fa9, 0x4bd73fa1,\ - 0x23e00000, 0x37ff0000, 0xe7e00000, 0x081f0242,\ - 0x00010004, 0x08000240, 0xeac0c002, 0x08000240} - -#define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 12) - -#endif /* defined PA_LEVEL_0 */ - -#if !GDB_MULTI_ARCH -#define CALL_DUMMY_START_OFFSET 0 -#endif - /* If we've reached a trap instruction within the call dummy, then we'll consider that to mean that we've reached the call dummy's end after its successful completion. */ @@ -614,25 +291,8 @@ extern void hppa_pop_frame (void); extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, struct value **, struct type *, int); -#if !GDB_MULTI_ARCH -#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); -#endif - - -#if !GDB_MULTI_ARCH -extern CORE_ADDR hppa_smash_text_address (CORE_ADDR addr); -#define SMASH_TEXT_ADDRESS(addr) hppa_smash_text_address (addr) -#endif - #define GDB_TARGET_IS_HPPA -#if !GDB_MULTI_ARCH -#define BELIEVE_PCC_PROMOTION 1 -#endif - /* * Unwind table and descriptor. */ @@ -752,27 +412,6 @@ typedef struct obj_private_struct } obj_private_data_t; -#if 0 -extern void target_write_pc (CORE_ADDR, int); -extern CORE_ADDR target_read_pc (int); -extern CORE_ADDR skip_trampoline_code (CORE_ADDR, char *); -#endif - -#if !GDB_MULTI_ARCH -#define TARGET_READ_PC(pid) hppa_target_read_pc (pid) -extern CORE_ADDR hppa_target_read_pc (ptid_t); -#endif - -#if !GDB_MULTI_ARCH -#define TARGET_WRITE_PC(v,pid) hppa_target_write_pc (v,pid) -extern void hppa_target_write_pc (CORE_ADDR, ptid_t); -#endif - -#if !GDB_MULTI_ARCH -#define TARGET_READ_FP() hppa_target_read_fp () -extern CORE_ADDR hppa_target_read_fp (void); -#endif - /* For a number of horrible reasons we may have to adjust the location of variables on the stack. Ugh. */ #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR) diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index 503e426..17f40aa 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -28,6 +28,324 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ gotten working yet. */ #define GDB_TARGET_IS_HPPA_20W +/* FIXME: brobecker 2003-04-21: Although 32bit hppa is partially multiarched, + the conversion for hppa64 hasn't been completed yet. */ +#define GDB_MULTI_ARCH 0 + +/* FIXME: brobecker 2003-04-21: All the definition from this point until + the include of pa/tm-hppah.h are extracted from tm-hppa.h. They have + been temporarily moved here, until hppa64 is multiarched too. */ + +#if !GDB_MULTI_ARCH +extern int hppa_reg_struct_has_addr (int gcc_p, struct type *type); +#define REG_STRUCT_HAS_ADDR(gcc_p,type) hppa_reg_struct_has_addr (gcc_p,type) +#endif + +/* Offset from address of function to start of its code. + Zero on most machines. */ + +#if !GDB_MULTI_ARCH +#define FUNCTION_START_OFFSET 0 +#endif + +/* Advance PC across any function entry prologue instructions + to reach some "real" code. */ + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_skip_prologue (CORE_ADDR); +#define SKIP_PROLOGUE(pc) (hppa_skip_prologue (pc)) +#endif + +/* If PC is in some function-call trampoline code, return the PC + where the function itself actually starts. If not, return NULL. */ + +#if !GDB_MULTI_ARCH +#define SKIP_TRAMPOLINE_CODE(pc) hppa_skip_trampoline_code (pc) +extern CORE_ADDR hppa_skip_trampoline_code (CORE_ADDR); +#endif + +/* Return non-zero if we are in an appropriate trampoline. */ + +#if !GDB_MULTI_ARCH +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ + hppa_in_solib_call_trampoline (pc, name) +extern int hppa_in_solib_call_trampoline (CORE_ADDR, char *); +#endif + +#if !GDB_MULTI_ARCH +#define IN_SOLIB_RETURN_TRAMPOLINE(pc, name) \ + hppa_in_solib_return_trampoline (pc, name) +extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *); +#endif + +#if !GDB_MULTI_ARCH +#undef DEPRECATED_SAVED_PC_AFTER_CALL +#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame) +extern CORE_ADDR hppa_saved_pc_after_call (struct frame_info *); +#endif + +#if !GDB_MULTI_ARCH +extern int hppa_inner_than (CORE_ADDR lhs, CORE_ADDR rhs); +#define INNER_THAN(lhs,rhs) hppa_inner_than(lhs,rhs) +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); +#define STACK_ALIGN(sp) hppa_stack_align (sp) +#endif + +/* Amount PC must be decremented by after a breakpoint. + This is often the number of bytes in BREAKPOINT + but not always. + + Not on the PA-RISC */ + +#if !GDB_MULTI_ARCH +#define DECR_PC_AFTER_BREAK 0 +#endif + +/* Say how long (ordinary) registers are. This is a piece of bogosity + used in push_word and a few other places; REGISTER_RAW_SIZE is the + real way to know how big a register is. */ + +#if !GDB_MULTI_ARCH +#define REGISTER_SIZE 4 +#endif + +/* Number of machine registers */ + +#if !GDB_MULTI_ARCH +#define NUM_REGS 128 +#endif + +#if !GDB_MULTI_ARCH +#define DEPRECATED_FP_REGNUM 3 /* Contains address of executing stack */ + /* frame */ +#endif +#if !GDB_MULTI_ARCH +#define SP_REGNUM 30 /* Contains address of top of stack */ +#endif + +#if !GDB_MULTI_ARCH +#define FP0_REGNUM 64 /* floating point reg. 0 (fspr) */ +#endif + +/* compatibility with the rest of gdb. */ +#if !GDB_MULTI_ARCH +#define PC_REGNUM PCOQ_HEAD_REGNUM +#endif +#if !GDB_MULTI_ARCH +#define NPC_REGNUM PCOQ_TAIL_REGNUM +#endif + +/* Number of bytes of storage in the actual machine representation + for register N. On the PA-RISC, all regs are 4 bytes, including + the FP registers (they're accessed as two 4 byte halves). */ + +#if !GDB_MULTI_ARCH +extern int hppa_register_raw_size (int reg_nr); +#define REGISTER_RAW_SIZE(N) hppa_register_raw_size (N) +#endif + +/* Total amount of space needed to store our copies of the machine's + register state, the array `registers'. */ +#if !GDB_MULTI_ARCH +#define REGISTER_BYTES (NUM_REGS * 4) +#endif + +#if !GDB_MULTI_ARCH +extern int hppa_register_byte (int reg_nr); +#define REGISTER_BYTE(N) hppa_register_byte (N) +#endif + +/* Number of bytes of storage in the program's representation + for register N. */ + +#if !GDB_MULTI_ARCH +#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) +#endif + +/* Largest value REGISTER_RAW_SIZE can have. */ + +#if !GDB_MULTI_ARCH +#define DEPRECATED_MAX_REGISTER_RAW_SIZE 4 +#endif + +/* Largest value REGISTER_VIRTUAL_SIZE can have. */ + +#if !GDB_MULTI_ARCH +#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8 +#endif + +#if !GDB_MULTI_ARCH +extern struct type * hppa_register_virtual_type (int reg_nr); +#define REGISTER_VIRTUAL_TYPE(N) hppa_register_virtual_type (N) +#endif + +#if !GDB_MULTI_ARCH +extern void hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); +#define STORE_STRUCT_RETURN(ADDR, SP) hppa_store_struct_return (ADDR, SP) +#endif + +/* Extract from an array REGBUF containing the (raw) register state + a function return value of type TYPE, and copy that, in virtual format, + into VALBUF. */ + +#if !GDB_MULTI_ARCH +void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf); +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ + hppa_extract_return_value (TYPE, REGBUF, VALBUF); +#endif + + /* elz: decide whether the function returning a value of type type + will put it on the stack or in the registers. + The pa calling convention says that: + register 28 (called ret0 by gdb) contains any ASCII char, + and any non_floating point value up to 32-bits. + reg 28 and 29 contain non-floating point up tp 64 bits and larger + than 32 bits. (higer order word in reg 28). + fr4: floating point up to 64 bits + sr1: space identifier (32-bit) + stack: any lager than 64-bit, with the address in r28 + */ +#if !GDB_MULTI_ARCH +extern use_struct_convention_fn hppa_use_struct_convention; +#define USE_STRUCT_CONVENTION(gcc_p,type) hppa_use_struct_convention (gcc_p,type) +#endif + +/* Write into appropriate registers a function return value + of type TYPE, given in virtual format. */ + +#if !GDB_MULTI_ARCH +extern void hppa_store_return_value (struct type *type, char *valbuf); +#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ + hppa_store_return_value (TYPE, VALBUF); +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_extract_struct_value_address (char *regbuf); +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ + hppa_extract_struct_value_address (REGBUF) +#endif + +#if !GDB_MULTI_ARCH +extern int hppa_cannot_store_register (int regnum); +#define CANNOT_STORE_REGISTER(regno) hppa_cannot_store_register (regno) +#endif + +#if !GDB_MULTI_ARCH +#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame) +extern void hppa_init_extra_frame_info (int, struct frame_info *); +#endif + +/* Describe the pointer in each stack frame to the previous stack frame + (its caller). */ + +/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces + the frame's chain-pointer. */ + +/* In the case of the PA-RISC, the frame's nominal address + is the address of a 4-byte word containing the calling frame's + address (previous FP). */ + +#if !GDB_MULTI_ARCH +#define DEPRECATED_FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe) +extern CORE_ADDR hppa_frame_chain (struct frame_info *); +#endif + +#if !GDB_MULTI_ARCH +extern int hppa_frame_chain_valid (CORE_ADDR, struct frame_info *); +#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe) +#endif + +/* Define other aspects of the stack frame. */ + +/* A macro that tells us whether the function invocation represented + by FI does not have a frame on the stack associated with it. If it + does not, FRAMELESS is set to 1, else 0. */ +#if !GDB_MULTI_ARCH +#define FRAMELESS_FUNCTION_INVOCATION(FI) \ + (hppa_frameless_function_invocation (FI)) +extern int hppa_frameless_function_invocation (struct frame_info *); +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); +#define DEPRECATED_FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_frame_args_address (struct frame_info *fi); +#define FRAME_ARGS_ADDRESS(fi) hppa_frame_args_address (fi) +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); +#define FRAME_LOCALS_ADDRESS(fi) hppa_frame_locals_address (fi) +#endif + +#if !GDB_MULTI_ARCH +extern int hppa_frame_num_args (struct frame_info *frame); +#define FRAME_NUM_ARGS(fi) hppa_frame_num_args (fi) +#endif + +#if !GDB_MULTI_ARCH +#define FRAME_ARGS_SKIP 0 +#endif + +/* Things needed for making the inferior call functions. */ + +#if !GDB_MULTI_ARCH +#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame () +extern void hppa_push_dummy_frame (void); +#endif + +/* Discard from the stack the innermost frame, + restoring all saved registers. */ +#if !GDB_MULTI_ARCH +#define DEPRECATED_POP_FRAME hppa_pop_frame () +extern void hppa_pop_frame (void); +#endif + +#if !GDB_MULTI_ARCH +#define CALL_DUMMY_LENGTH (INSTRUCTION_SIZE * 28) +#endif + +#if !GDB_MULTI_ARCH +#define CALL_DUMMY_START_OFFSET 0 +#endif + +#if !GDB_MULTI_ARCH +#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); +#endif + +#if !GDB_MULTI_ARCH +extern CORE_ADDR hppa_smash_text_address (CORE_ADDR addr); +#define SMASH_TEXT_ADDRESS(addr) hppa_smash_text_address (addr) +#endif + +#if !GDB_MULTI_ARCH +#define BELIEVE_PCC_PROMOTION 1 +#endif + +#if !GDB_MULTI_ARCH +#define TARGET_READ_PC(pid) hppa_target_read_pc (pid) +extern CORE_ADDR hppa_target_read_pc (ptid_t); +#endif + +#if !GDB_MULTI_ARCH +#define TARGET_WRITE_PC(v,pid) hppa_target_write_pc (v,pid) +extern void hppa_target_write_pc (CORE_ADDR, ptid_t); +#endif + +#if !GDB_MULTI_ARCH +#define DEPRECATED_TARGET_READ_FP() hppa_target_read_fp () +extern CORE_ADDR hppa_target_read_fp (void); +#endif + #include "pa/tm-hppah.h" #define HPUX_1100 1 @@ -219,12 +537,12 @@ call_dummy */ #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ { \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT && !SOFT_FLOAT) \ + if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ memcpy ((VALBUF), \ ((char *)(REGBUF)) + REGISTER_BYTE (FP4_REGNUM) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ TYPE_LENGTH (TYPE)); \ - else if (is_integral_type(TYPE) || SOFT_FLOAT) \ + else if (is_integral_type(TYPE)) \ memcpy ((VALBUF), \ (char *)(REGBUF) + REGISTER_BYTE (28) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ @@ -253,13 +571,13 @@ call_dummy #undef DEPRECATED_STORE_RETURN_VALUE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ { \ - if (TYPE_CODE (TYPE) == TYPE_CODE_FLT && !SOFT_FLOAT) \ + if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ deprecated_write_register_bytes \ (REGISTER_BYTE (FP4_REGNUM) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ (VALBUF), \ TYPE_LENGTH (TYPE)); \ - else if (is_integral_type(TYPE) || SOFT_FLOAT) \ + else if (is_integral_type(TYPE)) \ deprecated_write_register_bytes \ (REGISTER_BYTE (28) + \ (REGISTER_SIZE - TYPE_LENGTH (TYPE)), \ diff --git a/gdb/config/s390/tm-s390.h b/gdb/config/s390/tm-s390.h index 1c6e678..2bb4c2d 100644 --- a/gdb/config/s390/tm-s390.h +++ b/gdb/config/s390/tm-s390.h @@ -80,7 +80,7 @@ int s390_register_byte (int reg_nr); #define PC_REGNUM S390_PC_REGNUM #define NUM_REGS S390_NUM_REGS #define NUM_FREGS S390_NUM_FPRS -#define FP_REGNUM S390_FP_REGNUM +#define DEPRECATED_FP_REGNUM S390_FP_REGNUM #define SP_REGNUM S390_SP_REGNUM /* Obviously ptrace for user program tracing cannot be allowed mess with control registers (except per registers for hardware watchpoints), diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 2d2193d..f46d459 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -269,7 +269,7 @@ extern CORE_ADDR sparc64_read_fp (); extern void sparc64_write_sp (CORE_ADDR); #define TARGET_READ_SP() (sparc64_read_sp ()) -#define TARGET_READ_FP() (sparc64_read_fp ()) +#define DEPRECATED_TARGET_READ_FP() (sparc64_read_fp ()) #define DEPRECATED_DUMMY_WRITE_SP(X) (sparc64_write_sp (X)) #undef DEPRECATED_EXTRACT_RETURN_VALUE @@ -297,7 +297,7 @@ extern void sp64_extract_return_value (struct type *, char[], char *, int); #define L0_REGNUM 16 /* First local reg that's saved on stack frame rather than in machine registers */ #define I0_REGNUM 24 /* %i0 */ -#define FP_REGNUM 30 /* Contains address of executing stack frame */ +#define DEPRECATED_FP_REGNUM 30 /* Contains address of executing stack frame */ #define I7_REGNUM 31 /* Last local reg saved on stack frame */ #define FP0_REGNUM 32 /* Floating point register 0 */ #endif diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 414b69e..e997bab 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -182,7 +182,7 @@ extern int sparc_intreg_size (void); #define SP_REGNUM 14 /* Contains address of top of stack, \ which is also the bottom of the frame. */ -#define FP_REGNUM 30 /* Contains address of executing stack frame */ +#define DEPRECATED_FP_REGNUM 30 /* Contains address of executing stack frame */ #define FP0_REGNUM 32 /* Floating point register 0 */ @@ -201,8 +201,9 @@ extern int sparc_intreg_size (void); remove the ins and locals from `registers', make sure that frame_register() can get them from the stack (even in the innermost frame), and make this the way to access them. For the frame - pointer we would do that via TARGET_READ_FP. On the other hand, - that is likely to be confusing or worse for flat frames. */ + pointer we would do that via DEPRECATED_TARGET_READ_FP. On the + other hand, that is likely to be confusing or worse for flat + frames. */ #define REGISTER_BYTES (32*4+32*4+8*4) @@ -545,9 +546,9 @@ extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); * * call_function then writes CALL_DUMMY, pushes the args onto the * stack, and adjusts the stack pointer. - * - * run_stack_dummy then starts execution (in the middle of - * CALL_DUMMY, as directed by call_function). */ + + call_function_by_hand then starts execution (in the middle of + CALL_DUMMY, as directed by call_function). */ #ifndef CALL_DUMMY /* This sequence of words is the instructions diff --git a/gdb/config/vax/nm-vax.h b/gdb/config/vax/nm-vax.h index efebd6b..2518047 100644 --- a/gdb/config/vax/nm-vax.h +++ b/gdb/config/vax/nm-vax.h @@ -24,6 +24,6 @@ { addr = blockend - 0110 + regno * 4; \ if (regno == PC_REGNUM) addr = blockend - 8; \ if (regno == PS_REGNUM) addr = blockend - 4; \ - if (regno == FP_REGNUM) addr = blockend - 0120; \ + if (regno == DEPRECATED_FP_REGNUM) addr = blockend - 0120; \ if (regno == AP_REGNUM) addr = blockend - 0124; \ if (regno == SP_REGNUM) addr = blockend - 20; } diff --git a/gdb/corefile.c b/gdb/corefile.c index 8a0073a..094a3ef 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -238,28 +238,6 @@ read_memory (CORE_ADDR memaddr, char *myaddr, int len) memory_error (status, memaddr); } -/* Like target_read_memory, but slightly different parameters. */ -int -dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len, - disassemble_info *info) -{ - return target_read_memory (memaddr, (char *) myaddr, len); -} - -/* Like memory_error with slightly different parameters. */ -void -dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info) -{ - memory_error (status, memaddr); -} - -/* Like print_address with slightly different parameters. */ -void -dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) -{ - print_address (addr, info->stream); -} - /* Argument / return result struct for use with do_captured_read_memory_integer(). MEMADDR and LEN are filled in by gdb_read_memory_integer(). RESULT is the contents that were diff --git a/gdb/cp-support.c b/gdb/cp-support.c index ca47854..14456f8 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -57,16 +57,7 @@ static void first_component_command (char *arg, int from_tty); 'foo' in an anonymous namespace gets demangled as "(anonymous namespace)::foo". - - And operator names can contain parentheses or angle brackets. - Fortunately, I _think_ that operator names can only occur in a - fairly restrictive set of locations (in particular, they have be - at depth 0, don't they?). */ - -/* NOTE: carlton/2003-02-21: Daniel Jacobowitz came up with an example - where operator names don't occur at depth 0. Sigh. (It involved a - template argument that was a pointer: I hadn't realized that was - possible.) Handling such edge cases does not seem like a - high-priority problem to me. */ + - And operator names can contain parentheses or angle brackets. */ /* FIXME: carlton/2003-03-13: We have several functions here with overlapping functionality; can we combine them? Also, do they @@ -209,40 +200,14 @@ method_name_from_physname (const char *physname) unsigned int cp_find_first_component (const char *name) { - /* Names like 'operator<<' screw up the recursion, so let's - special-case them. I _hope_ they can only occur at the start of - a component. */ - unsigned int index = 0; - - if (strncmp (name, "operator", LENGTH_OF_OPERATOR) == 0) - { - index += LENGTH_OF_OPERATOR; - while (isspace(name[index])) - ++index; - switch (name[index]) - { - case '<': - if (name[index + 1] == '<') - index += 2; - else - index += 1; - break; - case '>': - case '-': - if (name[index + 1] == '>') - index += 2; - else - index += 1; - break; - case '(': - index += 2; - break; - default: - index += 1; - break; - } - } + /* Operator names can show up in unexpected places. Since these can + contain parentheses or angle brackets, they can screw up the + recursion. But not every string 'operator' is part of an + operater name: e.g. you could have a variable 'cooperator'. So + this variable tells us whether or not we should treat the string + 'operator' as starting an operator. */ + int operator_possible = 1; for (;; ++index) { @@ -261,6 +226,7 @@ cp_find_first_component (const char *name) gdb_assert (name[index] == ':'); index += 2; } + operator_possible = 1; break; case '(': /* Similar comment as to '<'. */ @@ -272,13 +238,63 @@ cp_find_first_component (const char *name) gdb_assert (name[index] == ':'); index += 2; } + operator_possible = 1; break; case '>': case ')': case '\0': case ':': return index; + case 'o': + /* Operator names can screw up the recursion. */ + if (operator_possible + && strncmp (name + index, "operator", LENGTH_OF_OPERATOR) == 0) + { + index += LENGTH_OF_OPERATOR; + while (isspace(name[index])) + ++index; + switch (name[index]) + { + /* Skip over one less than the appropriate number of + characters: the for loop will skip over the last + one. */ + case '<': + if (name[index + 1] == '<') + index += 1; + else + index += 0; + break; + case '>': + case '-': + if (name[index + 1] == '>') + index += 1; + else + index += 0; + break; + case '(': + index += 1; + break; + default: + index += 0; + break; + } + } + operator_possible = 0; + break; + case ' ': + case ',': + case '.': + case '&': + case '*': + /* NOTE: carlton/2003-04-18: I'm not sure what the precise + set of relevant characters are here: it's necessary to + include any character that can show up before 'operator' + in a demangled name, and it's safe to include any + character that can't be part of an identifier's name. */ + operator_possible = 1; + break; default: + operator_possible = 0; break; } } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index f03cd14..a963d21 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -53,7 +53,7 @@ enum cris_num_regs }; /* Register numbers of various important registers. - FP_REGNUM Contains address of executing stack frame. + DEPRECATED_FP_REGNUM Contains address of executing stack frame. STR_REGNUM Contains the address of structure return values. RET_REGNUM Contains the return value when shorter than or equal to 32 bits ARG1_REGNUM Contains the first parameter to a function. @@ -65,8 +65,8 @@ enum cris_num_regs SRP_REGNUM Subroutine return pointer register. BRP_REGNUM Breakpoint return pointer register. */ -/* FP_REGNUM = 8, SP_REGNUM = 14, and PC_REGNUM = 15 have been incorporated - into the multi-arch framework. */ +/* DEPRECATED_FP_REGNUM = 8, SP_REGNUM = 14, and PC_REGNUM = 15 have + been incorporated into the multi-arch framework. */ enum cris_regnums { @@ -529,7 +529,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, } get_frame_extra_info (fi)->leaf_function = 0; } - else if (regno == FP_REGNUM) + else if (regno == DEPRECATED_FP_REGNUM) { have_fp = 1; } @@ -616,7 +616,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, break; } } - else if (cris_get_operand2 (insn) == FP_REGNUM + else if (cris_get_operand2 (insn) == DEPRECATED_FP_REGNUM /* The size is a fixed-size. */ && ((insn & 0x0F00) >> 8) == 0x0001 /* A negative offset. */ @@ -640,7 +640,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, break; } } - else if (cris_get_operand2 (insn) == FP_REGNUM + else if (cris_get_operand2 (insn) == DEPRECATED_FP_REGNUM /* The size is a fixed-size. */ && ((insn & 0x0F00) >> 8) == 0x0001 /* A positive offset. */ @@ -681,7 +681,7 @@ cris_examine (CORE_ADDR ip, CORE_ADDR limit, struct frame_info *fi, if (have_fp) { - get_frame_saved_regs (fi)[FP_REGNUM] = get_frame_base (fi); + get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] = get_frame_base (fi); /* Calculate the addresses. */ for (regno = regsave; regno >= 0; regno--) @@ -1216,8 +1216,8 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) get_frame_base (fi), get_frame_base (fi))) { - /* We need to setup fi->frame here because run_stack_dummy gets it wrong - by assuming it's always FP. */ + /* We need to setup fi->frame here because call_function_by_hand + gets it wrong by assuming it's always FP. */ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM)); get_frame_extra_info (fi)->return_pc = deprecated_read_register_dummy (get_frame_pc (fi), @@ -1536,7 +1536,7 @@ cris_pop_frame (void) /* Restore general registers R0 - R7. They were pushed on the stack after SP was saved. */ - for (regno = 0; regno < FP_REGNUM; regno++) + for (regno = 0; regno < DEPRECATED_FP_REGNUM; regno++) { if (get_frame_saved_regs (fi)[regno]) { @@ -1545,12 +1545,12 @@ cris_pop_frame (void) } } - if (get_frame_saved_regs (fi)[FP_REGNUM]) + if (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM]) { /* Pop the frame pointer (R8). It was pushed before SP was saved. */ - write_register (FP_REGNUM, - read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4)); + write_register (DEPRECATED_FP_REGNUM, + read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4)); stack_offset += 4; /* Not a leaf function. */ @@ -1561,7 +1561,7 @@ cris_pop_frame (void) } /* Restore the SP and adjust for R8 and (possibly) SRP. */ - write_register (SP_REGNUM, get_frame_saved_regs (fi)[FP_REGNUM] + stack_offset); + write_register (SP_REGNUM, get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM] + stack_offset); } else { @@ -3548,7 +3548,7 @@ static void cris_gdb_func (enum cris_op_type op_type, unsigned short inst, static int cris_delayed_get_disassembler (bfd_vma addr, disassemble_info *info) { - tm_print_insn = cris_get_disassembler (exec_bfd); + deprecated_tm_print_insn = cris_get_disassembler (exec_bfd); return TARGET_PRINT_INSN (addr, info); } @@ -3861,7 +3861,7 @@ _initialize_cris_tdep (void) gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep); /* Used in disassembly. */ - tm_print_insn = cris_delayed_get_disassembler; + deprecated_tm_print_insn = cris_delayed_get_disassembler; /* CRIS-specific user-commands. */ c = add_set_cmd ("cris-version", class_support, var_integer, @@ -4182,7 +4182,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* There are 32 registers (some of which may not be implemented). */ set_gdbarch_num_regs (gdbarch, 32); set_gdbarch_sp_regnum (gdbarch, 14); - set_gdbarch_fp_regnum (gdbarch, 8); + set_gdbarch_deprecated_fp_regnum (gdbarch, 8); set_gdbarch_pc_regnum (gdbarch, 15); set_gdbarch_register_name (gdbarch, cris_register_name); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 45ac682..69d8f3b 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -71,7 +71,7 @@ enum R3_REGNUM = 3, D10V_FP_REGNUM = 11, LR_REGNUM = 13, - _SP_REGNUM = 15, + D10V_SP_REGNUM = 15, PSW_REGNUM = 16, _PC_REGNUM = 18, NR_IMAP_REGS = 2, @@ -84,8 +84,17 @@ enum RET1_REGNUM = R0_REGNUM, }; -#define NR_DMAP_REGS (gdbarch_tdep (current_gdbarch)->nr_dmap_regs) -#define A0_REGNUM (gdbarch_tdep (current_gdbarch)->a0_regnum) +int +nr_dmap_regs (struct gdbarch *gdbarch) +{ + return gdbarch_tdep (gdbarch)->nr_dmap_regs; +} + +int +a0_regnum (struct gdbarch *gdbarch) +{ + return gdbarch_tdep (gdbarch)->a0_regnum; +} /* Local functions */ @@ -93,8 +102,6 @@ extern void _initialize_d10v_tdep (void); static CORE_ADDR d10v_read_sp (void); -static CORE_ADDR d10v_read_fp (void); - static void d10v_eva_prepare_to_trace (void); static void d10v_eva_get_trace_data (void); @@ -307,37 +314,6 @@ d10v_ts3_register_sim_regno (int nr) return nr; } -/* Index within `registers' of the first byte of the space for - register REG_NR. */ - -static int -d10v_register_byte (int reg_nr) -{ - if (reg_nr < A0_REGNUM) - return (reg_nr * 2); - else if (reg_nr < (A0_REGNUM + NR_A_REGS)) - return (A0_REGNUM * 2 - + (reg_nr - A0_REGNUM) * 8); - else - return (A0_REGNUM * 2 - + NR_A_REGS * 8 - + (reg_nr - A0_REGNUM - NR_A_REGS) * 2); -} - -/* Number of bytes of storage in the actual machine representation for - register REG_NR. */ - -static int -d10v_register_raw_size (int reg_nr) -{ - if (reg_nr < A0_REGNUM) - return 2; - else if (reg_nr < (A0_REGNUM + NR_A_REGS)) - return 8; - else - return 2; -} - /* Return the GDB type object for the "standard" data type of data in register N. */ @@ -346,10 +322,10 @@ 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 == D10V_FP_REGNUM) + if (reg_nr == D10V_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)) + else if (reg_nr >= a0_regnum (gdbarch) + && reg_nr < (a0_regnum (gdbarch) + NR_A_REGS)) return builtin_type_int64; else return builtin_type_int16; @@ -415,8 +391,7 @@ d10v_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) static CORE_ADDR d10v_pointer_to_address (struct type *type, const void *buf) { - CORE_ADDR addr = extract_address (buf, TYPE_LENGTH (type)); - + CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); /* Is it a code address? */ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD @@ -702,7 +677,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info = FRAME_OBSTACK_ZALLOC (struct d10v_unwind_cache); (*this_prologue_cache) = info; - info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); + info->saved_regs = FRAME_OBSTACK_CALLOC (NUM_REGS, CORE_ADDR); info->size = 0; info->return_pc = 0; @@ -773,20 +748,20 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, to before the first saved register giving the SP. */ prev_sp = this_base + info->size; } - else if (info->saved_regs[SP_REGNUM]) + else if (info->saved_regs[D10V_SP_REGNUM]) { /* The SP was saved (which is very unusual), the frame base is just the PREV's frame's TOP-OF-STACK. */ - this_base = read_memory_unsigned_integer (info->saved_regs[SP_REGNUM], + this_base = read_memory_unsigned_integer (info->saved_regs[D10V_SP_REGNUM], register_size (current_gdbarch, - SP_REGNUM)); + D10V_SP_REGNUM)); prev_sp = this_base; } else { /* Assume that the FP is this frame's SP but with that pushed stack space added back. */ - frame_unwind_unsigned_register (next_frame, SP_REGNUM, &this_base); + frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &this_base); prev_sp = this_base + info->size; } @@ -815,9 +790,9 @@ d10v_frame_unwind_cache (struct frame_info *next_frame, info->return_pc = d10v_make_iaddr (return_pc); } - /* The SP_REGNUM is special. Instead of the address of the SP, the + /* The D10V_SP_REGNUM is special. Instead of the address of the SP, the previous frame's SP value is saved. */ - info->saved_regs[SP_REGNUM] = info->prev_sp; + info->saved_regs[D10V_SP_REGNUM] = info->prev_sp; return info; } @@ -871,12 +846,12 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, fprintf_filtered (file, " "); fprintf_filtered (file, "IMAP%d %04lx", a, d10v_imap_register (a)); } - if (NR_DMAP_REGS == 1) + if (nr_dmap_regs (gdbarch) == 1) /* Registers DMAP0 and DMAP1 are constant. Just return dmap2. */ fprintf_filtered (file, " DMAP %04lx\n", d10v_dmap_register (2)); else { - for (a = 0; a < NR_DMAP_REGS; a++) + for (a = 0; a < nr_dmap_regs (gdbarch); a++) { fprintf_filtered (file, " DMAP%d %04lx", a, d10v_dmap_register (a)); } @@ -888,12 +863,12 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, char *num = alloca (max_register_size (gdbarch)); int a; fprintf_filtered (file, "A0-A%d", NR_A_REGS - 1); - for (a = A0_REGNUM; a < A0_REGNUM + NR_A_REGS; a++) + for (a = a0_regnum (gdbarch); a < a0_regnum (gdbarch) + NR_A_REGS; a++) { int i; fprintf_filtered (file, " "); - frame_register_read (frame, a, num); - for (i = 0; i < max_register_size (current_gdbarch); i++) + frame_read_register (frame, a, num); + for (i = 0; i < register_size (current_gdbarch, a); i++) { fprintf_filtered (file, "%02x", (num[i] & 0xff)); } @@ -938,13 +913,7 @@ d10v_write_pc (CORE_ADDR val, ptid_t ptid) static CORE_ADDR d10v_read_sp (void) { - return (d10v_make_daddr (read_register (SP_REGNUM))); -} - -static CORE_ADDR -d10v_read_fp (void) -{ - return (d10v_make_daddr (read_register (D10V_FP_REGNUM))); + return (d10v_make_daddr (read_register (D10V_SP_REGNUM))); } /* When arguments must be pushed onto the stack, they go on in reverse @@ -1056,7 +1025,7 @@ d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, } /* Finally, update the SP register. */ - regcache_cooked_write_unsigned (regcache, SP_REGNUM, + regcache_cooked_write_unsigned (regcache, D10V_SP_REGNUM, d10v_convert_daddr_to_raw (sp)); return sp; @@ -1071,12 +1040,6 @@ d10v_extract_return_value (struct type *type, struct regcache *regcache, void *valbuf) { int len; -#if 0 - printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), - TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, - (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), - register_size (current_gdbarch, RET1_REGNUM))); -#endif if (TYPE_LENGTH (type) == 1) { ULONGEST c; @@ -1195,9 +1158,9 @@ trace_command (char *args, int from_tty) /* Clear the host-side trace buffer, allocating space if needed. */ trace_data.size = 0; if (trace_data.counts == NULL) - trace_data.counts = (short *) xmalloc (65536 * sizeof (short)); + trace_data.counts = XCALLOC (65536, short); if (trace_data.addrs == NULL) - trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof (CORE_ADDR)); + trace_data.addrs = XCALLOC (65536, CORE_ADDR); tracing = 1; @@ -1236,24 +1199,6 @@ trace_info (char *args, int from_tty) printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off")); } -/* Print the instruction at address MEMADDR in debugged memory, - on STREAM. Returns length of the instruction, in bytes. */ - -static int -print_insn (CORE_ADDR memaddr, struct ui_file *stream) -{ - /* If there's no disassembler, something is very wrong. */ - if (tm_print_insn == NULL) - internal_error (__FILE__, __LINE__, - "print_insn: no disassembler"); - - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - tm_print_insn_info.endian = BFD_ENDIAN_BIG; - else - tm_print_insn_info.endian = BFD_ENDIAN_LITTLE; - return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info); -} - static void d10v_eva_prepare_to_trace (void) { @@ -1414,7 +1359,8 @@ display_trace (int low, int high) printf_filtered (":"); printf_filtered ("\t"); wrap_here (" "); - next_address = next_address + print_insn (next_address, gdb_stdout); + next_address += TARGET_PRINT_INSN (next_address, + &deprecated_tm_print_insn_info); printf_filtered ("\n"); gdb_flush (gdb_stdout); } @@ -1481,7 +1427,7 @@ saved_regs_unwinder (struct frame_info *next_frame, { if (this_saved_regs[regnum] != 0) { - if (regnum == SP_REGNUM) + if (regnum == D10V_SP_REGNUM) { /* SP register treated specially. */ *optimizedp = 0; @@ -1489,8 +1435,9 @@ saved_regs_unwinder (struct frame_info *next_frame, *addrp = 0; *realnump = -1; if (bufferp != NULL) - store_address (bufferp, register_size (current_gdbarch, regnum), - this_saved_regs[regnum]); + store_unsigned_integer (bufferp, + register_size (current_gdbarch, regnum), + this_saved_regs[regnum]); } else { @@ -1579,7 +1526,7 @@ static struct frame_id d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) { ULONGEST base; - frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base); + frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &base); return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame)); } @@ -1629,17 +1576,14 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, d10v_read_pc); set_gdbarch_write_pc (gdbarch, d10v_write_pc); - set_gdbarch_read_fp (gdbarch, d10v_read_fp); set_gdbarch_read_sp (gdbarch, d10v_read_sp); set_gdbarch_num_regs (gdbarch, d10v_num_regs); - set_gdbarch_sp_regnum (gdbarch, 15); + set_gdbarch_sp_regnum (gdbarch, D10V_SP_REGNUM); set_gdbarch_pc_regnum (gdbarch, 18); set_gdbarch_register_name (gdbarch, d10v_register_name); set_gdbarch_register_size (gdbarch, 2); set_gdbarch_register_bytes (gdbarch, (d10v_num_regs - 2) * 2 + 16); - set_gdbarch_register_byte (gdbarch, d10v_register_byte); - set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, generic_register_size); set_gdbarch_register_type (gdbarch, d10v_register_type); @@ -1708,6 +1652,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Return the unwound PC value. */ set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc); + set_gdbarch_print_insn (gdbarch, print_insn_d10v); + return gdbarch; } @@ -1716,8 +1662,6 @@ _initialize_d10v_tdep (void) { register_gdbarch_init (bfd_arch_d10v, d10v_gdbarch_init); - tm_print_insn = print_insn_d10v; - target_resume_hook = d10v_eva_prepare_to_trace; target_wait_loop_hook = d10v_eva_get_trace_data; @@ -1738,13 +1682,13 @@ as reported by info trace (NOT addresses!)."); add_info ("itrace", trace_info, "Display info about the trace data buffer."); - add_show_from_set (add_set_cmd ("itracedisplay", no_class, - var_integer, (char *) &trace_display, - "Set automatic display of trace.\n", &setlist), - &showlist); - add_show_from_set (add_set_cmd ("itracesource", no_class, - var_integer, (char *) &default_trace_show_source, - "Set display of source code with trace.\n", &setlist), - &showlist); - + add_setshow_boolean_cmd ("itracedisplay", no_class, &trace_display, + "Set automatic display of trace.\n", + "Show automatic display of trace.\n", + NULL, NULL, &setlist, &showlist); + add_setshow_boolean_cmd ("itracesource", no_class, + &default_trace_show_source, + "Set display of source code with trace.\n", + "Show display of source code with trace.\n", + NULL, NULL, &setlist, &showlist); } diff --git a/gdb/disasm.c b/gdb/disasm.c index 511855b..e460255 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -24,8 +24,8 @@ #include "value.h" #include "ui-out.h" #include "gdb_string.h" - #include "disasm.h" +#include "gdbcore.h" /* Disassemble functions. FIXME: We should get rid of all the duplicate code in gdb that does @@ -43,6 +43,28 @@ struct dis_line_entry CORE_ADDR end_pc; }; +/* Like target_read_memory, but slightly different parameters. */ +static int +dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len, + disassemble_info *info) +{ + return target_read_memory (memaddr, (char *) myaddr, len); +} + +/* Like memory_error with slightly different parameters. */ +static void +dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info) +{ + memory_error (status, memaddr); +} + +/* Like print_address with slightly different parameters. */ +static void +dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) +{ + print_address (addr, info->stream); +} + /* This variable determines where memory used for disassembly is read from. */ int gdb_disassemble_from_exec = -1; @@ -391,3 +413,21 @@ gdb_disassembly (struct ui_out *uiout, gdb_flush (gdb_stdout); } + + +/* FIXME: cagney/2003-04-28: This global deprecated_tm_print_insn_info + is going away. */ +disassemble_info deprecated_tm_print_insn_info; + +extern void _initialize_disasm (void); + +void +_initialize_disasm (void) +{ + INIT_DISASSEMBLE_INFO_NO_ARCH (deprecated_tm_print_insn_info, gdb_stdout, + (fprintf_ftype)fprintf_filtered); + deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour; + deprecated_tm_print_insn_info.read_memory_func = dis_asm_read_memory; + deprecated_tm_print_insn_info.memory_error_func = dis_asm_memory_error; + deprecated_tm_print_insn_info.print_address_func = dis_asm_print_address; +} diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 473eb15..7433c58 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,14 @@ +2003-04-28 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Replace + read_fp, TARGET_READ_FP and FP_REGNUM, with deprecated_read_fp, + DEPRECATED_TARGET_READ_FP and DEPRECATED_REGNUM. + +2003-04-28 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Rename + "tm_print_insn" to "deprecated_tm_print_insn". + 2003-04-09 Jim Blandy <jimb@redhat.com> * gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 4ca81f6..c99d789 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -241,16 +241,17 @@ machine-independent part of @value{GDBN}, except that it is used when setting up a new frame from scratch, as follows: @smallexample -create_new_frame (read_register (FP_REGNUM), read_pc ())); +create_new_frame (read_register (DEPRECATED_FP_REGNUM), read_pc ())); @end smallexample @cindex frame pointer register -Other than that, all the meaning imparted to @code{FP_REGNUM} is -imparted by the machine-dependent code. So, @code{FP_REGNUM} can have -any value that is convenient for the code that creates new frames. -(@code{create_new_frame} calls @code{DEPRECATED_INIT_EXTRA_FRAME_INFO} -if it is defined; that is where you should use the @code{FP_REGNUM} -value, if your frames are nonstandard.) +Other than that, all the meaning imparted to @code{DEPRECATED_FP_REGNUM} +is imparted by the machine-dependent code. So, +@code{DEPRECATED_FP_REGNUM} can have any value that is convenient for +the code that creates new frames. (@code{create_new_frame} calls +@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} if it is defined; that is where +you should use the @code{DEPRECATED_FP_REGNUM} value, if your frames are +nonstandard.) @cindex frame chain Given a @value{GDBN} frame, define @code{DEPRECATED_FRAME_CHAIN} to @@ -3217,13 +3218,13 @@ If not defined, @code{EXTRACT_RETURN_VALUE} is used. @findex EXTRACT_STRUCT_VALUE_ADDRESS_P Predicate for @code{EXTRACT_STRUCT_VALUE_ADDRESS}. -@item FP_REGNUM -@findex FP_REGNUM +@item DEPRECATED_FP_REGNUM +@findex DEPRECATED_FP_REGNUM If the virtual frame 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_READ_FP} is not -defined. +This should only need to be defined if @code{DEPRECATED_TARGET_READ_FP} +is not defined. @item FRAMELESS_FUNCTION_INVOCATION(@var{fi}) @findex FRAMELESS_FUNCTION_INVOCATION @@ -3882,9 +3883,9 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}. @findex read_sp @findex read_fp These change the behavior of @code{read_pc}, @code{write_pc}, -@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. +@code{read_sp} and @code{deprecated_read_fp}. For most targets, these +may be left undefined. @value{GDBN} will call the read and write +register functions with the relevant @code{_REGNUM} argument. These macros are useful when a target keeps one of these registers in a hard to get at place; for example, part in a segment register and part @@ -3892,10 +3893,10 @@ in an ordinary register. @item TARGET_VIRTUAL_FRAME_POINTER(@var{pc}, @var{regp}, @var{offsetp}) @findex TARGET_VIRTUAL_FRAME_POINTER -Returns a @code{(register, offset)} pair representing the virtual -frame pointer in use at the code address @var{pc}. If virtual -frame pointers are not used, a default definition simply returns -@code{FP_REGNUM}, with an offset of zero. +Returns a @code{(register, offset)} pair representing the virtual frame +pointer in use at the code address @var{pc}. If virtual frame pointers +are not used, a default definition simply returns +@code{DEPRECATED_FP_REGNUM}, with an offset of zero. @item TARGET_HAS_HARDWARE_WATCHPOINTS If non-zero, the target has support for hardware-assisted @@ -3908,11 +3909,12 @@ This is the function used by @value{GDBN} to print an assembly instruction. It prints the instruction at address @var{addr} in debugged memory and returns the length of the instruction, in bytes. If a target doesn't define its own printing routine, it defaults to an -accessor function for the global pointer @code{tm_print_insn}. This -usually points to a function in the @code{opcodes} library (@pxref{Support -Libraries, ,Opcodes}). @var{info} is a structure (of type -@code{disassemble_info}) defined in @file{include/dis-asm.h} used to -pass information to the instruction decoding routine. +accessor function for the global pointer +@code{deprecated_tm_print_insn}. This usually points to a function in +the @code{opcodes} library (@pxref{Support Libraries, ,Opcodes}). +@var{info} is a structure (of type @code{disassemble_info}) defined in +@file{include/dis-asm.h} used to pass information to the instruction +decoding routine. @item struct frame_id unwind_dummy_id (struct frame_info *@var{frame}) @findex unwind_dummy_id diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index a320b7d..7f3b2a2 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -374,7 +374,7 @@ dummy_frame_this_id (struct frame_info *next_frame, same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - (*this_id) = frame_id_build (read_fp (), read_pc ()); + (*this_id) = frame_id_build (deprecated_read_fp (), read_pc ()); } else if (legacy_frame_p (current_gdbarch) && get_prev_frame (next_frame)) diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 8927e87..c236c11 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -223,7 +223,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, result = dwarf_expr_fetch (ctx, 0); if (ctx->in_reg) - retval = value_from_register (SYMBOL_TYPE (var), result, frame); + { + int regnum = DWARF2_REG_TO_REGNUM (result); + retval = value_from_register (SYMBOL_TYPE (var), regnum, frame); + } else { retval = allocate_value (SYMBOL_TYPE (var)); @@ -32,6 +32,9 @@ #include "language.h" /* For CAST_IS_CONVERSION */ #include "f-lang.h" /* for array bound stuff */ #include "cp-abi.h" +#include "infcall.h" +#include "objc-lang.h" +#include "block.h" /* Defined in symtab.c */ extern int hp_som_som_object_present; @@ -471,6 +474,15 @@ evaluate_subexp_standard (struct type *expect_type, goto nosideret; return value_string (&exp->elts[pc + 2].string, tem); + case OP_OBJC_NSSTRING: /* Objective C Foundation Class NSString constant. */ + tem = longest_to_int (exp->elts[pc + 1].longconst); + (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1); + if (noside == EVAL_SKIP) + { + goto nosideret; + } + return (struct value *) value_nsstring (&exp->elts[pc + 2].string, tem + 1); + case OP_BITSTRING: tem = longest_to_int (exp->elts[pc + 1].longconst); (*pos) @@ -667,6 +679,275 @@ evaluate_subexp_standard (struct type *expect_type, return arg2; } + case OP_OBJC_SELECTOR: + { /* Objective C @selector operator. */ + char *sel = &exp->elts[pc + 2].string; + int len = longest_to_int (exp->elts[pc + 1].longconst); + + (*pos) += 3 + BYTES_TO_EXP_ELEM (len + 1); + if (noside == EVAL_SKIP) + goto nosideret; + + if (sel[len] != 0) + sel[len] = 0; /* Make sure it's terminated. */ + return value_from_longest (lookup_pointer_type (builtin_type_void), + lookup_child_selector (sel)); + } + + case OP_OBJC_MSGCALL: + { /* Objective C message (method) call. */ + + static unsigned long responds_selector = 0; + static unsigned long method_selector = 0; + + unsigned long selector = 0; + + int using_gcc = 0; + int struct_return = 0; + int sub_no_side = 0; + + static struct value *msg_send = NULL; + static struct value *msg_send_stret = NULL; + static int gnu_runtime = 0; + + struct value *target = NULL; + struct value *method = NULL; + struct value *called_method = NULL; + + struct type *selector_type = NULL; + + struct value *ret = NULL; + CORE_ADDR addr = 0; + + selector = exp->elts[pc + 1].longconst; + nargs = exp->elts[pc + 2].longconst; + argvec = (struct value **) alloca (sizeof (struct value *) + * (nargs + 5)); + + (*pos) += 3; + + selector_type = lookup_pointer_type (builtin_type_void); + if (noside == EVAL_AVOID_SIDE_EFFECTS) + sub_no_side = EVAL_NORMAL; + else + sub_no_side = noside; + + target = evaluate_subexp (selector_type, exp, pos, sub_no_side); + + if (value_as_long (target) == 0) + return value_from_longest (builtin_type_long, 0); + + if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0)) + gnu_runtime = 1; + + /* Find the method dispatch (Apple runtime) or method lookup + (GNU runtime) function for Objective-C. These will be used + to lookup the symbol information for the method. If we + can't find any symbol information, then we'll use these to + call the method, otherwise we can call the method + directly. The msg_send_stret function is used in the special + case of a method that returns a structure (Apple runtime + only). */ + if (gnu_runtime) + { + msg_send = find_function_in_inferior ("objc_msg_lookup"); + msg_send_stret = find_function_in_inferior ("objc_msg_lookup"); + } + else + { + msg_send = find_function_in_inferior ("objc_msgSend"); + /* Special dispatcher for methods returning structs */ + msg_send_stret = find_function_in_inferior ("objc_msgSend_stret"); + } + + /* Verify the target object responds to this method. The + standard top-level 'Object' class uses a different name for + the verification method than the non-standard, but more + often used, 'NSObject' class. Make sure we check for both. */ + + responds_selector = lookup_child_selector ("respondsToSelector:"); + if (responds_selector == 0) + responds_selector = lookup_child_selector ("respondsTo:"); + + if (responds_selector == 0) + error ("no 'respondsTo:' or 'respondsToSelector:' method"); + + method_selector = lookup_child_selector ("methodForSelector:"); + if (method_selector == 0) + method_selector = lookup_child_selector ("methodFor:"); + + if (method_selector == 0) + error ("no 'methodFor:' or 'methodForSelector:' method"); + + /* Call the verification method, to make sure that the target + class implements the desired method. */ + + argvec[0] = msg_send; + argvec[1] = target; + argvec[2] = value_from_longest (builtin_type_long, responds_selector); + argvec[3] = value_from_longest (builtin_type_long, selector); + argvec[4] = 0; + + ret = call_function_by_hand (argvec[0], 3, argvec + 1); + if (gnu_runtime) + { + /* Function objc_msg_lookup returns a pointer. */ + argvec[0] = ret; + ret = call_function_by_hand (argvec[0], 3, argvec + 1); + } + if (value_as_long (ret) == 0) + error ("Target does not respond to this message selector."); + + /* Call "methodForSelector:" method, to get the address of a + function method that implements this selector for this + class. If we can find a symbol at that address, then we + know the return type, parameter types etc. (that's a good + thing). */ + + argvec[0] = msg_send; + argvec[1] = target; + argvec[2] = value_from_longest (builtin_type_long, method_selector); + argvec[3] = value_from_longest (builtin_type_long, selector); + argvec[4] = 0; + + ret = call_function_by_hand (argvec[0], 3, argvec + 1); + if (gnu_runtime) + { + argvec[0] = ret; + ret = call_function_by_hand (argvec[0], 3, argvec + 1); + } + + /* ret should now be the selector. */ + + addr = value_as_long (ret); + if (addr) + { + struct symbol *sym = NULL; + /* Is it a high_level symbol? */ + + sym = find_pc_function (addr); + if (sym != NULL) + method = value_of_variable (sym, 0); + } + + /* If we found a method with symbol information, check to see + if it returns a struct. Otherwise assume it doesn't. */ + + if (method) + { + struct block *b; + CORE_ADDR funaddr; + struct type *value_type; + + funaddr = find_function_addr (method, &value_type); + + b = block_for_pc (funaddr); + + /* If compiled without -g, assume GCC 2. */ + using_gcc = (b == NULL ? 2 : BLOCK_GCC_COMPILED (b)); + + CHECK_TYPEDEF (value_type); + + if ((value_type == NULL) + || (TYPE_CODE(value_type) == TYPE_CODE_ERROR)) + { + if (expect_type != NULL) + value_type = expect_type; + } + + struct_return = using_struct_return (method, funaddr, value_type, using_gcc); + } + else if (expect_type != NULL) + { + struct_return = using_struct_return (NULL, addr, check_typedef (expect_type), using_gcc); + } + + /* Found a function symbol. Now we will substitute its + value in place of the message dispatcher (obj_msgSend), + so that we call the method directly instead of thru + the dispatcher. The main reason for doing this is that + we can now evaluate the return value and parameter values + according to their known data types, in case we need to + do things like promotion, dereferencing, special handling + of structs and doubles, etc. + + We want to use the type signature of 'method', but still + jump to objc_msgSend() or objc_msgSend_stret() to better + mimic the behavior of the runtime. */ + + if (method) + { + if (TYPE_CODE (VALUE_TYPE (method)) != TYPE_CODE_FUNC) + error ("method address has symbol information with non-function type; skipping"); + if (struct_return) + VALUE_ADDRESS (method) = value_as_address (msg_send_stret); + else + VALUE_ADDRESS (method) = value_as_address (msg_send); + called_method = method; + } + else + { + if (struct_return) + called_method = msg_send_stret; + else + called_method = msg_send; + } + + if (noside == EVAL_SKIP) + goto nosideret; + + if (noside == EVAL_AVOID_SIDE_EFFECTS) + { + /* If the return type doesn't look like a function type, + call an error. This can happen if somebody tries to + turn a variable into a function call. This is here + because people often want to call, eg, strcmp, which + gdb doesn't know is a function. If gdb isn't asked for + it's opinion (ie. through "whatis"), it won't offer + it. */ + + struct type *type = VALUE_TYPE (called_method); + if (type && TYPE_CODE (type) == TYPE_CODE_PTR) + type = TYPE_TARGET_TYPE (type); + type = TYPE_TARGET_TYPE (type); + + if (type) + { + if ((TYPE_CODE (type) == TYPE_CODE_ERROR) && expect_type) + return allocate_value (expect_type); + else + return allocate_value (type); + } + else + error ("Expression of type other than \"method returning ...\" used as a method"); + } + + /* Now depending on whether we found a symbol for the method, + we will either call the runtime dispatcher or the method + directly. */ + + argvec[0] = called_method; + argvec[1] = target; + argvec[2] = value_from_longest (builtin_type_long, selector); + /* User-supplied arguments. */ + for (tem = 0; tem < nargs; tem++) + argvec[tem + 3] = evaluate_subexp_with_coercion (exp, pos, noside); + argvec[tem + 3] = 0; + + if (gnu_runtime && (method != NULL)) + { + ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1); + /* Function objc_msg_lookup returns a pointer. */ + argvec[0] = ret; + ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1); + } + else + ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1); + + return ret; + } + break; + case OP_FUNCALL: (*pos) += 2; op = exp->elts[*pos].opcode; @@ -1749,6 +2030,10 @@ evaluate_subexp_standard (struct type *expect_type, (*pos) += 1; return value_of_this (1); + case OP_OBJC_SELF: + (*pos) += 1; + return value_of_local ("self", 1); + case OP_TYPE: error ("Attempt to use a type name as an expression"); diff --git a/gdb/frame.c b/gdb/frame.c index 3871aa1..4af3d6c 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -295,10 +295,8 @@ frame_id_eq (struct frame_id l, struct frame_id r) /* The .stack and .code are identical, the ID's are identical. */ eq = 1; else - /* FIXME: cagney/2003-04-06: This should be zero. Can't yet do - this because most frame ID's are not being initialized - correctly. */ - eq = 1; + /* No luck. */ + eq = 0; if (frame_debug) { fprintf_unfiltered (gdb_stdlog, "{ frame_id_eq (l="); @@ -1388,7 +1386,8 @@ legacy_get_prev_frame (struct frame_info *this_frame) using the same sequence as is found a traditional unwinder. Once all architectures supply the unwind_dummy_id method, this code can go away. */ - prev->this_id.value = frame_id_build (read_fp (), read_pc ()); + prev->this_id.value = frame_id_build (deprecated_read_fp (), + read_pc ()); } /* Check that the unwound ID is valid. */ @@ -1543,8 +1542,9 @@ legacy_get_prev_frame (struct frame_info *this_frame) DEPRECATED_INIT_EXTRA_FRAME_INFO, one possible scheme: SETUP_INNERMOST_FRAME(): Default version is just create_new_frame - (read_fp ()), read_pc ()). Machines with extra frame info would - do that (or the local equivalent) and then set the extra fields. + (deprecated_read_fp ()), read_pc ()). Machines with extra frame + info would do that (or the local equivalent) and then set the + extra fields. SETUP_ARBITRARY_FRAME(argc, argv): Only change here is that create_new_frame would no longer init extra frame info; diff --git a/gdb/frame.h b/gdb/frame.h index f33755a..cb629d9 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -369,6 +369,7 @@ enum print_what extern void *frame_obstack_zalloc (unsigned long size); #define FRAME_OBSTACK_ZALLOC(TYPE) ((TYPE *) frame_obstack_zalloc (sizeof (TYPE))) +#define FRAME_OBSTACK_CALLOC(NUMBER,TYPE) ((TYPE *) frame_obstack_zalloc ((NUMBER) * sizeof (TYPE))) /* If legacy_frame_chain_valid() returns zero it means that the given frame is the outermost one and has no caller. @@ -556,9 +557,9 @@ extern void deprecated_update_frame_pc_hack (struct frame_info *frame, /* FIXME: cagney/2002-12-18: Has the frame's base changed? Or to be more exact, whas that initial guess at the frame's base as returned - by read_fp() wrong. If it was, fix it. This shouldn't be - necessary since the code should be getting the frame's base correct - from the outset. + by deprecated_read_fp() wrong. If it was, fix it. This shouldn't + be necessary since the code should be getting the frame's base + correct from the outset. This replaced: frame->frame = ....; */ extern void deprecated_update_frame_base_hack (struct frame_info *frame, diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index bab3776..d45a76d 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1053,7 +1053,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, frv_num_regs); set_gdbarch_sp_regnum (gdbarch, sp_regnum); - set_gdbarch_fp_regnum (gdbarch, fp_regnum); + set_gdbarch_deprecated_fp_regnum (gdbarch, fp_regnum); set_gdbarch_pc_regnum (gdbarch, pc_regnum); set_gdbarch_register_name (gdbarch, frv_register_name); @@ -1101,7 +1101,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, generic_target_read_pc); 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_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); @@ -1147,7 +1146,7 @@ _initialize_frv_tdep (void) { register_gdbarch_init (bfd_arch_frv, frv_gdbarch_init); - tm_print_insn = print_insn_frv; + deprecated_tm_print_insn = print_insn_frv; } diff --git a/gdb/gcore.c b/gdb/gcore.c index 5ad17e8..6a0edbf 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -26,6 +26,7 @@ #include "elf-bfd.h" #include "symfile.h" #include "objfiles.h" +#include "infcall.h" static char *default_gcore_target (void); static enum bfd_architecture default_gcore_arch (void); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 3b5a807..bda28c7 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -147,7 +147,7 @@ struct gdbarch int char_signed; gdbarch_read_pc_ftype *read_pc; gdbarch_write_pc_ftype *write_pc; - gdbarch_read_fp_ftype *read_fp; + gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp; gdbarch_read_sp_ftype *read_sp; gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp; gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer; @@ -156,7 +156,7 @@ struct gdbarch int num_regs; int num_pseudo_regs; int sp_regnum; - int fp_regnum; + int deprecated_fp_regnum; int pc_regnum; int ps_regnum; int fp0_regnum; @@ -499,12 +499,11 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->char_signed = -1; current_gdbarch->read_pc = generic_target_read_pc; 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->virtual_frame_pointer = legacy_virtual_frame_pointer; current_gdbarch->num_regs = -1; current_gdbarch->sp_regnum = -1; - current_gdbarch->fp_regnum = -1; + current_gdbarch->deprecated_fp_regnum = -1; current_gdbarch->pc_regnum = -1; current_gdbarch->ps_regnum = -1; current_gdbarch->fp0_regnum = -1; @@ -622,7 +621,7 @@ verify_gdbarch (struct gdbarch *gdbarch) gdbarch->char_signed = 1; /* Skip verify of read_pc, invalid_p == 0 */ /* Skip verify of write_pc, invalid_p == 0 */ - /* Skip verify of read_fp, invalid_p == 0 */ + /* Skip verify of deprecated_target_read_fp, has predicate */ /* Skip verify of read_sp, invalid_p == 0 */ /* Skip verify of deprecated_dummy_write_sp, has predicate */ /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ @@ -633,7 +632,7 @@ verify_gdbarch (struct gdbarch *gdbarch) fprintf_unfiltered (log, "\n\tnum_regs"); /* Skip verify of num_pseudo_regs, invalid_p == 0 */ /* Skip verify of sp_regnum, invalid_p == 0 */ - /* Skip verify of fp_regnum, invalid_p == 0 */ + /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */ /* Skip verify of pc_regnum, invalid_p == 0 */ /* Skip verify of ps_regnum, invalid_p == 0 */ /* Skip verify of fp0_regnum, invalid_p == 0 */ @@ -1145,6 +1144,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED); #endif +#ifdef DEPRECATED_FP_REGNUM + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FP_REGNUM # %s\n", + XSTRING (DEPRECATED_FP_REGNUM)); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FP_REGNUM = %d\n", + DEPRECATED_FP_REGNUM); +#endif #ifdef DEPRECATED_FRAME_CHAIN_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1511,6 +1518,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_store_struct_return /*DEPRECATED_STORE_STRUCT_RETURN ()*/); #endif +#ifdef DEPRECATED_TARGET_READ_FP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_TARGET_READ_FP_P()", + XSTRING (DEPRECATED_TARGET_READ_FP_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_TARGET_READ_FP_P() = %d\n", + DEPRECATED_TARGET_READ_FP_P ()); +#endif +#ifdef DEPRECATED_TARGET_READ_FP + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_TARGET_READ_FP()", + XSTRING (DEPRECATED_TARGET_READ_FP ())); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_TARGET_READ_FP = <0x%08lx>\n", + (long) current_gdbarch->deprecated_target_read_fp + /*DEPRECATED_TARGET_READ_FP ()*/); +#endif #ifdef DEPRECATED_USE_GENERIC_DUMMY_FRAMES fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_USE_GENERIC_DUMMY_FRAMES # %s\n", @@ -1654,14 +1681,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: FP0_REGNUM = %d\n", FP0_REGNUM); #endif -#ifdef FP_REGNUM - fprintf_unfiltered (file, - "gdbarch_dump: FP_REGNUM # %s\n", - XSTRING (FP_REGNUM)); - fprintf_unfiltered (file, - "gdbarch_dump: FP_REGNUM = %d\n", - FP_REGNUM); -#endif #ifdef FRAMELESS_FUNCTION_INVOCATION fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2501,17 +2520,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_PTR_BIT = %d\n", TARGET_PTR_BIT); #endif -#ifdef TARGET_READ_FP - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "TARGET_READ_FP()", - XSTRING (TARGET_READ_FP ())); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_READ_FP = <0x%08lx>\n", - (long) current_gdbarch->read_fp - /*TARGET_READ_FP ()*/); -#endif #ifdef TARGET_READ_PC fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2880,23 +2888,30 @@ set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch->write_pc = write_pc; } +int +gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_target_read_fp != 0; +} + CORE_ADDR -gdbarch_read_fp (struct gdbarch *gdbarch) +gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->read_fp == 0) + if (gdbarch->deprecated_target_read_fp == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_read_fp invalid"); + "gdbarch: gdbarch_deprecated_target_read_fp invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_read_fp called\n"); - return gdbarch->read_fp (); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_target_read_fp called\n"); + return gdbarch->deprecated_target_read_fp (); } void -set_gdbarch_read_fp (struct gdbarch *gdbarch, - gdbarch_read_fp_ftype read_fp) +set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, + gdbarch_deprecated_target_read_fp_ftype deprecated_target_read_fp) { - gdbarch->read_fp = read_fp; + gdbarch->deprecated_target_read_fp = deprecated_target_read_fp; } CORE_ADDR @@ -3069,20 +3084,20 @@ set_gdbarch_sp_regnum (struct gdbarch *gdbarch, } int -gdbarch_fp_regnum (struct gdbarch *gdbarch) +gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - /* Skip verify of fp_regnum, invalid_p == 0 */ + /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */ if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_fp_regnum called\n"); - return gdbarch->fp_regnum; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_fp_regnum called\n"); + return gdbarch->deprecated_fp_regnum; } void -set_gdbarch_fp_regnum (struct gdbarch *gdbarch, - int fp_regnum) +set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, + int deprecated_fp_regnum) { - gdbarch->fp_regnum = fp_regnum; + gdbarch->deprecated_fp_regnum = deprecated_fp_regnum; } int @@ -6203,9 +6218,7 @@ gdbarch_update_p (struct gdbarch_info info) /* Disassembler */ /* Pointer to the target-dependent disassembly function. */ -int (*tm_print_insn) (bfd_vma, disassemble_info *); -disassemble_info tm_print_insn_info; - +int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *); extern void _initialize_gdbarch (void); @@ -6214,12 +6227,6 @@ _initialize_gdbarch (void) { struct cmd_list_element *c; - INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered); - tm_print_insn_info.flavour = bfd_target_unknown_flavour; - tm_print_insn_info.read_memory_func = dis_asm_read_memory; - tm_print_insn_info.memory_error_func = dis_asm_memory_error; - tm_print_insn_info.print_address_func = dis_asm_print_address; - add_show_from_set (add_set_cmd ("arch", class_maintenance, var_zinteger, diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 7b2641b..f95e709 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -345,20 +345,43 @@ extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftyp #endif #endif +/* This is simply not needed. See value_of_builtin_frame_fp_reg and + call_function_by_hand. */ + +#if defined (DEPRECATED_TARGET_READ_FP) +/* Legacy for systems yet to multi-arch DEPRECATED_TARGET_READ_FP */ +#if !defined (DEPRECATED_TARGET_READ_FP_P) +#define DEPRECATED_TARGET_READ_FP_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP_P) +#define DEPRECATED_TARGET_READ_FP_P() (0) +#endif + +extern int gdbarch_deprecated_target_read_fp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP_P) +#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_TARGET_READ_FP_P) +#define DEPRECATED_TARGET_READ_FP_P() (gdbarch_deprecated_target_read_fp_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_FP) -#define TARGET_READ_FP() (generic_target_read_fp ()) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_TARGET_READ_FP) +#define DEPRECATED_TARGET_READ_FP() (internal_error (__FILE__, __LINE__, "DEPRECATED_TARGET_READ_FP"), 0) #endif -typedef CORE_ADDR (gdbarch_read_fp_ftype) (void); -extern CORE_ADDR gdbarch_read_fp (struct gdbarch *gdbarch); -extern void set_gdbarch_read_fp (struct gdbarch *gdbarch, gdbarch_read_fp_ftype *read_fp); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_FP) -#error "Non multi-arch definition of TARGET_READ_FP" +typedef CORE_ADDR (gdbarch_deprecated_target_read_fp_ftype) (void); +extern CORE_ADDR gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch_deprecated_target_read_fp_ftype *deprecated_target_read_fp); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_TARGET_READ_FP) +#error "Non multi-arch definition of DEPRECATED_TARGET_READ_FP" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_FP) -#define TARGET_READ_FP() (gdbarch_read_fp (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_TARGET_READ_FP) +#define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch)) #endif #endif @@ -503,19 +526,22 @@ extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum); #endif #endif +/* This is simply not needed. See value_of_builtin_frame_fp_reg and + call_function_by_hand. */ + /* Default (value) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FP_REGNUM) -#define FP_REGNUM (-1) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FP_REGNUM) +#define DEPRECATED_FP_REGNUM (-1) #endif -extern int gdbarch_fp_regnum (struct gdbarch *gdbarch); -extern void set_gdbarch_fp_regnum (struct gdbarch *gdbarch, int fp_regnum); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FP_REGNUM) -#error "Non multi-arch definition of FP_REGNUM" +extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FP_REGNUM) +#error "Non multi-arch definition of DEPRECATED_FP_REGNUM" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FP_REGNUM) -#define FP_REGNUM (gdbarch_fp_regnum (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FP_REGNUM) +#define DEPRECATED_FP_REGNUM (gdbarch_deprecated_fp_regnum (current_gdbarch)) #endif #endif @@ -3355,22 +3381,11 @@ extern const struct bfd_arch_info *target_architecture; /* The target-system-dependent disassembler is semi-dynamic */ -extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, - unsigned int len, disassemble_info *info); - -extern void dis_asm_memory_error (int status, bfd_vma memaddr, - disassemble_info *info); - -extern void dis_asm_print_address (bfd_vma addr, - disassemble_info *info); - -extern int (*tm_print_insn) (bfd_vma, disassemble_info*); -extern disassemble_info tm_print_insn_info; -#ifndef TARGET_PRINT_INSN_INFO -#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info) -#endif - +/* Use gdb_disassemble, and gdbarch_print_insn instead. */ +extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*); +/* Use set_gdbarch_print_insn instead. */ +extern disassemble_info deprecated_tm_print_insn_info; /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 7a17b63..9b059d2 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -428,7 +428,9 @@ v:2:TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1:::: # f:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0 f:2:TARGET_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 +# This is simply not needed. See value_of_builtin_frame_fp_reg and +# call_function_by_hand. +F::DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0 # 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 @@ -451,7 +453,9 @@ v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0::: # a real register or a pseudo (computed) register or not be defined at # all (-1). v:2:SP_REGNUM:int:sp_regnum::::-1:-1::0 -v:2:FP_REGNUM:int:fp_regnum::::-1:-1::0 +# This is simply not needed. See value_of_builtin_frame_fp_reg and +# call_function_by_hand. +v:2:DEPRECATED_FP_REGNUM:int:deprecated_fp_regnum::::-1:-1::0 v:2:PC_REGNUM:int:pc_regnum::::-1:-1::0 v:2:PS_REGNUM:int:ps_regnum::::-1:-1::0 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0 @@ -1209,22 +1213,11 @@ extern const struct bfd_arch_info *target_architecture; /* The target-system-dependent disassembler is semi-dynamic */ -extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, - unsigned int len, disassemble_info *info); - -extern void dis_asm_memory_error (int status, bfd_vma memaddr, - disassemble_info *info); - -extern void dis_asm_print_address (bfd_vma addr, - disassemble_info *info); - -extern int (*tm_print_insn) (bfd_vma, disassemble_info*); -extern disassemble_info tm_print_insn_info; -#ifndef TARGET_PRINT_INSN_INFO -#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info) -#endif - +/* Use gdb_disassemble, and gdbarch_print_insn instead. */ +extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*); +/* Use set_gdbarch_print_insn instead. */ +extern disassemble_info deprecated_tm_print_insn_info; /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ @@ -2377,9 +2370,7 @@ gdbarch_update_p (struct gdbarch_info info) /* Disassembler */ /* Pointer to the target-dependent disassembly function. */ -int (*tm_print_insn) (bfd_vma, disassemble_info *); -disassemble_info tm_print_insn_info; - +int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *); extern void _initialize_gdbarch (void); @@ -2388,12 +2379,6 @@ _initialize_gdbarch (void) { struct cmd_list_element *c; - INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered); - tm_print_insn_info.flavour = bfd_target_unknown_flavour; - tm_print_insn_info.read_memory_func = dis_asm_read_memory; - tm_print_insn_info.memory_error_func = dis_asm_memory_error; - tm_print_insn_info.print_address_func = dis_asm_print_address; - add_show_from_set (add_set_cmd ("arch", class_maintenance, var_zinteger, diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 63ec899..9df8a2a 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2003-04-24 Andrew Cagney <cagney@redhat.com> + + * low-nbsd.c (fetch_inferior_registers): + (store_inferior_registers): + 2003-03-26 Daniel Jacobowitz <drow@mvista.com> * linux-low.c (linux_create_inferior): Use __SIGRTMIN. diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c index 9046d63..8bec0d9 100644 --- a/gdb/gdbserver/low-nbsd.c +++ b/gdb/gdbserver/low-nbsd.c @@ -394,7 +394,7 @@ fetch_inferior_registers (int regno) RF (R0_REGNUM + 7, inferior_registers.r_r7); RF (SP_REGNUM, inferior_registers.r_sp); - RF (FP_REGNUM, inferior_registers.r_fp); + RF (DEPRECATED_FP_REGNUM, inferior_registers.r_fp); RF (PC_REGNUM, inferior_registers.r_pc); RF (PS_REGNUM, inferior_registers.r_psr); @@ -429,7 +429,7 @@ store_inferior_registers (int regno) RS (R0_REGNUM + 7, inferior_registers.r_r7); RS (SP_REGNUM, inferior_registers.r_sp); - RS (FP_REGNUM, inferior_registers.r_fp); + RS (DEPRECATED_FP_REGNUM, inferior_registers.r_fp); RS (PC_REGNUM, inferior_registers.r_pc); RS (PS_REGNUM, inferior_registers.r_psr); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 2423a9a..614bc81 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1101,7 +1101,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, E_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_register_name (gdbarch, h8300_register_name); set_gdbarch_register_size (gdbarch, BINWORD); @@ -1177,6 +1177,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) void _initialize_h8300_tdep (void) { - tm_print_insn = gdb_print_insn_h8300; + deprecated_tm_print_insn = gdb_print_insn_h8300; register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init); } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 27cfedf..db761ac 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -36,6 +36,7 @@ #include "infttrace.h" /* For argument passing to the inferior */ #include "symtab.h" +#include "infcall.h" #ifdef USG #include <sys/types.h> @@ -1084,7 +1085,7 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame) frame. (we always want frame->frame to point at the lowest address in the frame). */ if (framesize == -1) - deprecated_update_frame_base_hack (frame, TARGET_READ_FP ()); + deprecated_update_frame_base_hack (frame, deprecated_read_fp ()); else deprecated_update_frame_base_hack (frame, get_frame_base (frame) - framesize); return; @@ -1105,7 +1106,7 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame) sorts, and its base is the high address in its parent's frame. */ framesize = find_proc_framesize (get_frame_pc (frame)); if (framesize == -1) - deprecated_update_frame_base_hack (frame, TARGET_READ_FP ()); + deprecated_update_frame_base_hack (frame, deprecated_read_fp ()); else deprecated_update_frame_base_hack (frame, read_register (SP_REGNUM) - framesize); } @@ -1263,7 +1264,7 @@ hppa_frame_chain (struct frame_info *frame) saved_regs_frame = tmp_frame; /* If we have an address for r3, that's good. */ - if (saved_regs[FP_REGNUM]) + if (saved_regs[DEPRECATED_FP_REGNUM]) break; } } @@ -1325,7 +1326,7 @@ hppa_frame_chain (struct frame_info *frame) u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs[FP_REGNUM], + return read_memory_integer (saved_regs[DEPRECATED_FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1334,7 +1335,7 @@ hppa_frame_chain (struct frame_info *frame) } } - return read_memory_integer (saved_regs[FP_REGNUM], + return read_memory_integer (saved_regs[DEPRECATED_FP_REGNUM], TARGET_PTR_BIT / 8); } } @@ -1363,7 +1364,7 @@ hppa_frame_chain (struct frame_info *frame) u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs[FP_REGNUM], + return read_memory_integer (saved_regs[DEPRECATED_FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1374,7 +1375,7 @@ hppa_frame_chain (struct frame_info *frame) /* The value in %r3 was never saved into the stack (thus %r3 still holds the value of the previous frame pointer). */ - return TARGET_READ_FP (); + return deprecated_read_fp (); } } @@ -1471,15 +1472,15 @@ hppa_push_dummy_frame (void) else write_memory (sp - 20, (char *) &int_buffer, REGISTER_SIZE); - int_buffer = TARGET_READ_FP (); + int_buffer = deprecated_read_fp (); write_memory (sp, (char *) &int_buffer, REGISTER_SIZE); - write_register (FP_REGNUM, sp); + write_register (DEPRECATED_FP_REGNUM, sp); sp += 2 * REGISTER_SIZE; for (regnum = 1; regnum < 32; regnum++) - if (regnum != RP_REGNUM && regnum != FP_REGNUM) + if (regnum != RP_REGNUM && regnum != DEPRECATED_FP_REGNUM) sp = push_word (sp, read_register (regnum)); /* This is not necessary for the 64bit ABI. In fact it is dangerous. */ @@ -1514,13 +1515,13 @@ find_dummy_frame_regs (struct frame_info *frame, else frame_saved_regs[RP_REGNUM] = (fp - 20) & ~0x3; - frame_saved_regs[FP_REGNUM] = fp; + frame_saved_regs[DEPRECATED_FP_REGNUM] = fp; frame_saved_regs[1] = fp + (2 * REGISTER_SIZE); for (fp += 3 * REGISTER_SIZE, i = 3; i < 32; i++) { - if (i != FP_REGNUM) + if (i != DEPRECATED_FP_REGNUM) { frame_saved_regs[i] = fp; fp += REGISTER_SIZE; @@ -1597,7 +1598,7 @@ hppa_pop_frame (void) write_pc (npc); } - write_register (FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE)); + write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE)); if (fsr[IPSW_REGNUM]) /* call dummy */ write_register (SP_REGNUM, fp - 48); @@ -2441,8 +2442,8 @@ hppa_read_fp (int pid) } /* This is the only site that may directly read_register () the FP - register. All others must use TARGET_READ_FP (). */ - return read_register (FP_REGNUM); + register. All others must use deprecated_read_fp (). */ + return read_register (DEPRECATED_FP_REGNUM); } CORE_ADDR @@ -3589,7 +3590,7 @@ restart: for (i = 3; i < u->Entry_GR + 3; i++) { /* Frame pointer gets saved into a special location. */ - if (u->Save_SP && i == FP_REGNUM) + if (u->Save_SP && i == DEPRECATED_FP_REGNUM) continue; save_gr |= (1 << i); @@ -3940,7 +3941,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, for (i = 3; i < u->Entry_GR + 3; i++) { /* Frame pointer gets saved into a special location. */ - if (u->Save_SP && i == FP_REGNUM) + if (u->Save_SP && i == DEPRECATED_FP_REGNUM) continue; save_gr |= (1 << i); @@ -4002,14 +4003,14 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if ( (inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */ || (inst & 0xffffc00c) == 0x73c10008) /* std,ma r1,N(sr0,sp) */ { - frame_saved_regs[FP_REGNUM] = get_frame_base (frame_info); + frame_saved_regs[DEPRECATED_FP_REGNUM] = get_frame_base (frame_info); save_sp = 0; } /* Account for general and floating-point register saves. */ reg = inst_saves_gr (inst); if (reg >= 3 && reg <= 18 - && (!u->Save_SP || reg != FP_REGNUM)) + && (!u->Save_SP || reg != DEPRECATED_FP_REGNUM)) { save_gr &= ~(1 << reg); @@ -4762,7 +4763,7 @@ hppa_store_return_value (struct type *type, char *valbuf) ? (8 - TYPE_LENGTH (type)) : (4 - TYPE_LENGTH (type))), valbuf, TYPE_LENGTH (type)); - if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) + if (TYPE_CODE (type) == TYPE_CODE_FLT) deprecated_write_register_bytes (REGISTER_BYTE (FP4_REGNUM), valbuf, TYPE_LENGTH (type)); } @@ -4777,7 +4778,7 @@ hppa_store_return_value (struct type *type, char *valbuf) void hppa_extract_return_value (struct type *type, char *regbuf, char *valbuf) { - if (! SOFT_FLOAT && TYPE_CODE (type) == TYPE_CODE_FLT) + if (TYPE_CODE (type) == TYPE_CODE_FLT) memcpy (valbuf, (char *)regbuf + REGISTER_BYTE (FP4_REGNUM), TYPE_LENGTH (type)); @@ -4990,7 +4991,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_num_regs (gdbarch, hppa_num_regs); - set_gdbarch_fp_regnum (gdbarch, 3); + set_gdbarch_deprecated_fp_regnum (gdbarch, 3); set_gdbarch_sp_regnum (gdbarch, 30); set_gdbarch_fp0_regnum (gdbarch, 64); set_gdbarch_pc_regnum (gdbarch, PCOQ_HEAD_REGNUM); @@ -5029,7 +5030,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_read_pc (gdbarch, hppa_target_read_pc); set_gdbarch_write_pc (gdbarch, hppa_target_write_pc); - set_gdbarch_read_fp (gdbarch, hppa_target_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, hppa_target_read_fp); return gdbarch; } @@ -5049,7 +5050,7 @@ _initialize_hppa_tdep (void) void break_at_finish_at_depth_command (char *arg, int from_tty); gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep); - tm_print_insn = print_insn_hppa; + deprecated_tm_print_insn = print_insn_hppa; add_cmd ("unwind", class_maintenance, unwind_command, "Print unwind table entry at given address.", diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 2406e3f..07c82b6 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -669,7 +669,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) } get_frame_saved_regs (fip)[PC_REGNUM] = get_frame_base (fip) + 4; - get_frame_saved_regs (fip)[FP_REGNUM] = get_frame_base (fip); + get_frame_saved_regs (fip)[DEPRECATED_FP_REGNUM] = get_frame_base (fip); } /* Return PC of first real instruction. */ @@ -808,7 +808,7 @@ i386_do_pop_frame (struct frame_info *frame) deprecated_write_register_gen (regnum, regbuf); } } - write_register (FP_REGNUM, read_memory_integer (fp, 4)); + write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); write_register (SP_REGNUM, fp + 8); flush_cached_frames (); @@ -1057,7 +1057,7 @@ i386_use_struct_convention (int gcc_p, struct type *type) static struct type * i386_register_type (struct gdbarch *gdbarch, int regnum) { - if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) + if (regnum == PC_REGNUM || regnum == DEPRECATED_FP_REGNUM || regnum == SP_REGNUM) return lookup_pointer_type (builtin_type_void); if (i386_fp_regnum_p (regnum)) @@ -1469,7 +1469,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS); set_gdbarch_sp_regnum (gdbarch, 4); /* %esp */ - set_gdbarch_fp_regnum (gdbarch, 5); /* %ebp */ + set_gdbarch_deprecated_fp_regnum (gdbarch, 5); /* %ebp */ set_gdbarch_pc_regnum (gdbarch, 8); /* %eip */ set_gdbarch_ps_regnum (gdbarch, 9); /* %eflags */ set_gdbarch_fp0_regnum (gdbarch, 16); /* %st(0) */ @@ -1542,7 +1542,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp); /* Wire in the MMX registers. */ - set_gdbarch_num_pseudo_regs (gdbarch, mmx_num_regs); + set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs); set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 86638fb..7aff5b9 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -678,8 +678,8 @@ rse_address_add(CORE_ADDR addr, int nslots) computationally expensive. So, instead of making life difficult (and slow), we pick a more convenient representation of the frame chain, knowing that we'll have to make some small adjustments in - other places. (E.g, note that read_fp() is actually read_sp() in - ia64_gdbarch_init() below.) + other places. (E.g, note that deprecated_read_fp() is actually + read_sp() in ia64_gdbarch_init() below.) Okay, so what is the frame chain exactly? It'll be the SP value at the time that the function in question was entered. @@ -2168,7 +2168,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, ia64_num_regs); set_gdbarch_sp_regnum (gdbarch, sp_regnum); - set_gdbarch_fp_regnum (gdbarch, fp_regnum); + set_gdbarch_deprecated_fp_regnum (gdbarch, fp_regnum); set_gdbarch_pc_regnum (gdbarch, pc_regnum); set_gdbarch_fp0_regnum (gdbarch, IA64_FR0_REGNUM); @@ -2223,12 +2223,12 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address); - /* We won't necessarily have a frame pointer and even if we do, - it winds up being extraordinarly messy when attempting to find - the frame chain. So for the purposes of creating frames (which - is all read_fp() is used for), simply use the stack pointer value - instead. */ - set_gdbarch_read_fp (gdbarch, generic_target_read_sp); + /* We won't necessarily have a frame pointer and even if we do, it + winds up being extraordinarly messy when attempting to find the + frame chain. So for the purposes of creating frames (which is + all deprecated_read_fp() is used for), simply use the stack + pointer value instead. */ + set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); /* Settings that should be unnecessary. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -2251,6 +2251,6 @@ _initialize_ia64_tdep (void) { register_gdbarch_init (bfd_arch_ia64, ia64_gdbarch_init); - tm_print_insn = print_insn_ia64; - tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER; + deprecated_tm_print_insn = print_insn_ia64; + deprecated_tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER; } diff --git a/gdb/infcall.c b/gdb/infcall.c new file mode 100644 index 0000000..1ce22fb --- /dev/null +++ b/gdb/infcall.c @@ -0,0 +1,981 @@ +/* Perform an inferior function call, for GDB, the GNU debugger. + + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software + 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 "breakpoint.h" +#include "target.h" +#include "regcache.h" +#include "inferior.h" +#include "gdb_assert.h" +#include "block.h" +#include "gdbcore.h" +#include "language.h" +#include "symfile.h" +#include "gdbcmd.h" +#include "command.h" +#include "gdb_string.h" + +/* NOTE: cagney/2003-04-16: What's the future of this code? + + GDB needs an asynchronous expression evaluator, that means an + asynchronous inferior function call implementation, and that in + turn means restructuring the code so that it is event driven. */ + +/* How you should pass arguments to a function depends on whether it + was defined in K&R style or prototype style. If you define a + function using the K&R syntax that takes a `float' argument, then + callers must pass that argument as a `double'. If you define the + function using the prototype syntax, then you must pass the + argument as a `float', with no promotion. + + Unfortunately, on certain older platforms, the debug info doesn't + indicate reliably how each function was defined. A function type's + TYPE_FLAG_PROTOTYPED flag may be clear, even if the function was + defined in prototype style. When calling a function whose + TYPE_FLAG_PROTOTYPED flag is clear, GDB consults this flag to + decide what to do. + + For modern targets, it is proper to assume that, if the prototype + flag is clear, that can be trusted: `float' arguments should be + promoted to `double'. For some older targets, if the prototype + flag is clear, that doesn't tell us anything. The default is to + trust the debug information; the user can override this behavior + with "set coerce-float-to-double 0". */ + +static int coerce_float_to_double_p = 1; + +/* This boolean tells what gdb should do if a signal is received while + in a function called from gdb (call dummy). If set, gdb unwinds + the stack and restore the context to what as it was before the + call. + + The default is to stop in the frame where the signal was received. */ + +int unwind_on_signal_p = 0; + +/* Perform the standard coercions that are specified + for arguments to be passed to C functions. + + If PARAM_TYPE is non-NULL, it is the expected parameter type. + IS_PROTOTYPED is non-zero if the function declaration is prototyped. */ + +static struct value * +value_arg_coerce (struct value *arg, struct type *param_type, + int is_prototyped) +{ + register struct type *arg_type = check_typedef (VALUE_TYPE (arg)); + register struct type *type + = param_type ? check_typedef (param_type) : arg_type; + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_REF: + if (TYPE_CODE (arg_type) != TYPE_CODE_REF + && TYPE_CODE (arg_type) != TYPE_CODE_PTR) + { + arg = value_addr (arg); + VALUE_TYPE (arg) = param_type; + return arg; + } + break; + case TYPE_CODE_INT: + case TYPE_CODE_CHAR: + case TYPE_CODE_BOOL: + case TYPE_CODE_ENUM: + /* If we don't have a prototype, coerce to integer type if necessary. */ + if (!is_prototyped) + { + if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_int)) + type = builtin_type_int; + } + /* Currently all target ABIs require at least the width of an integer + type for an argument. We may have to conditionalize the following + type coercion for future targets. */ + if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_int)) + type = builtin_type_int; + break; + case TYPE_CODE_FLT: + if (!is_prototyped && coerce_float_to_double_p) + { + if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_double)) + type = builtin_type_double; + else if (TYPE_LENGTH (type) > TYPE_LENGTH (builtin_type_double)) + type = builtin_type_long_double; + } + break; + case TYPE_CODE_FUNC: + type = lookup_pointer_type (type); + break; + case TYPE_CODE_ARRAY: + /* Arrays are coerced to pointers to their first element, unless + they are vectors, in which case we want to leave them alone, + because they are passed by value. */ + if (current_language->c_style_arrays) + if (!TYPE_VECTOR (type)) + type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); + break; + case TYPE_CODE_UNDEF: + case TYPE_CODE_PTR: + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_VOID: + case TYPE_CODE_SET: + case TYPE_CODE_RANGE: + case TYPE_CODE_STRING: + case TYPE_CODE_BITSTRING: + case TYPE_CODE_ERROR: + case TYPE_CODE_MEMBER: + case TYPE_CODE_METHOD: + case TYPE_CODE_COMPLEX: + default: + break; + } + + return value_cast (type, arg); +} + +/* Determine a function's address and its return type from its value. + Calls error() if the function is not valid for calling. */ + +CORE_ADDR +find_function_addr (struct value *function, struct type **retval_type) +{ + register struct type *ftype = check_typedef (VALUE_TYPE (function)); + register enum type_code code = TYPE_CODE (ftype); + struct type *value_type; + CORE_ADDR funaddr; + + /* If it's a member function, just look at the function + part of it. */ + + /* Determine address to call. */ + if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) + { + funaddr = VALUE_ADDRESS (function); + value_type = TYPE_TARGET_TYPE (ftype); + } + else if (code == TYPE_CODE_PTR) + { + funaddr = value_as_address (function); + ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); + if (TYPE_CODE (ftype) == TYPE_CODE_FUNC + || TYPE_CODE (ftype) == TYPE_CODE_METHOD) + { + funaddr = CONVERT_FROM_FUNC_PTR_ADDR (funaddr); + value_type = TYPE_TARGET_TYPE (ftype); + } + else + value_type = builtin_type_int; + } + else if (code == TYPE_CODE_INT) + { + /* Handle the case of functions lacking debugging info. + Their values are characters since their addresses are char */ + if (TYPE_LENGTH (ftype) == 1) + funaddr = value_as_address (value_addr (function)); + else + /* Handle integer used as address of a function. */ + funaddr = (CORE_ADDR) value_as_long (function); + + value_type = builtin_type_int; + } + else + error ("Invalid data type for function to be called."); + + *retval_type = value_type; + return funaddr; +} + +/* Call breakpoint_auto_delete on the current contents of the bpstat + pointed to by arg (which is really a bpstat *). */ + +static void +breakpoint_auto_delete_contents (void *arg) +{ + breakpoint_auto_delete (*(bpstat *) arg); +} + +/* All this stuff with a dummy frame may seem unnecessarily complicated + (why not just save registers in GDB?). The purpose of pushing a dummy + frame which looks just like a real frame is so that if you call a + function and then hit a breakpoint (get a signal, etc), "backtrace" + will look right. Whether the backtrace needs to actually show the + stack at the time the inferior function was called is debatable, but + it certainly needs to not display garbage. So if you are contemplating + making dummy frames be different from normal frames, consider that. */ + +/* Perform a function call in the inferior. + ARGS is a vector of values of arguments (NARGS of them). + FUNCTION is a value, the function to be called. + Returns a value representing what the function returned. + May fail to return, if a breakpoint or signal is hit + during the execution of the function. + + ARGS is modified to contain coerced values. */ + +struct value * +call_function_by_hand (struct value *function, int nargs, struct value **args) +{ + register CORE_ADDR sp; + CORE_ADDR dummy_addr; + struct type *value_type; + unsigned char struct_return; + CORE_ADDR struct_addr = 0; + struct regcache *retbuf; + struct cleanup *retbuf_cleanup; + struct inferior_status *inf_status; + struct cleanup *inf_status_cleanup; + CORE_ADDR funaddr; + int using_gcc; /* Set to version of gcc in use, or zero if not gcc */ + CORE_ADDR real_pc; + struct type *ftype = check_typedef (SYMBOL_TYPE (function)); + CORE_ADDR bp_addr; + + if (!target_has_execution) + noprocess (); + + /* Create a cleanup chain that contains the retbuf (buffer + containing the register values). This chain is create BEFORE the + inf_status chain so that the inferior status can cleaned up + (restored or discarded) without having the retbuf freed. */ + retbuf = regcache_xmalloc (current_gdbarch); + retbuf_cleanup = make_cleanup_regcache_xfree (retbuf); + + /* A cleanup for the inferior status. Create this AFTER the retbuf + so that this can be discarded or applied without interfering with + the regbuf. */ + inf_status = save_inferior_status (1); + inf_status_cleanup = make_cleanup_restore_inferior_status (inf_status); + + if (DEPRECATED_PUSH_DUMMY_FRAME_P ()) + { + /* DEPRECATED_PUSH_DUMMY_FRAME is responsible for saving the + inferior registers (and frame_pop() for restoring them). (At + least on most machines) they are saved on the stack in the + inferior. */ + DEPRECATED_PUSH_DUMMY_FRAME; + } + else + { + /* FIXME: cagney/2003-02-26: Step zero of this little tinker is + to extract the generic dummy frame code from the architecture + vector. Hence this direct call. + + A follow-on change is to modify this interface so that it takes + thread OR frame OR tpid as a parameter, and returns a dummy + frame handle. The handle can then be used further down as a + parameter SAVE_DUMMY_FRAME_TOS. Hmm, thinking about it, since + everything is ment to be using generic dummy frames, why not + even use some of the dummy frame code to here - do a regcache + dup and then pass the duped regcache, along with all the other + stuff, at one single point. + + In fact, you can even save the structure's return address in the + dummy frame and fix one of those nasty lost struct return edge + conditions. */ + generic_push_dummy_frame (); + } + + /* Ensure that the initial SP is correctly aligned. */ + { + CORE_ADDR old_sp = read_sp (); + if (gdbarch_frame_align_p (current_gdbarch)) + { + /* NOTE: cagney/2002-09-18: + + On a RISC architecture, a void parameterless generic dummy + frame (i.e., no parameters, no result) typically does not + need to push anything the stack and hence can leave SP and + FP. Similarly, a framelss (possibly leaf) function does + not push anything on the stack and, hence, that too can + leave FP and SP unchanged. As a consequence, a sequence of + void parameterless generic dummy frame calls to frameless + functions will create a sequence of effectively identical + frames (SP, FP and TOS and PC the same). This, not + suprisingly, results in what appears to be a stack in an + infinite loop --- when GDB tries to find a generic dummy + frame on the internal dummy frame stack, it will always + find the first one. + + To avoid this problem, the code below always grows the + stack. That way, two dummy frames can never be identical. + It does burn a few bytes of stack but that is a small price + to pay :-). */ + sp = gdbarch_frame_align (current_gdbarch, old_sp); + if (sp == old_sp) + { + if (INNER_THAN (1, 2)) + /* Stack grows down. */ + sp = gdbarch_frame_align (current_gdbarch, old_sp - 1); + else + /* Stack grows up. */ + sp = gdbarch_frame_align (current_gdbarch, old_sp + 1); + } + gdb_assert ((INNER_THAN (1, 2) && sp <= old_sp) + || (INNER_THAN (2, 1) && sp >= old_sp)); + } + else + /* FIXME: cagney/2002-09-18: Hey, you loose! Who knows how + badly aligned the SP is! Further, per comment above, if the + generic dummy frame ends up empty (because nothing is pushed) + GDB won't be able to correctly perform back traces. If a + target is having trouble with backtraces, first thing to do + is add FRAME_ALIGN() to its architecture vector. After that, + try adding SAVE_DUMMY_FRAME_TOS() and modifying + DEPRECATED_FRAME_CHAIN so that when the next outer frame is a + generic dummy, it returns the current frame's base. */ + sp = old_sp; + } + + funaddr = find_function_addr (function, &value_type); + CHECK_TYPEDEF (value_type); + + { + struct block *b = block_for_pc (funaddr); + /* If compiled without -g, assume GCC 2. */ + using_gcc = (b == NULL ? 2 : BLOCK_GCC_COMPILED (b)); + } + + /* Are we returning a value using a structure return or a normal + value return? */ + + struct_return = using_struct_return (function, funaddr, value_type, + using_gcc); + + switch (CALL_DUMMY_LOCATION) + { + case ON_STACK: + { + /* CALL_DUMMY is an array of words (REGISTER_SIZE), but each + word is in host byte order. Before calling FIX_CALL_DUMMY, + we byteswap it and remove any extra bytes which might exist + because ULONGEST is bigger than REGISTER_SIZE. */ + /* NOTE: This is pretty wierd, as the call dummy is actually a + sequence of instructions. But CISC machines will have to + pack the instructions into REGISTER_SIZE units (and so will + RISC machines for which INSTRUCTION_SIZE is not + REGISTER_SIZE). */ + /* NOTE: This is pretty stupid. CALL_DUMMY should be in + strict target byte order. */ + CORE_ADDR start_sp; + ULONGEST *dummy = alloca (SIZEOF_CALL_DUMMY_WORDS); + int sizeof_dummy1 = (REGISTER_SIZE * SIZEOF_CALL_DUMMY_WORDS + / sizeof (ULONGEST)); + char *dummy1 = alloca (sizeof_dummy1); + memcpy (dummy, CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS); + if (INNER_THAN (1, 2)) + { + /* Stack grows down */ + sp -= sizeof_dummy1; + start_sp = sp; + } + else + { + /* Stack grows up */ + start_sp = sp; + sp += sizeof_dummy1; + } + /* NOTE: cagney/2002-09-10: Don't bother re-adjusting the + stack after allocating space for the call dummy. A target + can specify a SIZEOF_DUMMY1 (via SIZEOF_CALL_DUMMY_WORDS) + such that all local alignment requirements are met. */ + /* Create a call sequence customized for this function and the + number of arguments for it. */ + { + int i; + for (i = 0; i < (int) (SIZEOF_CALL_DUMMY_WORDS / sizeof (dummy[0])); + i++) + store_unsigned_integer (&dummy1[i * REGISTER_SIZE], + REGISTER_SIZE, + (ULONGEST) dummy[i]); + } + /* NOTE: cagney/2003-04-22: This computation of REAL_PC, + BP_ADDR and DUMMY_ADDR is pretty messed up. It comes from + constant tinkering with the values. Instead a + FIX_CALL_DUMMY replacement (PUSH_DUMMY_BREAKPOINT?) should + just do everything. */ +#ifdef GDB_TARGET_IS_HPPA + real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, + value_type, using_gcc); +#else + 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 + dummy_addr = start_sp; + /* Yes, the offset is applied to the real_pc and not the dummy + addr. Ulgh! Blame the HP/UX target. */ + bp_addr = real_pc + CALL_DUMMY_BREAKPOINT_OFFSET; + /* Yes, the offset is applied to the real_pc and not the + dummy_addr. Ulgh! Blame the HP/UX target. */ + real_pc += CALL_DUMMY_START_OFFSET; + 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); + break; + } + case AT_ENTRY_POINT: + real_pc = funaddr; + dummy_addr = CALL_DUMMY_ADDRESS (); + /* A call dummy always consists of just a single breakpoint, so + it's address is the same as the address of the dummy. */ + bp_addr = dummy_addr; + 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"); + } + + if (nargs < TYPE_NFIELDS (ftype)) + error ("too few arguments in function call"); + + { + int i; + for (i = nargs - 1; i >= 0; i--) + { + int prototyped; + struct type *param_type; + + /* FIXME drow/2002-05-31: Should just always mark methods as + prototyped. Can we respect TYPE_VARARGS? Probably not. */ + if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) + prototyped = 1; + else if (i < TYPE_NFIELDS (ftype)) + prototyped = TYPE_PROTOTYPED (ftype); + else + prototyped = 0; + + if (i < TYPE_NFIELDS (ftype)) + param_type = TYPE_FIELD_TYPE (ftype, i); + else + param_type = NULL; + + args[i] = value_arg_coerce (args[i], param_type, prototyped); + + /* elz: this code is to handle the case in which the function + to be called has a pointer to function as parameter and the + corresponding actual argument is the address of a function + and not a pointer to function variable. In aCC compiled + code, the calls through pointers to functions (in the body + of the function called by hand) are made via + $$dyncall_external which requires some registers setting, + this is taken care of if we call via a function pointer + variable, but not via a function address. In cc this is + not a problem. */ + + if (using_gcc == 0) + { + if (param_type != NULL && TYPE_CODE (ftype) != TYPE_CODE_METHOD) + { + /* if this parameter is a pointer to function. */ + if (TYPE_CODE (param_type) == TYPE_CODE_PTR) + if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC) + /* elz: FIXME here should go the test about the + compiler used to compile the target. We want to + issue the error message only if the compiler + used was HP's aCC. If we used HP's cc, then + there is no problem and no need to return at + this point. */ + /* Go see if the actual parameter is a variable of + type pointer to function or just a function. */ + if (args[i]->lval == not_lval) + { + char *arg_name; + if (find_pc_partial_function ((CORE_ADDR) args[i]->aligner.contents[0], &arg_name, NULL, NULL)) + error ("\ +You cannot use function <%s> as argument. \n\ +You must use a pointer to function type variable. Command ignored.", arg_name); + } + } + } + } + } + + if (REG_STRUCT_HAS_ADDR_P ()) + { + int i; + /* This is a machine like the sparc, where we may need to pass a + pointer to the structure, not the structure itself. */ + for (i = nargs - 1; i >= 0; i--) + { + struct type *arg_type = check_typedef (VALUE_TYPE (args[i])); + if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT + || TYPE_CODE (arg_type) == TYPE_CODE_UNION + || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY + || TYPE_CODE (arg_type) == TYPE_CODE_STRING + || TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING + || TYPE_CODE (arg_type) == TYPE_CODE_SET + || (TYPE_CODE (arg_type) == TYPE_CODE_FLT + && TYPE_LENGTH (arg_type) > 8) + ) + && REG_STRUCT_HAS_ADDR (using_gcc, arg_type)) + { + CORE_ADDR addr; + int len; /* = TYPE_LENGTH (arg_type); */ + int aligned_len; + arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i])); + len = TYPE_LENGTH (arg_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. */ + aligned_len = STACK_ALIGN (len); + else + aligned_len = len; + if (INNER_THAN (1, 2)) + { + /* stack grows downward */ + sp -= aligned_len; + /* ... so the address of the thing we push is the + stack pointer after we push it. */ + addr = sp; + } + else + { + /* The stack grows up, so the address of the thing + we push is the stack pointer before we push it. */ + addr = sp; + sp += aligned_len; + } + /* Push the structure. */ + write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len); + /* The value we're going to pass is the address of the + thing we just pushed. */ + /*args[i] = value_from_longest (lookup_pointer_type (value_type), + (LONGEST) addr); */ + args[i] = value_from_pointer (lookup_pointer_type (arg_type), + addr); + } + } + } + + + /* Reserve space for the return structure to be written on the + stack, if necessary. Make certain that the value is correctly + aligned. */ + + if (struct_return) + { + int len = TYPE_LENGTH (value_type); + if (STACK_ALIGN_P ()) + /* 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)) + { + /* Stack grows downward. Align STRUCT_ADDR and SP after + making space for the return value. */ + sp -= len; + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); + struct_addr = sp; + } + else + { + /* Stack grows upward. Align the frame, allocate space, and + then again, re-align the frame??? */ + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); + struct_addr = sp; + sp += len; + if (gdbarch_frame_align_p (current_gdbarch)) + sp = gdbarch_frame_align (current_gdbarch, sp); + } + } + + /* elz: on HPPA no need for this extra alignment, maybe it is needed + on other architectures. This is because all the alignment is + taken care of in the above code (ifdef REG_STRUCT_HAS_ADDR) and + in hppa_push_arguments */ + /* NOTE: cagney/2003-03-24: The below code is very broken. Given an + odd sized parameter the below will mis-align the stack. As was + suggested back in '96, better to let PUSH_ARGUMENTS handle it. */ + 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_dummy_call() adjust the + stack in a target-defined manner. */ + if (STACK_ALIGN_P () && INNER_THAN (1, 2)) + { + /* If stack grows down, we must leave a hole at the top. */ + int len = 0; + int i; + for (i = nargs - 1; i >= 0; i--) + len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i])); + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) + len += DEPRECATED_CALL_DUMMY_STACK_ADJUST; + sp -= STACK_ALIGN (len) - len; + } + } + + /* 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 (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 + save the machine state, push the arguments, and jump directly + to the callee function. Since this doesn't actually involve + executing a JSR/BSR instruction, the return address must be set + up by hand, either by pushing onto the stack or copying into a + 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. */ + /* NOTE: cagney/2003-04-22: The first parameter ("real_pc") has + been replaced with zero, it turns out that no implementation + used that parameter. This occured because the value being + supplied - the address of the called function's entry point + instead of the address of the breakpoint that the called + function should return to - wasn't useful. */ + sp = DEPRECATED_PUSH_RETURN_ADDRESS (0, sp); + + /* 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! */ + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) + sp += DEPRECATED_CALL_DUMMY_STACK_ADJUST; + sp = STACK_ALIGN (sp); + } + +/* XXX This seems wrong. For stacks that grow down we shouldn't do + anything here! */ + /* 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. */ + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) + if (INNER_THAN (1, 2)) + { + /* stack grows downward */ + sp -= DEPRECATED_CALL_DUMMY_STACK_ADJUST; + } + + /* Store the address at which the structure is supposed to be + written. */ + /* NOTE: 2003-03-24: Since PUSH_ARGUMENTS can (and typically does) + store the struct return address, this call is entirely redundant. */ + if (struct_return && DEPRECATED_STORE_STRUCT_RETURN_P ()) + DEPRECATED_STORE_STRUCT_RETURN (struct_addr, sp); + + /* Write the stack pointer. This is here because the statements above + 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.) */ + /* 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); + + /* Now proceed, having reached the desired place. */ + clear_proceed_status (); + + /* Create a momentary breakpoint at the return address of the + inferior. That way it breaks when it returns. */ + + { + struct breakpoint *bpt; + struct symtab_and_line sal; + struct frame_id frame; + init_sal (&sal); /* initialize to zeroes */ + sal.pc = bp_addr; + 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. */ + /* The assumption here is that push_dummy_call() returned the + stack part of the frame ID. Unfortunatly, many older + architectures were, via a convoluted mess, relying on the + poorly defined and greatly overloaded DEPRECATED_TARGET_READ_FP + or DEPRECATED_FP_REGNUM to supply the value. */ + if (DEPRECATED_TARGET_READ_FP_P ()) + frame = frame_id_build (DEPRECATED_TARGET_READ_FP (), sal.pc); + else if (DEPRECATED_FP_REGNUM >= 0) + frame = frame_id_build (read_register (DEPRECATED_FP_REGNUM), sal.pc); + else + frame = frame_id_build (sp, sal.pc); + bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy); + bpt->disposition = disp_del; + } + + /* Execute a "stack dummy", a piece of code stored in the stack by + the debugger to be executed in the inferior. + + The dummy's frame is automatically popped whenever that break is + hit. If that is the first time the program stops, + call_function_by_hand returns to its caller with that frame + already gone and sets RC to 0. + + Otherwise, set RC to a non-zero value. If the called function + receives a random signal, we do not allow the user to continue + executing it as this may not work. The dummy frame is poped and + we return 1. If we hit a breakpoint, we leave the frame in place + and return 2 (the frame will eventually be popped when we do hit + the dummy end breakpoint). */ + + { + struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); + int saved_async = 0; + + /* 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... */ + + if (target_can_async_p ()) + saved_async = target_async_mask (0); + + proceed (real_pc, TARGET_SIGNAL_0, 0); + + if (saved_async) + target_async_mask (saved_async); + + enable_watchpoints_after_interactive_call_stop (); + + discard_cleanups (old_cleanups); + } + + if (stopped_by_random_signal || !stop_stack_dummy) + { + /* Find the name of the function we're about to complain about. */ + char *name = NULL; + { + struct symbol *symbol = find_pc_function (funaddr); + if (symbol) + name = SYMBOL_PRINT_NAME (symbol); + else + { + /* Try the minimal symbols. */ + struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (funaddr); + if (msymbol) + name = SYMBOL_PRINT_NAME (msymbol); + } + } + if (name == NULL) + { + /* NOTE: cagney/2003-04-23: Don't blame me. This code dates + back to 1993-07-08, I simply moved it. */ + char format[80]; + sprintf (format, "at %s", local_hex_format ()); + name = alloca (80); + /* FIXME-32x64: assumes funaddr fits in a long. */ + sprintf (name, format, (unsigned long) funaddr); + } + if (stopped_by_random_signal) + { + /* We stopped inside the FUNCTION because of a random + signal. Further execution of the FUNCTION is not + allowed. */ + + if (unwind_on_signal_p) + { + /* The user wants the context restored. */ + + /* We must get back to the frame we were before the + dummy call. */ + frame_pop (get_current_frame ()); + + /* FIXME: Insert a bunch of wrap_here; name can be very + long if it's a C++ name with arguments and stuff. */ + error ("\ +The program being debugged was signaled while in a function called from GDB.\n\ +GDB has restored the context to what it was before the call.\n\ +To change this behavior use \"set unwindonsignal off\"\n\ +Evaluation of the expression containing the function (%s) will be abandoned.", + name); + } + else + { + /* The user wants to stay in the frame where we stopped + (default).*/ + /* If we restored the inferior status (via the cleanup), + we would print a spurious error message (Unable to + restore previously selected frame), would write the + registers from the inf_status (which is wrong), and + would do other wrong things. */ + discard_cleanups (inf_status_cleanup); + discard_inferior_status (inf_status); + /* FIXME: Insert a bunch of wrap_here; name can be very + long if it's a C++ name with arguments and stuff. */ + error ("\ +The program being debugged was signaled while in a function called from GDB.\n\ +GDB remains in the frame where the signal was received.\n\ +To change this behavior use \"set unwindonsignal on\"\n\ +Evaluation of the expression containing the function (%s) will be abandoned.", + name); + } + } + + if (!stop_stack_dummy) + { + /* We hit a breakpoint inside the FUNCTION. */ + /* If we restored the inferior status (via the cleanup), we + would print a spurious error message (Unable to restore + previously selected frame), would write the registers + from the inf_status (which is wrong), and would do other + wrong things. */ + discard_cleanups (inf_status_cleanup); + discard_inferior_status (inf_status); + /* The following error message used to say "The expression + which contained the function call has been discarded." + It is a hard concept to explain in a few words. Ideally, + GDB would be able to resume evaluation of the expression + when the function finally is done executing. Perhaps + someday this will be implemented (it would not be easy). */ + /* FIXME: Insert a bunch of wrap_here; name can be very long if it's + a C++ name with arguments and stuff. */ + error ("\ +The program being debugged stopped while in a function called from GDB.\n\ +When the function (%s) is done executing, GDB will silently\n\ +stop (instead of continuing to evaluate the expression containing\n\ +the function call).", name); + } + + /* The above code errors out, so ... */ + internal_error (__FILE__, __LINE__, "... should not be here"); + } + + /* If we get here the called FUNCTION run to completion. */ + + /* On normal return, the stack dummy has been popped already. */ + regcache_cpy_no_passthrough (retbuf, stop_registers); + + /* Restore the inferior status, via its cleanup. At this stage, + leave the RETBUF alone. */ + do_cleanups (inf_status_cleanup); + + /* Figure out the value returned by the function. */ + /* elz: I defined this new macro for the hppa architecture only. + this gives us a way to get the value returned by the function + from the stack, at the same address we told the function to put + it. We cannot assume on the pa that r28 still contains the + address of the returned structure. Usually this will be + overwritten by the callee. I don't know about other + architectures, so I defined this macro */ +#ifdef VALUE_RETURNED_FROM_STACK + if (struct_return) + { + do_cleanups (retbuf_cleanup); + return VALUE_RETURNED_FROM_STACK (value_type, struct_addr); + } +#endif + /* NOTE: cagney/2002-09-10: Only when the stack has been correctly + aligned (using frame_align()) do we can trust STRUCT_ADDR and + fetch the return value direct from the stack. This lack of trust + comes about because legacy targets have a nasty habit of + silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. For + such targets, just hope that value_being_returned() can find the + adjusted value. */ + if (struct_return && gdbarch_frame_align_p (current_gdbarch)) + { + struct value *retval = value_at (value_type, struct_addr, NULL); + do_cleanups (retbuf_cleanup); + return retval; + } + else + { + struct value *retval = value_being_returned (value_type, retbuf, + struct_return); + do_cleanups (retbuf_cleanup); + return retval; + } +} + +void _initialize_infcall (void); + +void +_initialize_infcall (void) +{ + add_setshow_boolean_cmd ("coerce-float-to-double", class_obscure, + &coerce_float_to_double_p, "\ +Set coercion of floats to doubles when calling functions\n\ +Variables of type float should generally be converted to doubles before\n\ +calling an unprototyped function, and left alone when calling a prototyped\n\ +function. However, some older debug info formats do not provide enough\n\ +information to determine that a function is prototyped. If this flag is\n\ +set, GDB will perform the conversion for a function it considers\n\ +unprototyped.\n\ +The default is to perform the conversion.\n", "\ +Show coercion of floats to doubles when calling functions\n\ +Variables of type float should generally be converted to doubles before\n\ +calling an unprototyped function, and left alone when calling a prototyped\n\ +function. However, some older debug info formats do not provide enough\n\ +information to determine that a function is prototyped. If this flag is\n\ +set, GDB will perform the conversion for a function it considers\n\ +unprototyped.\n\ +The default is to perform the conversion.\n", + NULL, NULL, &setlist, &showlist); + + add_setshow_boolean_cmd ("unwindonsignal", no_class, + &unwind_on_signal_p, "\ +Set unwinding of stack if a signal is received while in a call dummy.\n\ +The unwindonsignal lets the user determine what gdb should do if a signal\n\ +is received while in a function called from gdb (call dummy). If set, gdb\n\ +unwinds the stack and restore the context to what as it was before the call.\n\ +The default is to stop in the frame where the signal was received.", "\ +Set unwinding of stack if a signal is received while in a call dummy.\n\ +The unwindonsignal lets the user determine what gdb should do if a signal\n\ +is received while in a function called from gdb (call dummy). If set, gdb\n\ +unwinds the stack and restore the context to what as it was before the call.\n\ +The default is to stop in the frame where the signal was received.", + NULL, NULL, &setlist, &showlist); +} diff --git a/gdb/infcall.h b/gdb/infcall.h new file mode 100644 index 0000000..05d06e0 --- /dev/null +++ b/gdb/infcall.h @@ -0,0 +1,43 @@ +/* Perform an inferior function call, for GDB, the GNU debugger. + + Copyright 2003 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef INFCALL_H +#define INFCALL_H + +struct value; +struct type; + +extern CORE_ADDR find_function_addr (struct value *function, + struct type **retval_type); + +/* Perform a function call in the inferior. + + ARGS is a vector of values of arguments (NARGS of them). FUNCTION + is a value, the function to be called. Returns a value + representing what the function returned. May fail to return, if a + breakpoint or signal is hit during the execution of the function. + + ARGS is modified to contain coerced values. */ + +extern struct value *call_function_by_hand (struct value *function, int nargs, + struct value **args); + +#endif diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 01ab3d7..5867655 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -115,8 +115,6 @@ void _initialize_infcmd (void); #define GO_USAGE "Usage: go <location>\n" -static void breakpoint_auto_delete_contents (void *); - #define ERROR_NO_INFERIOR \ if (!target_has_execution) error ("The program is not being run."); @@ -950,112 +948,6 @@ signal_command (char *signum_exp, int from_tty) proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0); } -/* Call breakpoint_auto_delete on the current contents of the bpstat - pointed to by arg (which is really a bpstat *). */ - -static void -breakpoint_auto_delete_contents (void *arg) -{ - breakpoint_auto_delete (*(bpstat *) arg); -} - - -/* Execute a "stack dummy", a piece of code stored in the stack - by the debugger to be executed in the inferior. - - To call: first, do PUSH_DUMMY_FRAME. - Then push the contents of the dummy. It should end with a breakpoint insn. - Then call here, passing address at which to start the dummy. - - The contents of all registers are saved before the dummy frame is popped - and copied into the buffer BUFFER. - - The dummy's frame is automatically popped whenever that break is hit. - If that is the first time the program stops, run_stack_dummy - returns to its caller with that frame already gone and returns 0. - - Otherwise, run_stack-dummy returns a non-zero value. - If the called function receives a random signal, we do not allow the user - to continue executing it as this may not work. The dummy frame is poped - and we return 1. - If we hit a breakpoint, we leave the frame in place and return 2 (the frame - will eventually be popped when we do hit the dummy end breakpoint). */ - -int -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 (); - - 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); - - disable_watchpoints_before_interactive_call_start (); - proceed_to_finish = 1; /* We want stop_registers, please... */ - - if (target_can_async_p ()) - saved_async = target_async_mask (0); - - proceed (addr, TARGET_SIGNAL_0, 0); - - if (saved_async) - target_async_mask (saved_async); - - enable_watchpoints_after_interactive_call_stop (); - - discard_cleanups (old_cleanups); - - /* We can stop during an inferior call because a signal is received. */ - if (stopped_by_random_signal) - return 1; - - /* We may also stop prematurely because we hit a breakpoint in the - called routine. */ - if (!stop_stack_dummy) - return 2; - - /* On normal return, the stack dummy has been popped already. */ - regcache_cpy_no_passthrough (buffer, stop_registers); - return 0; -} - /* Proceed until we reach a different source line with pc greater than our current one or exit the function. We skip calls in both cases. diff --git a/gdb/inferior.h b/gdb/inferior.h index 6203449..e4286e4 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -164,8 +164,6 @@ extern void terminal_save_ours (void); extern void terminal_ours (void); -extern int run_stack_dummy (CORE_ADDR , struct regcache *); - extern CORE_ADDR read_pc (void); extern CORE_ADDR read_pc_pid (ptid_t); @@ -184,9 +182,7 @@ extern CORE_ADDR generic_target_read_sp (void); extern void generic_target_write_sp (CORE_ADDR); -extern CORE_ADDR read_fp (void); - -extern CORE_ADDR generic_target_read_fp (void); +extern CORE_ADDR deprecated_read_fp (void); extern CORE_ADDR unsigned_pointer_to_address (struct type *type, const void *buf); diff --git a/gdb/linespec.c b/gdb/linespec.c index 2738b1e..ea52a80 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -33,6 +33,7 @@ #include "cp-abi.h" #include "parser-defs.h" #include "block.h" +#include "objc-lang.h" /* We share this one with symtab.c, but it is not exported widely. */ @@ -49,6 +50,12 @@ static struct symtabs_and_lines decode_indirect (char **argptr); static char *locate_first_half (char **argptr, int *is_quote_enclosed); +static struct symtabs_and_lines decode_objc (char **argptr, + int funfirstline, + struct symtab *file_symtab, + char ***canonical, + char *saved_arg); + static struct symtabs_and_lines decode_compound (char **argptr, int funfirstline, char ***canonical, @@ -589,6 +596,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, int is_quoted; /* Is part of *ARGPTR is enclosed in double quotes? */ int is_quote_enclosed; + int is_objc_method = 0; char *saved_arg = *argptr; /* Defaults have defaults. */ @@ -614,6 +622,25 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, p = locate_first_half (argptr, &is_quote_enclosed); + /* Check if this is an Objective-C method (anything that starts with + a '+' or '-' and a '['). */ + if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL) + && (p[2] == '[')) + { + is_objc_method = 1; + paren_pointer = NULL; /* Just a category name. Ignore it. */ + } + + /* Check if the symbol could be an Objective-C selector. */ + + { + struct symtabs_and_lines values; + values = decode_objc (argptr, funfirstline, NULL, + canonical, saved_arg); + if (values.sals != NULL) + return values; + } + /* Does it look like there actually were two parts? */ if ((p[0] == ':' || p[0] == '.') && paren_pointer == NULL) @@ -695,6 +722,11 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, if (p[-1] != '\'') error ("Unmatched single quote."); } + else if (is_objc_method) + { + /* allow word separators in method names for Obj-C */ + p = skip_quoted_chars (*argptr, NULL, ""); + } else if (paren_pointer != NULL) { p = paren_pointer + 1; @@ -893,6 +925,13 @@ locate_first_half (char **argptr, int *is_quote_enclosed) error ("malformed template specification in command"); p = temp_end; } + /* Check for a colon and a plus or minus and a [ (which + indicates an Objective-C method) */ + if (*p && (p[0] == ':') && (strchr ("+-", p[1]) != NULL) + && (p[2] == '[')) + { + break; + } /* Check for the end of the first half of the linespec. End of line, a tab, a double colon or the last single colon, or a space. But if enclosed in double quotes we do not break on @@ -936,6 +975,95 @@ locate_first_half (char **argptr, int *is_quote_enclosed) +/* Here's where we recognise an Objective-C Selector. An Objective C + selector may be implemented by more than one class, therefore it + may represent more than one method/function. This gives us a + situation somewhat analogous to C++ overloading. If there's more + than one method that could represent the selector, then use some of + the existing C++ code to let the user choose one. */ + +struct symtabs_and_lines +decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab, + char ***canonical, char *saved_arg) +{ + struct symtabs_and_lines values; + struct symbol **sym_arr = NULL; + struct symbol *sym = NULL; + char *copy = NULL; + struct block *block = NULL; + int i1 = 0; + int i2 = 0; + + values.sals = NULL; + values.nelts = 0; + + if (file_symtab != NULL) + block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (file_symtab), STATIC_BLOCK); + else + block = get_selected_block (0); + + copy = find_imps (file_symtab, block, *argptr, NULL, &i1, &i2); + + if (i1 > 0) + { + sym_arr = (struct symbol **) alloca ((i1 + 1) * sizeof (struct symbol *)); + sym_arr[i1] = 0; + + copy = find_imps (file_symtab, block, *argptr, sym_arr, &i1, &i2); + *argptr = copy; + } + + /* i1 now represents the TOTAL number of matches found. + i2 represents how many HIGH-LEVEL (struct symbol) matches, + which will come first in the sym_arr array. Any low-level + (minimal_symbol) matches will follow those. */ + + if (i1 == 1) + { + if (i2 > 0) + { + /* Already a struct symbol. */ + sym = sym_arr[0]; + } + else + { + sym = find_pc_function (SYMBOL_VALUE_ADDRESS (sym_arr[0])); + if ((sym != NULL) && strcmp (SYMBOL_LINKAGE_NAME (sym_arr[0]), SYMBOL_LINKAGE_NAME (sym)) != 0) + { + warning ("debugging symbol \"%s\" does not match selector; ignoring", SYMBOL_LINKAGE_NAME (sym)); + sym = NULL; + } + } + + values.sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); + values.nelts = 1; + + if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + { + /* Canonicalize this, so it remains resolved for dylib loads. */ + values.sals[0] = find_function_start_sal (sym, funfirstline); + build_canonical_line_spec (values.sals, SYMBOL_NATURAL_NAME (sym), canonical); + } + else + { + /* The only match was a non-debuggable symbol. */ + values.sals[0].symtab = 0; + values.sals[0].line = 0; + values.sals[0].end = 0; + values.sals[0].pc = SYMBOL_VALUE_ADDRESS (sym_arr[0]); + } + return values; + } + + if (i1 > 1) + { + /* More than one match. The user must choose one or more. */ + return decode_line_2 (sym_arr, i2, funfirstline, canonical); + } + + return values; +} + /* This handles C++ and Java compound data structures. P should point at the first component separator, i.e. double-colon or period. */ diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 37d27a5..8b69c11 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1367,12 +1367,11 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_read_pc (gdbarch, generic_target_read_pc); 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_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); + set_gdbarch_deprecated_fp_regnum (gdbarch, SOFT_FP_REGNUM); set_gdbarch_register_name (gdbarch, m68hc11_register_name); set_gdbarch_register_size (gdbarch, 2); set_gdbarch_register_bytes (gdbarch, M68HC11_ALL_REGS * 2); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 1ad176e..63d0768 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -445,8 +445,8 @@ m68k_push_dummy_frame (void) char raw_buffer[12]; sp = push_word (sp, read_register (PC_REGNUM)); - sp = push_word (sp, read_register (FP_REGNUM)); - write_register (FP_REGNUM, sp); + sp = push_word (sp, read_register (DEPRECATED_FP_REGNUM)); + write_register (DEPRECATED_FP_REGNUM, sp); /* Always save the floating-point registers, whether they exist on this target or not. */ @@ -456,7 +456,7 @@ m68k_push_dummy_frame (void) sp = push_bytes (sp, raw_buffer, 12); } - for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) + for (regnum = DEPRECATED_FP_REGNUM - 1; regnum >= 0; regnum--) { sp = push_word (sp, read_register (regnum)); } @@ -486,7 +486,7 @@ m68k_pop_frame (void) 12); } } - for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--) + for (regnum = DEPRECATED_FP_REGNUM - 1; regnum >= 0; regnum--) { if (get_frame_saved_regs (frame)[regnum]) { @@ -499,7 +499,7 @@ m68k_pop_frame (void) write_register (PS_REGNUM, read_memory_integer (get_frame_saved_regs (frame)[PS_REGNUM], 4)); } - write_register (FP_REGNUM, read_memory_integer (fp, 4)); + write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); write_register (SP_REGNUM, fp + 8); flush_cached_frames (); @@ -589,7 +589,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) /* First possible address for a pc in a call dummy for this frame. */ CORE_ADDR possible_call_dummy_start = - get_frame_base (frame_info) - 28 - FP_REGNUM * 4 - 4 - 8 * 12; + get_frame_base (frame_info) - 28 - DEPRECATED_FP_REGNUM * 4 - 4 - 8 * 12; int nextinsn; @@ -743,7 +743,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) } lose:; get_frame_saved_regs (frame_info)[SP_REGNUM] = get_frame_base (frame_info) + 8; - get_frame_saved_regs (frame_info)[FP_REGNUM] = get_frame_base (frame_info); + get_frame_saved_regs (frame_info)[DEPRECATED_FP_REGNUM] = get_frame_base (frame_info); get_frame_saved_regs (frame_info)[PC_REGNUM] = get_frame_base (frame_info) + 4; #ifdef SIG_SP_FP_OFFSET /* Adjust saved SP_REGNUM for fake _sigtramp frames. */ @@ -1031,7 +1031,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok); set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4)); set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, M68K_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, M68K_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM); set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM); set_gdbarch_fp0_regnum (gdbarch, M68K_FP0_REGNUM); @@ -1066,5 +1066,5 @@ void _initialize_m68k_tdep (void) { gdbarch_register (bfd_arch_m68k, m68k_gdbarch_init, m68k_dump_tdep); - tm_print_insn = print_insn_m68k; + deprecated_tm_print_insn = print_insn_m68k; } diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index ab03f3a..b80152b 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -163,7 +163,7 @@ mcore_dump_insn (char *commnt, CORE_ADDR pc, int insn) { printf_filtered ("MCORE: %s %08x %08x ", commnt, (unsigned int) pc, (unsigned int) insn); - TARGET_PRINT_INSN (pc, &tm_print_insn_info); + TARGET_PRINT_INSN (pc, &deprecated_tm_print_insn_info); printf_filtered ("\n"); } } @@ -1058,8 +1058,8 @@ mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) { - /* We need to setup fi->frame here because run_stack_dummy gets it wrong - by assuming it's always FP. */ + /* We need to setup fi->frame here because call_function_by_hand + gets it wrong by assuming it's always FP. */ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM)); } else @@ -1112,7 +1112,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, MCORE_NUM_REGS); set_gdbarch_pc_regnum (gdbarch, 64); set_gdbarch_sp_regnum (gdbarch, 0); - set_gdbarch_fp_regnum (gdbarch, 0); + set_gdbarch_deprecated_fp_regnum (gdbarch, 0); /* Call Dummies: */ @@ -1173,7 +1173,7 @@ _initialize_mcore_tdep (void) { extern int print_insn_mcore (bfd_vma, disassemble_info *); gdbarch_register (bfd_arch_mcore, mcore_gdbarch_init, mcore_dump_tdep); - tm_print_insn = print_insn_mcore; + deprecated_tm_print_insn = print_insn_mcore; #ifdef MCORE_DEBUG add_show_from_set (add_set_cmd ("mcoredebug", no_class, diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c index f893e33..3aaaa91 100644 --- a/gdb/mips-nat.c +++ b/gdb/mips-nat.c @@ -91,7 +91,7 @@ fetch_inferior_registers (int regno) supply_register (ZERO_REGNUM, zerobuf); /* Frame ptr reg must appear to be 0; it is faked by stack handling code. */ - supply_register (FP_REGNUM, zerobuf); + supply_register (DEPRECATED_FP_REGNUM, zerobuf); } /* Store our register values back into the inferior. @@ -108,7 +108,7 @@ store_inferior_registers (int regno) { if (regno == ZERO_REGNUM || regno == PS_REGNUM || regno == BADVADDR_REGNUM || regno == CAUSE_REGNUM - || regno == FCRIR_REGNUM || regno == FP_REGNUM + || regno == FCRIR_REGNUM || regno == DEPRECATED_FP_REGNUM || (regno >= FIRST_EMBED_REGNUM && regno <= LAST_EMBED_REGNUM)) return; regaddr = REGISTER_PTRACE_ADDR (regno); @@ -210,7 +210,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, } supply_register (ZERO_REGNUM, zerobuf); /* Frame ptr reg must appear to be 0; it is faked by stack handling code. */ - supply_register (FP_REGNUM, zerobuf); + supply_register (DEPRECATED_FP_REGNUM, zerobuf); } /* Return the address in the core dump or inferior of register REGNO. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7956be49..e04283c 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -623,9 +623,9 @@ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG Note: kevinb/2002-08-01: The definition below should faithfully reproduce the behavior of each of the REGISTER_VIRTUAL_TYPE - definitions found in config/mips/tm-*.h. I'm concerned about - the ``FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM'' clause - though. In some cases FP_REGNUM is in this range, and I doubt + definitions found in config/mips/tm-*.h. I'm concerned about the + ``FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM'' clause though. + In some cases DEPRECATED_FP_REGNUM is in this range, and I doubt that this code is correct for the 64-bit case. */ static struct type * @@ -5543,9 +5543,9 @@ mips_gdbarch_init (struct gdbarch_info info, /* Reset the disassembly info, in case it was set to something non-default. */ - tm_print_insn_info.flavour = bfd_target_unknown_flavour; - tm_print_insn_info.arch = bfd_arch_unknown; - tm_print_insn_info.mach = 0; + deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour; + deprecated_tm_print_insn_info.arch = bfd_arch_unknown; + deprecated_tm_print_insn_info.mach = 0; elf_flags = 0; @@ -5626,7 +5626,7 @@ mips_gdbarch_init (struct gdbarch_info info, if (wanted_abi != MIPS_ABI_UNKNOWN) mips_abi = wanted_abi; - /* We have to set tm_print_insn_info before looking for a + /* We have to set deprecated_tm_print_insn_info before looking for a pre-existing architecture, otherwise we may return before we get a chance to set it up. */ if (mips_abi == MIPS_ABI_N32 || mips_abi == MIPS_ABI_N64) @@ -5634,17 +5634,17 @@ mips_gdbarch_init (struct gdbarch_info info, /* Set up the disassembler info, so that we get the right register names from libopcodes. */ if (mips_abi == MIPS_ABI_N32) - tm_print_insn_info.disassembler_options = "gpr-names=n32"; + deprecated_tm_print_insn_info.disassembler_options = "gpr-names=n32"; else - tm_print_insn_info.disassembler_options = "gpr-names=64"; - tm_print_insn_info.flavour = bfd_target_elf_flavour; - tm_print_insn_info.arch = bfd_arch_mips; + deprecated_tm_print_insn_info.disassembler_options = "gpr-names=64"; + deprecated_tm_print_insn_info.flavour = bfd_target_elf_flavour; + deprecated_tm_print_insn_info.arch = bfd_arch_mips; if (info.bfd_arch_info != NULL && info.bfd_arch_info->arch == bfd_arch_mips && info.bfd_arch_info->mach) - tm_print_insn_info.mach = info.bfd_arch_info->mach; + deprecated_tm_print_insn_info.mach = info.bfd_arch_info->mach; else - tm_print_insn_info.mach = bfd_mach_mips8000; + deprecated_tm_print_insn_info.mach = bfd_mach_mips8000; } else /* This string is not recognized explicitly by the disassembler, @@ -5652,7 +5652,7 @@ mips_gdbarch_init (struct gdbarch_info info, the bfd elf headers, such that, if the user overrides the ABI of a program linked as NewABI, the disassembly will follow the register naming conventions specified by the user. */ - tm_print_insn_info.disassembler_options = "gpr-names=32"; + deprecated_tm_print_insn_info.disassembler_options = "gpr-names=32"; if (gdbarch_debug) { @@ -5880,7 +5880,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_register_name (gdbarch, mips_register_name); set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ + set_gdbarch_deprecated_target_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ set_gdbarch_read_sp (gdbarch, mips_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); @@ -6396,8 +6396,8 @@ _initialize_mips_tdep (void) internal_error (__FILE__, __LINE__, "mips_abi_strings out of sync"); gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep); - if (!tm_print_insn) /* Someone may have already set it */ - tm_print_insn = gdb_print_insn_mips; + if (!deprecated_tm_print_insn) /* Someone may have already set it */ + deprecated_tm_print_insn = gdb_print_insn_mips; /* Add root prefix command for all "set mips"/"show mips" commands */ add_prefix_cmd ("mips", no_class, set_mips_command, diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c index 2695f1f..874bef4 100644 --- a/gdb/mipsv4-nat.c +++ b/gdb/mipsv4-nat.c @@ -61,7 +61,7 @@ supply_gregset (gregset_t *gregsetp) /* Fill inaccessible registers with zero. */ supply_register (PS_REGNUM, zerobuf); supply_register (BADVADDR_REGNUM, zerobuf); - supply_register (FP_REGNUM, zerobuf); + supply_register (DEPRECATED_FP_REGNUM, zerobuf); supply_register (UNUSED_REGNUM, zerobuf); for (regi = FIRST_EMBED_REGNUM; regi <= LAST_EMBED_REGNUM; regi++) supply_register (regi, zerobuf); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 22f3b67..8d7de77 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -892,9 +892,10 @@ mn10300_frame_saved_pc (struct frame_info *fi) always be correct. mn10300_analyze_prologue will fix fi->frame if it's not valid. - We can be called with the PC in the call dummy under two circumstances. - First, during normal backtracing, second, while figuring out the frame - pointer just prior to calling the target function (see run_stack_dummy). */ + We can be called with the PC in the call dummy under two + circumstances. First, during normal backtracing, second, while + figuring out the frame pointer just prior to calling the target + function (see call_function_by_hand). */ static void mn10300_init_extra_frame_info (int fromleaf, struct frame_info *fi) @@ -1156,7 +1157,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_do_registers_info (gdbarch, mn10300_do_registers_info); set_gdbarch_sp_regnum (gdbarch, 8); set_gdbarch_pc_regnum (gdbarch, 9); - set_gdbarch_fp_regnum (gdbarch, 31); + set_gdbarch_deprecated_fp_regnum (gdbarch, 31); set_gdbarch_virtual_frame_pointer (gdbarch, mn10300_virtual_frame_pointer); /* Breakpoints. */ @@ -1182,7 +1183,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* That's right, we're using the stack pointer as our frame pointer. */ - set_gdbarch_read_fp (gdbarch, generic_target_read_sp); + set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); /* Calling functions in the inferior from GDB. */ set_gdbarch_call_dummy_words (gdbarch, mn10300_call_dummy_words); @@ -1208,7 +1209,7 @@ _initialize_mn10300_tdep (void) { /* printf("_initialize_mn10300_tdep\n"); */ - tm_print_insn = print_insn_mn10300; + deprecated_tm_print_insn = print_insn_mn10300; register_gdbarch_init (bfd_arch_mn10300, mn10300_gdbarch_init); } diff --git a/gdb/nlm/i386.c b/gdb/nlm/i386.c index b8ab480..8fc6b1d 100644 --- a/gdb/nlm/i386.c +++ b/gdb/nlm/i386.c @@ -92,7 +92,7 @@ do_status (char *ptr, struct StackFrame *frame) ptr = mem2hex (&frame->ExceptionESP, ptr + 3, 4, 0); *ptr++ = ';'; - sprintf (ptr, "%02x:", FP_REGNUM); + sprintf (ptr, "%02x:", DEPRECATED_FP_REGNUM); ptr = mem2hex (&frame->ExceptionEBP, ptr + 3, 4, 0); *ptr++ = ';'; diff --git a/gdb/nlm/i386.h b/gdb/nlm/i386.h index 155702b..ff97aed 100644 --- a/gdb/nlm/i386.h +++ b/gdb/nlm/i386.h @@ -1,7 +1,7 @@ /* Register values. All of these values *MUST* agree with tm.h */ #define SP_REGNUM 4 /* Contains address of top of stack */ #define PC_REGNUM 8 /* Contains program counter */ -#define FP_REGNUM 5 /* Virtual frame pointer */ +#define DEPRECATED_FP_REGNUM 5 /* Virtual frame pointer */ #define NUM_REGS 16 /* Number of machine registers */ #define REGISTER_BYTES (NUM_REGS * 4) /* Total size of registers array */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 3a31ddb..27d7599 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -395,7 +395,7 @@ ns32k_frame_init_saved_regs (struct frame_info *frame) get_frame_saved_regs (frame)[SP_REGNUM] = get_frame_base (frame) + 4; get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 4; - get_frame_saved_regs (frame)[FP_REGNUM] = read_memory_integer (get_frame_base (frame), 4); + get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = read_memory_integer (get_frame_base (frame), 4); } else if (enter_addr == 1) { @@ -412,8 +412,8 @@ ns32k_push_dummy_frame (void) int regnum; sp = push_word (sp, read_register (PC_REGNUM)); - sp = push_word (sp, read_register (FP_REGNUM)); - write_register (FP_REGNUM, sp); + sp = push_word (sp, read_register (DEPRECATED_FP_REGNUM)); + write_register (DEPRECATED_FP_REGNUM, sp); for (regnum = 0; regnum < 8; regnum++) sp = push_word (sp, read_register (regnum)); @@ -436,7 +436,7 @@ ns32k_pop_frame (void) write_register (regnum, read_memory_integer (get_frame_saved_regs (frame)[regnum], 4)); - write_register (FP_REGNUM, read_memory_integer (fp, 4)); + write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, 4)); write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); write_register (SP_REGNUM, fp + 8); flush_cached_frames (); @@ -624,5 +624,5 @@ _initialize_ns32k_tdep (void) { gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, NULL); - tm_print_insn = print_insn_ns32k; + deprecated_tm_print_insn = print_insn_ns32k; } diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c index 24e422d..2fe6d10 100644 --- a/gdb/ns32knbsd-nat.c +++ b/gdb/ns32knbsd-nat.c @@ -58,7 +58,7 @@ fetch_inferior_registers (int regno) RF (R0_REGNUM + 7, inferior_registers.r_r7); RF (SP_REGNUM, inferior_registers.r_sp); - RF (FP_REGNUM, inferior_registers.r_fp); + RF (DEPRECATED_FP_REGNUM, inferior_registers.r_fp); RF (PC_REGNUM, inferior_registers.r_pc); RF (PS_REGNUM, inferior_registers.r_psr); @@ -90,7 +90,7 @@ store_inferior_registers (int regno) RS (R0_REGNUM + 7, inferior_registers.r_r7); RS (SP_REGNUM, inferior_registers.r_sp); - RS (FP_REGNUM, inferior_registers.r_fp); + RS (DEPRECATED_FP_REGNUM, inferior_registers.r_fp); RS (PC_REGNUM, inferior_registers.r_pc); RS (PS_REGNUM, inferior_registers.r_psr); @@ -150,7 +150,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, RF (R0_REGNUM + 7, core_reg->intreg.r_r7); RF (SP_REGNUM, core_reg->intreg.r_sp); - RF (FP_REGNUM, core_reg->intreg.r_fp); + RF (DEPRECATED_FP_REGNUM, core_reg->intreg.r_fp); RF (PC_REGNUM, core_reg->intreg.r_pc); RF (PS_REGNUM, core_reg->intreg.r_psr); @@ -223,7 +223,7 @@ fetch_kcore_registers (struct pcb *pcb) dummy = pcb->pcb_kfp + 8; RF (SP_REGNUM, dummy); - RF (FP_REGNUM, sf.sf_fp); + RF (DEPRECATED_FP_REGNUM, sf.sf_fp); RF (PC_REGNUM, sf.sf_pc); RF (PS_REGNUM, intreg.r_psr); @@ -258,7 +258,7 @@ clear_regs (void) RF (R0_REGNUM + 7, null); RF (SP_REGNUM, null); - RF (FP_REGNUM, null); + RF (DEPRECATED_FP_REGNUM, null); RF (PC_REGNUM, null); RF (PS_REGNUM, null); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index bc937ca..368e336 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -42,6 +42,8 @@ #include "gdb_regex.h" #include "regcache.h" #include "block.h" +#include "infcall.h" +#include "valprint.h" #include <ctype.h> @@ -1751,6 +1753,19 @@ _initialize_objc_language (void) add_com_alias ("po", "print-object", class_vars, 1); } +#if 1 +/* Disable these functions until we put them in the gdbarch vector. */ +static unsigned long FETCH_ARGUMENT (int i) +{ + internal_error (__FILE__, __LINE__, "FETCH_ARGUMENT not implemented"); + return 0; +} +static CORE_ADDR CONVERT_FUNCPTR (CORE_ADDR pc) +{ + internal_error (__FILE__, __LINE__, "CONVERT_FUNCPTR not implemented"); + return pc; +} +#else #if defined (__powerpc__) || defined (__ppc__) static unsigned long FETCH_ARGUMENT (int i) { @@ -1790,6 +1805,7 @@ static CORE_ADDR CONVERT_FUNCPTR (CORE_ADDR pc) return pc; } #endif +#endif static void read_objc_method (CORE_ADDR addr, struct objc_method *method) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index ae87bd7..4f32026 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2243,21 +2243,25 @@ printf_command (char *arg, int from_tty) /* Print the instruction at address MEMADDR in debugged memory, on STREAM. Returns length of the instruction, in bytes. */ +/* FIXME: cagney/2003-04-28: Should instead be using the generic + disassembler but first need to clean that up and stop it trying to + access the exec file. */ + static int print_insn (CORE_ADDR memaddr, struct ui_file *stream) { if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG; + deprecated_tm_print_insn_info.endian = BFD_ENDIAN_BIG; else - TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE; + deprecated_tm_print_insn_info.endian = BFD_ENDIAN_LITTLE; if (TARGET_ARCHITECTURE != NULL) - TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach; + deprecated_tm_print_insn_info.mach = TARGET_ARCHITECTURE->mach; /* else: should set .mach=0 but some disassemblers don't grok this */ - TARGET_PRINT_INSN_INFO->stream = stream; + deprecated_tm_print_insn_info.stream = stream; - return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO); + return TARGET_PRINT_INSN (memaddr, &deprecated_tm_print_insn_info); } diff --git a/gdb/procfs.c b/gdb/procfs.c index 2f14c5d..96cdaa9 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3706,7 +3706,7 @@ procfs_fetch_registers (int regno) if ((regno >= 0 && regno < FP0_REGNUM) || regno == PC_REGNUM || (NPC_REGNUM >= 0 && regno == NPC_REGNUM) || - regno == FP_REGNUM || + regno == DEPRECATED_FP_REGNUM || regno == SP_REGNUM) return; /* not a floating point register */ @@ -3780,7 +3780,7 @@ procfs_store_registers (int regno) if ((regno >= 0 && regno < FP0_REGNUM) || regno == PC_REGNUM || (NPC_REGNUM >= 0 && regno == NPC_REGNUM) || - regno == FP_REGNUM || + regno == DEPRECATED_FP_REGNUM || regno == SP_REGNUM) return; /* not a floating point register */ diff --git a/gdb/regcache.c b/gdb/regcache.c index 70af06f..e0a0b89 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, read_fp, etc. Special handling for - registers PC, SP, and FP. */ +/* read_pc, write_pc, read_sp, deprecated_read_fp, etc. Special + handling for registers PC, SP, and FP. */ /* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(), read_pc_pid(), read_pc(), generic_target_write_pc(), write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(), - generic_target_write_sp(), 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(), and deprecated_read_fp(), will + eventually be moved out of the reg-cache into either frame.[hc] or + to the multi-arch framework. The are not part of the raw register + cache. */ /* This routine is getting awfully cluttered with #if's. It's probably time to turn this into READ_PC and define it in the tm.h file. @@ -1457,20 +1457,14 @@ generic_target_write_sp (CORE_ADDR val) } CORE_ADDR -generic_target_read_fp (void) +deprecated_read_fp (void) { -#ifdef FP_REGNUM - if (FP_REGNUM >= 0) - return read_register (FP_REGNUM); -#endif - internal_error (__FILE__, __LINE__, - "generic_target_read_fp"); -} - -CORE_ADDR -read_fp (void) -{ - return TARGET_READ_FP (); + if (DEPRECATED_TARGET_READ_FP_P ()) + return DEPRECATED_TARGET_READ_FP (); + else if (DEPRECATED_FP_REGNUM >= 0) + return read_register (DEPRECATED_FP_REGNUM); + else + internal_error (__FILE__, __LINE__, "deprecated_read_fp"); } /* ARGSUSED */ diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 49c7fb9..3b9a941 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -856,9 +856,9 @@ fetch_regs_from_dump (int (*nextchar) (), char *want) want++; break; #endif -#ifdef FP_REGNUM +#ifdef DEPRECATED_FP_REGNUM case 'f': - regno = FP_REGNUM; + regno = DEPRECATED_FP_REGNUM; want++; break; #endif diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index a23f72d..17994f9 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1802,8 +1802,8 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status) store_unsigned_integer (buf, REGISTER_RAW_SIZE (SP_REGNUM), rsp); supply_register (SP_REGNUM, buf); - store_unsigned_integer (buf, REGISTER_RAW_SIZE (FP_REGNUM), 0); - supply_register (FP_REGNUM, buf); + store_unsigned_integer (buf, REGISTER_RAW_SIZE (DEPRECATED_FP_REGNUM), 0); + supply_register (DEPRECATED_FP_REGNUM, buf); if (nfields == 9) { @@ -1943,9 +1943,9 @@ mips_fetch_registers (int regno) return; } - if (regno == FP_REGNUM || regno == ZERO_REGNUM) - /* FP_REGNUM on the mips is a hack which is just supposed to read - zero (see also mips-nat.c). */ + if (regno == DEPRECATED_FP_REGNUM || regno == ZERO_REGNUM) + /* DEPRECATED_FP_REGNUM on the mips is a hack which is just + supposed to read zero (see also mips-nat.c). */ val = 0; else { diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 9f55368..0192849 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2797,7 +2797,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, 64); set_gdbarch_sp_regnum (gdbarch, 1); - set_gdbarch_fp_regnum (gdbarch, 1); + set_gdbarch_deprecated_fp_regnum (gdbarch, 1); set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value); @@ -2830,7 +2830,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->ppc_ev31_regnum = 38; set_gdbarch_pc_regnum (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1); - set_gdbarch_fp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1); + set_gdbarch_deprecated_fp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, e500_dwarf2_reg_to_regnum); set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write); @@ -2872,7 +2872,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, generic_target_read_pc); 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_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 415fde7..f5a424d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -280,7 +280,7 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info, memset (gprs_saved, 0, sizeof (gprs_saved)); memset (fprs_saved, 0, sizeof (fprs_saved)); - info.read_memory_func = dis_asm_read_memory; + info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func; save_link_regidx = subtract_sp_regidx = 0; if (fextra_info) @@ -682,7 +682,7 @@ s390_check_function_end (CORE_ADDR pc) disassemble_info info; int regidx, instrlen; - info.read_memory_func = dis_asm_read_memory; + info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func; instrlen = s390_readinstruction (instr, pc, &info); if (instrlen < 0) return -1; @@ -819,7 +819,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi, scontext = temp_sregs = 0; - info.read_memory_func = dis_asm_read_memory; + info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func; instrlen = s390_readinstruction (instr, pc, &info); if (sigcaller_pc) *sigcaller_pc = 0; @@ -1658,7 +1658,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp, frame. This will help us get backtraces from within functions called from GDB. */ write_memory_unsigned_integer (sp, (TARGET_PTR_BIT / TARGET_CHAR_BIT), - read_fp ()); + deprecated_read_fp ()); return sp; } @@ -1841,7 +1841,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, s390_init_extra_frame_info); set_gdbarch_deprecated_init_frame_pc_first (gdbarch, s390_init_frame_pc_first); - set_gdbarch_read_fp (gdbarch, s390_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, s390_read_fp); /* This function that tells us whether the function invocation represented by FI does not have a frame on the stack associated with it. If it does not, FRAMELESS is set to 1, else 0. */ @@ -1856,7 +1856,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_byte (gdbarch, s390_register_byte); set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, S390_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, S390_FP_REGNUM); set_gdbarch_fp0_regnum (gdbarch, S390_FP0_REGNUM); set_gdbarch_num_regs (gdbarch, S390_NUM_REGS); set_gdbarch_cannot_fetch_register (gdbarch, s390_cannot_fetch_register); @@ -1925,8 +1925,8 @@ _initialize_s390_tdep (void) /* Hook us into the gdbarch mechanism. */ register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init); - if (!tm_print_insn) /* Someone may have already set it */ - tm_print_insn = gdb_print_insn_s390; + if (!deprecated_tm_print_insn) /* Someone may have already set it */ + deprecated_tm_print_insn = gdb_print_insn_s390; } #endif /* GDBSERVER */ diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 99a1fd5..1af501d 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -33,6 +33,7 @@ #include "source.h" #include "gdb_string.h" #include "gdbcore.h" +#include "infcall.h" extern void _initialize_scheme_language (void); static struct value *evaluate_subexp_scm (struct type *, struct expression *, diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 0390e95..6bb0237 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1003,7 +1003,7 @@ sh64_frame_chain (struct frame_info *frame) if (gdbarch_tdep (current_gdbarch)->sh_abi == SH_ABI_32) size = 4; else - size = REGISTER_RAW_SIZE (translate_insn_rn (FP_REGNUM, media_mode)); + size = REGISTER_RAW_SIZE (translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode)); return read_memory_integer (get_frame_base (frame) + get_frame_extra_info (frame)->f_offset, size); @@ -1172,7 +1172,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) { if (where[rn] >= 0) { - if (rn == FP_REGNUM) + if (rn == DEPRECATED_FP_REGNUM) have_fp = 1; get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4; @@ -1185,14 +1185,14 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) if (have_fp) { - get_frame_saved_regs (fi)[SP_REGNUM] = read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4); + get_frame_saved_regs (fi)[SP_REGNUM] = read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4); } else { get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4; } - get_frame_extra_info (fi)->f_offset = depth - where[FP_REGNUM] - 4; + get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4; /* Work out the return pc - either from the saved pr or the pr value */ } @@ -1477,7 +1477,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) /* The frame pointer register is general register 14 in shmedia and shcompact modes. In sh compact it is a pseudo register. Same goes for the stack pointer register, which is register 15. */ - fp_regnum = translate_insn_rn (FP_REGNUM, media_mode); + fp_regnum = translate_insn_rn (DEPRECATED_FP_REGNUM, media_mode); sp_regnum = translate_insn_rn (SP_REGNUM, media_mode); for (opc = pc + (insn_size * 28); pc < opc; pc += insn_size) @@ -1602,8 +1602,8 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) register r15 which still is the SP register. */ /* The place on the stack where fp is stored contains the sp of the caller. */ - /* Again, saved_registers contains only space for the real registers, - so we store in FP_REGNUM position. */ + /* Again, saved_registers contains only space for the real + registers, so we store in DEPRECATED_FP_REGNUM position. */ int size; if (tdep->sh_abi == SH_ABI_32) size = 4; @@ -1724,7 +1724,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) { if (where[rn] >= 0) { - if (rn == FP_REGNUM) + if (rn == DEPRECATED_FP_REGNUM) have_fp = 1; get_frame_saved_regs (fi)[rn] = get_frame_base (fi) - where[rn] + depth - 4; @@ -1738,14 +1738,14 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) if (have_fp) { get_frame_saved_regs (fi)[SP_REGNUM] = - read_memory_integer (get_frame_saved_regs (fi)[FP_REGNUM], 4); + read_memory_integer (get_frame_saved_regs (fi)[DEPRECATED_FP_REGNUM], 4); } else { get_frame_saved_regs (fi)[SP_REGNUM] = get_frame_base (fi) - 4; } - get_frame_extra_info (fi)->f_offset = depth - where[FP_REGNUM] - 4; + get_frame_extra_info (fi)->f_offset = depth - where[DEPRECATED_FP_REGNUM] - 4; /* Work out the return pc - either from the saved pr or the pr value */ } @@ -1763,8 +1763,8 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) { - /* We need to setup fi->frame here because run_stack_dummy gets it wrong - by assuming it's always FP. */ + /* We need to setup fi->frame here because call_function_by_hand + gets it wrong by assuming it's always FP. */ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM)); get_frame_extra_info (fi)->return_pc = deprecated_read_register_dummy (get_frame_pc (fi), @@ -1795,8 +1795,8 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) { - /* We need to setup fi->frame here because run_stack_dummy gets it wrong - by assuming it's always FP. */ + /* We need to setup fi->frame here because call_function_by_hand + gets it wrong by assuming it's always FP. */ deprecated_update_frame_base_hack (fi, deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), SP_REGNUM)); get_frame_extra_info (fi)->return_pc = deprecated_read_register_dummy (get_frame_pc (fi), @@ -1885,7 +1885,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, { int size; if (tdep->sh_abi == SH_ABI_32 - && (live_regnum == FP_REGNUM + && (live_regnum == DEPRECATED_FP_REGNUM || live_regnum == tdep->PR_REGNUM)) size = 4; else @@ -1993,7 +1993,7 @@ sh64_pop_frame (void) { int size; if (tdep->sh_abi == SH_ABI_32 - && (regnum == FP_REGNUM + && (regnum == DEPRECATED_FP_REGNUM || regnum == tdep->PR_REGNUM)) size = 4; else @@ -4365,7 +4365,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_num_regs (gdbarch, SH_DEFAULT_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, 15); - set_gdbarch_fp_regnum (gdbarch, 14); + set_gdbarch_deprecated_fp_regnum (gdbarch, 14); set_gdbarch_pc_regnum (gdbarch, 16); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4); @@ -4639,7 +4639,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_read_pc (gdbarch, generic_target_read_pc); 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_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index e1a0089..07c1269 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -51,8 +51,11 @@ #if (GDB_MULTI_ARCH > 0) -/* Does the target have Floating Point registers? */ -#define SPARC_HAS_FPU (gdbarch_tdep (current_gdbarch)->has_fpu) +#if 0 +// OBSOLETE /* Does the target have Floating Point registers? */ +// OBSOLETE #define SPARC_HAS_FPU (gdbarch_tdep (current_gdbarch)->has_fpu) +#endif +#define SPARC_HAS_FPU 1 /* Number of bytes devoted to Floating Point registers: */ #define FP_REGISTER_BYTES (gdbarch_tdep (current_gdbarch)->fp_register_bytes) /* Highest numbered Floating Point register. */ @@ -310,8 +313,8 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) : get_frame_base (get_next_frame (fi))) : read_sp ()); - /* If fi->next is NULL, then we already set ->frame by passing read_fp() - to create_new_frame. */ + /* If fi->next is NULL, then we already set ->frame by passing + deprecated_read_fp() to create_new_frame. */ if (get_next_frame (fi)) { char *buf; @@ -335,7 +338,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* Should we adjust for stack bias here? */ ULONGEST tmp; - frame_read_unsigned_register (fi, FP_REGNUM, &tmp); + frame_read_unsigned_register (fi, DEPRECATED_FP_REGNUM, &tmp); deprecated_update_frame_base_hack (fi, tmp); if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1)) deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047); @@ -1065,16 +1068,16 @@ sparc_push_dummy_frame (void) if (GDB_TARGET_IS_SPARC64) { /* Target is a 64 bit SPARC. */ - CORE_ADDR oldfp = read_register (FP_REGNUM); + CORE_ADDR oldfp = read_register (DEPRECATED_FP_REGNUM); if (oldfp & 1) - write_register (FP_REGNUM, old_sp - 2047); + write_register (DEPRECATED_FP_REGNUM, old_sp - 2047); else - write_register (FP_REGNUM, old_sp); + write_register (DEPRECATED_FP_REGNUM, old_sp); } else { /* Target is a 32 bit SPARC. */ - write_register (FP_REGNUM, old_sp); + write_register (DEPRECATED_FP_REGNUM, old_sp); } /* Set return address register for the call dummy to the current PC. */ write_register (I7_REGNUM, read_pc () - 8); @@ -1084,7 +1087,7 @@ sparc_push_dummy_frame (void) /* The call dummy will write this value to FP before executing the 'save'. This ensures that register window flushes work correctly in the simulator. */ - write_register (G0_REGNUM + 1, read_register (FP_REGNUM)); + write_register (G0_REGNUM + 1, read_register (DEPRECATED_FP_REGNUM)); /* The call dummy will write this value to FP after executing the 'save'. */ @@ -1096,7 +1099,7 @@ sparc_push_dummy_frame (void) /* Set the FP that the call dummy will be using after the 'save'. This makes backtraces from an inferior function call work properly. */ - write_register (FP_REGNUM, old_sp); + write_register (DEPRECATED_FP_REGNUM, old_sp); } } @@ -2379,10 +2382,11 @@ sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, Adjust the call_dummy_breakpoint_offset for the bp_call_dummy breakpoint to the proper address in the call dummy, so that `finish' after a stop in a call dummy works. - Tweeking current_gdbarch is not an optimal solution, but the call to - sparc_fix_call_dummy is immediately followed by a call to run_stack_dummy, - which is the only function where dummy_breakpoint_offset is actually - used, if it is non-zero. */ + + Tweeking current_gdbarch is not an optimal solution, but the call + to sparc_fix_call_dummy is immediately followed by a call to + call_function_by_hand, which is the only function where + dummy_breakpoint_offset is actually used, if it is non-zero. */ if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT || TYPE_CODE (value_type) == TYPE_CODE_UNION) { @@ -2459,8 +2463,8 @@ _initialize_sparc_tdep (void) /* Hook us into the gdbarch mechanism. */ gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep); - tm_print_insn = gdb_print_insn_sparc; - tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */ + deprecated_tm_print_insn = gdb_print_insn_sparc; + deprecated_tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */ /* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */ } @@ -2480,7 +2484,7 @@ sparc64_read_sp (void) CORE_ADDR sparc64_read_fp (void) { - CORE_ADDR fp = read_register (FP_REGNUM); + CORE_ADDR fp = read_register (DEPRECATED_FP_REGNUM); if (fp & 1) fp += 2047; @@ -2934,7 +2938,7 @@ static struct type * sparc32_register_virtual_type (int regno) { if (regno == PC_REGNUM || - regno == FP_REGNUM || + regno == DEPRECATED_FP_REGNUM || regno == SP_REGNUM) return builtin_type_unsigned_int; if (regno < 32) @@ -2948,7 +2952,7 @@ static struct type * sparc64_register_virtual_type (int regno) { if (regno == PC_REGNUM || - regno == FP_REGNUM || + regno == DEPRECATED_FP_REGNUM || regno == SP_REGNUM) return builtin_type_unsigned_long_long; if (regno < 32) @@ -3161,7 +3165,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address); set_gdbarch_fix_call_dummy (gdbarch, sparc_gdbarch_fix_call_dummy); set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, SPARC_FP_REGNUM); set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM); set_gdbarch_deprecated_frame_chain (gdbarch, sparc_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs); @@ -3277,7 +3281,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments); - set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_register_byte (gdbarch, sparc32_register_byte); @@ -3330,7 +3333,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_deprecated_push_arguments (gdbarch, sparc64_push_arguments); /* NOTE different for at_entry */ - set_gdbarch_read_fp (gdbarch, sparc64_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, sparc64_read_fp); set_gdbarch_read_sp (gdbarch, sparc64_read_sp); /* Some of the registers aren't 64 bits, but it's a lot simpler just to assume they all are (since most of them are). */ diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 6078d1a..9f6f9ac 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -74,20 +74,25 @@ value_of_builtin_frame_reg (struct frame_info *frame) static struct value * value_of_builtin_frame_fp_reg (struct frame_info *frame) { -#ifdef FP_REGNUM - if (FP_REGNUM >= 0) - return value_of_register (FP_REGNUM, frame); -#endif - { - struct value *val = allocate_value (builtin_type_void_data_ptr); - char *buf = VALUE_CONTENTS_RAW (val); - if (frame == NULL) - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); - else - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, - get_frame_base (frame)); - return val; - } + if (DEPRECATED_FP_REGNUM >= 0) + /* NOTE: cagney/2003-04-24: Since the mere presence of "fp" in the + register name table overrides this built-in $fp register, there + is no real reason for this DEPRECATED_FP_REGNUM trickery here. + An architecture wanting to implement "$fp" as alias for a raw + register can do so by adding "fp" to register name table (mind + you, doing this is probably a dangerous thing). */ + return value_of_register (DEPRECATED_FP_REGNUM, frame); + else + { + struct value *val = allocate_value (builtin_type_void_data_ptr); + char *buf = VALUE_CONTENTS_RAW (val); + if (frame == NULL) + memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + else + ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, + get_frame_base (frame)); + return val; + } } static struct value * diff --git a/gdb/symtab.c b/gdb/symtab.c index e144197..2c46f9d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -40,6 +40,7 @@ #include "linespec.h" #include "source.h" #include "filenames.h" /* for FILENAME_CMP */ +#include "objc-lang.h" #include "hashtab.h" @@ -459,6 +460,18 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, if (gsymbol->language == language_unknown) gsymbol->language = language_auto; + + if (gsymbol->language == language_objc + || gsymbol->language == language_auto) + { + demangled = + objc_demangle (mangled, 0); + if (demangled != NULL) + { + gsymbol->language = language_objc; + return demangled; + } + } if (gsymbol->language == language_cplus || gsymbol->language == language_auto) { @@ -607,7 +620,8 @@ symbol_init_demangled_name (struct general_symbol_info *gsymbol, demangled = symbol_find_demangled_name (gsymbol, mangled); if (gsymbol->language == language_cplus - || gsymbol->language == language_java) + || gsymbol->language == language_java + || gsymbol->language == language_objc) { if (demangled) { @@ -993,7 +1007,7 @@ lookup_symbol_aux (const char *name, const char *mangled_name, } #endif /* 0 */ - /* C++: If requested to do so by the caller, + /* C++/Java/Objective-C: If requested to do so by the caller, check to see if NAME is a field of `this'. */ if (is_a_field_of_this) { @@ -1653,9 +1667,9 @@ find_main_psymtab (void) for now we don't worry about the slight inefficiency of looking for a match we'll never find, since it will go pretty quick. Once the binary search terminates, we drop through and do a straight linear - search on the symbols. Each symbol which is marked as being a C++ - symbol (language_cplus set) has both the encoded and non-encoded names - tested for a match. + search on the symbols. Each symbol which is marked as being a ObjC/C++ + symbol (language_cplus or language_objc set) has both the encoded and + non-encoded names tested for a match. If MANGLED_NAME is non-NULL, verify that any symbol we find has this particular mangled name. diff --git a/gdb/target.h b/gdb/target.h index b3f43fc..e757b67 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -836,15 +836,15 @@ extern void target_load (char *arg, int from_tty); #define target_async(CALLBACK,CONTEXT) \ (current_target.to_async((CALLBACK), (CONTEXT))) -/* This is to be used ONLY within run_stack_dummy(). It - provides a workaround, to have inferior function calls done in - sychronous mode, even though the target is asynchronous. After +/* This is to be used ONLY within call_function_by_hand(). It provides + a workaround, to have inferior function calls done in sychronous + mode, even though the target is asynchronous. After target_async_mask(0) is called, calls to target_can_async_p() will return FALSE , so that target_resume() will not try to start the target asynchronously. After the inferior stops, we IMMEDIATELY restore the previous nature of the target, by calling target_async_mask(1). After that, target_can_async_p() will return - TRUE. ANY OTHER USE OF THIS FEATURE IS DEPRECATED. + TRUE. ANY OTHER USE OF THIS FEATURE IS DEPRECATED. FIXME ezannoni 1999-12-13: we won't need this once we move the turning async on and off to the single execution commands, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 7ace150..a77bef9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2003-04-27 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/signals.exp: Make backtrace tests more specific. + +2003-04-23 David Carlton <carlton@bactrian.org> + + * gdb.c++/maint.exp (test_first_component): Add tests for + 'operator' in more locations. + 2003-04-16 Kevin Buettner <kevinb@redhat.com> * gdb.base/args.exp: Invoke gdb_load for simulator targets. diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 2bf7192..be97455 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -185,7 +185,7 @@ proc signal_tests_1 {} { # #2, #3, or higher. At some point this should be fixed (but # it quite possibly would introduce new FAILs on some systems). setup_xfail "i*86-*-bsdi2.0" - gdb_test "backtrace 10" "#0.*handler.*#1.*#2.*main.*" \ + gdb_test "backtrace 10" "#0.*handler.*#1.*signal handler.*#2.* main .*" \ "backtrace in signals_tests_1" gdb_test "break func1" "Breakpoint \[0-9\]+ .*" @@ -415,7 +415,7 @@ The program being debugged stopped while in a function called from GDB.*" \ # But we should be able to backtrace... # On alpha-*-osf2.0 this test works when run manually but sometime fails when # run under dejagnu, making it very hard to debug the problem. Weird... - gdb_test "bt 10" "#0.*handler.*#1.*#2.*main.*" "bt in signals.exp" + gdb_test "bt 10" "#0.*handler.*#1.*signal handler.*#2.* main .*" "bt in signals.exp" # ...and continue... gdb_test "continue" "Continuing\\." "continue in signals.exp" # ...and then count should have been incremented diff --git a/gdb/testsuite/gdb.c++/maint.exp b/gdb/testsuite/gdb.c++/maint.exp index 6e1da97..a0f15f9 100644 --- a/gdb/testsuite/gdb.c++/maint.exp +++ b/gdb/testsuite/gdb.c++/maint.exp @@ -63,6 +63,18 @@ proc test_first_component {} { test_single_component "foo(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)" test_single_component "operator>(X::Y)" + # Operator names can show up in weird places. + + test_single_component "int operator<< <char>()" + test_single_component "T<Cooperator>" + + # NOTE: carlton/2003-04-23: I've only seen the first of these + # produced by the demangler, but I'm including two more just to be + # on the safe side. + test_single_component "int foo<&(operator<<(C, C))>()" + test_single_component "int foo<&operator<<(C, C)>()" + test_single_component "int foo<operator<<(C, C)>()" + gdb_test "maint cp first_component foo::bar" "foo" gdb_test "maint cp first_component foo::bar::baz" "foo" gdb_test "maint cp first_component C<A>::bar" "C<A>" diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 7069f96..3de8973 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,9 @@ +2003-04-30 Andrew Cagney <cagney@redhat.com> + + * tuiDisassem.c (tui_disassemble): Use + "deprecated_tm_print_insn_info" instead of TARGET_PRINT_INSN_INFO, + add comment. + 2003-03-14 Andrew Cagney <cagney@redhat.com> * tuiRegs.c (_tuiGetRegisterRawValue): Use frame_read_register, diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index 93d2df4..eaf75df 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -73,7 +73,11 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count) /* now init the ui_file structure */ gdb_dis_out = tui_sfileopen (256); - memcpy (&asm_info, TARGET_PRINT_INSN_INFO, sizeof (asm_info)); + /* FIXME: cagney/2003-04-28: Should instead be using the generic + disassembler but first need to clean that up and stop it trying + to access the exec file. */ + + memcpy (&asm_info, &deprecated_tm_print_insn_info, sizeof (asm_info)); asm_info.stream = gdb_dis_out; if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index de81056..a5b5fc6 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -614,7 +614,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) #ifdef DEBUG printf_filtered ("0x%.8lx ", (long) current_pc); - TARGET_PRINT_INSN (current_pc, &tm_print_insn_info); + TARGET_PRINT_INSN (current_pc, &deprecated_tm_print_insn_info); #endif insn = read_memory_unsigned_integer (current_pc, 2); @@ -1155,9 +1155,10 @@ v850_frame_init_saved_regs (struct frame_info *fi) be valid only if this routine uses FP. For previous frames, fi-frame will always be correct (since that is derived from v850_frame_chain ()). - We can be called with the PC in the call dummy under two circumstances. - First, during normal backtracing, second, while figuring out the frame - pointer just prior to calling the target function (see run_stack_dummy). */ + We can be called with the PC in the call dummy under two + circumstances. First, during normal backtracing, second, while + figuring out the frame pointer just prior to calling the target + function (see call_function_by_hand). */ static void v850_init_extra_frame_info (int fromleaf, struct frame_info *fi) @@ -1214,7 +1215,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach) { v850_register_names = v850_processor_type_table[i].regnames; - tm_print_insn_info.mach = info.bfd_arch_info->mach; + deprecated_tm_print_insn_info.mach = info.bfd_arch_info->mach; break; } } @@ -1225,7 +1226,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, E_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_register_name (gdbarch, v850_register_name); set_gdbarch_register_size (gdbarch, v850_reg_size); @@ -1237,7 +1238,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_max_register_virtual_size (gdbarch, v850_reg_size); set_gdbarch_register_virtual_type (gdbarch, v850_reg_virtual_type); - set_gdbarch_read_fp (gdbarch, v850_target_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, v850_target_read_fp); /* * Frame Info @@ -1295,6 +1296,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) void _initialize_v850_tdep (void) { - tm_print_insn = print_insn_v850; + deprecated_tm_print_insn = print_insn_v850; register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init); } diff --git a/gdb/valarith.c b/gdb/valarith.c index ed0fe05..854a151 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -31,6 +31,7 @@ #include "gdb_string.h" #include "doublest.h" #include <math.h> +#include "infcall.h" /* Define whether or not the C operator '/' truncates towards zero for differently signed operands (truncation direction is undefined in C). */ diff --git a/gdb/valops.c b/gdb/valops.c index a2a2e97..d8261c8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -34,6 +34,7 @@ #include "regcache.h" #include "cp-abi.h" #include "block.h" +#include "infcall.h" #include <errno.h> #include "gdb_string.h" @@ -49,10 +50,6 @@ extern int overload_debug; static int typecmp (int staticp, int varargs, int nargs, struct field t1[], struct value *t2[]); -static CORE_ADDR find_function_addr (struct value *, struct type **); -static struct value *value_arg_coerce (struct value *, struct type *, int); - - static CORE_ADDR value_push (CORE_ADDR, struct value *); static struct value *search_struct_field (char *, struct value *, int, @@ -84,37 +81,6 @@ static int auto_abandon = 0; int overload_resolution = 0; -/* This boolean tells what gdb should do if a signal is received while in - a function called from gdb (call dummy). If set, gdb unwinds the stack - and restore the context to what as it was before the call. - The default is to stop in the frame where the signal was received. */ - -int unwind_on_signal_p = 0; - -/* How you should pass arguments to a function depends on whether it - was defined in K&R style or prototype style. If you define a - function using the K&R syntax that takes a `float' argument, then - callers must pass that argument as a `double'. If you define the - function using the prototype syntax, then you must pass the - argument as a `float', with no promotion. - - Unfortunately, on certain older platforms, the debug info doesn't - indicate reliably how each function was defined. A function type's - TYPE_FLAG_PROTOTYPED flag may be clear, even if the function was - defined in prototype style. When calling a function whose - TYPE_FLAG_PROTOTYPED flag is clear, GDB consults this flag to decide - what to do. - - For modern targets, it is proper to assume that, if the prototype - flag is clear, that can be trusted: `float' arguments should be - promoted to `double'. For some older targets, if the prototype - flag is clear, that doesn't tell us anything. The default is to - trust the debug information; the user can override this behavior - with "set coerce-float-to-double 0". */ - -static int coerce_float_to_double; - - /* Find the address of function name NAME in the inferior. */ struct value * @@ -1089,774 +1055,6 @@ legacy_push_arguments (int nargs, struct value **args, CORE_ADDR sp, return sp; } -/* Perform the standard coercions that are specified - for arguments to be passed to C functions. - - If PARAM_TYPE is non-NULL, it is the expected parameter type. - IS_PROTOTYPED is non-zero if the function declaration is prototyped. */ - -static struct value * -value_arg_coerce (struct value *arg, struct type *param_type, - int is_prototyped) -{ - register struct type *arg_type = check_typedef (VALUE_TYPE (arg)); - register struct type *type - = param_type ? check_typedef (param_type) : arg_type; - - switch (TYPE_CODE (type)) - { - case TYPE_CODE_REF: - if (TYPE_CODE (arg_type) != TYPE_CODE_REF - && TYPE_CODE (arg_type) != TYPE_CODE_PTR) - { - arg = value_addr (arg); - VALUE_TYPE (arg) = param_type; - return arg; - } - break; - case TYPE_CODE_INT: - case TYPE_CODE_CHAR: - case TYPE_CODE_BOOL: - case TYPE_CODE_ENUM: - /* If we don't have a prototype, coerce to integer type if necessary. */ - if (!is_prototyped) - { - if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_int)) - type = builtin_type_int; - } - /* Currently all target ABIs require at least the width of an integer - type for an argument. We may have to conditionalize the following - type coercion for future targets. */ - if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_int)) - type = builtin_type_int; - break; - case TYPE_CODE_FLT: - if (!is_prototyped && coerce_float_to_double) - { - if (TYPE_LENGTH (type) < TYPE_LENGTH (builtin_type_double)) - type = builtin_type_double; - else if (TYPE_LENGTH (type) > TYPE_LENGTH (builtin_type_double)) - type = builtin_type_long_double; - } - break; - case TYPE_CODE_FUNC: - type = lookup_pointer_type (type); - break; - case TYPE_CODE_ARRAY: - /* Arrays are coerced to pointers to their first element, unless - they are vectors, in which case we want to leave them alone, - because they are passed by value. */ - if (current_language->c_style_arrays) - if (!TYPE_VECTOR (type)) - type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); - break; - case TYPE_CODE_UNDEF: - case TYPE_CODE_PTR: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_VOID: - case TYPE_CODE_SET: - case TYPE_CODE_RANGE: - case TYPE_CODE_STRING: - case TYPE_CODE_BITSTRING: - case TYPE_CODE_ERROR: - case TYPE_CODE_MEMBER: - case TYPE_CODE_METHOD: - case TYPE_CODE_COMPLEX: - default: - break; - } - - return value_cast (type, arg); -} - -/* Determine a function's address and its return type from its value. - Calls error() if the function is not valid for calling. */ - -static CORE_ADDR -find_function_addr (struct value *function, struct type **retval_type) -{ - register struct type *ftype = check_typedef (VALUE_TYPE (function)); - register enum type_code code = TYPE_CODE (ftype); - struct type *value_type; - CORE_ADDR funaddr; - - /* If it's a member function, just look at the function - part of it. */ - - /* Determine address to call. */ - if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) - { - funaddr = VALUE_ADDRESS (function); - value_type = TYPE_TARGET_TYPE (ftype); - } - else if (code == TYPE_CODE_PTR) - { - funaddr = value_as_address (function); - ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); - if (TYPE_CODE (ftype) == TYPE_CODE_FUNC - || TYPE_CODE (ftype) == TYPE_CODE_METHOD) - { - funaddr = CONVERT_FROM_FUNC_PTR_ADDR (funaddr); - value_type = TYPE_TARGET_TYPE (ftype); - } - else - value_type = builtin_type_int; - } - else if (code == TYPE_CODE_INT) - { - /* Handle the case of functions lacking debugging info. - Their values are characters since their addresses are char */ - if (TYPE_LENGTH (ftype) == 1) - funaddr = value_as_address (value_addr (function)); - else - /* Handle integer used as address of a function. */ - funaddr = (CORE_ADDR) value_as_long (function); - - value_type = builtin_type_int; - } - else - error ("Invalid data type for function to be called."); - - *retval_type = value_type; - return funaddr; -} - -/* All this stuff with a dummy frame may seem unnecessarily complicated - (why not just save registers in GDB?). The purpose of pushing a dummy - frame which looks just like a real frame is so that if you call a - function and then hit a breakpoint (get a signal, etc), "backtrace" - will look right. Whether the backtrace needs to actually show the - stack at the time the inferior function was called is debatable, but - it certainly needs to not display garbage. So if you are contemplating - making dummy frames be different from normal frames, consider that. */ - -/* Perform a function call in the inferior. - ARGS is a vector of values of arguments (NARGS of them). - FUNCTION is a value, the function to be called. - Returns a value representing what the function returned. - May fail to return, if a breakpoint or signal is hit - during the execution of the function. - - ARGS is modified to contain coerced values. */ - -struct value * -call_function_by_hand (struct value *function, int nargs, struct value **args) -{ - register CORE_ADDR sp; - register int i; - int rc; - CORE_ADDR start_sp; - /* CALL_DUMMY is an array of words (REGISTER_SIZE), but each word - is in host byte order. Before calling FIX_CALL_DUMMY, we byteswap it - and remove any extra bytes which might exist because ULONGEST is - bigger than REGISTER_SIZE. - - NOTE: This is pretty wierd, as the call dummy is actually a - sequence of instructions. But CISC machines will have - to pack the instructions into REGISTER_SIZE units (and - so will RISC machines for which INSTRUCTION_SIZE is not - REGISTER_SIZE). - - NOTE: This is pretty stupid. CALL_DUMMY should be in strict - target byte order. */ - - static ULONGEST *dummy; - int sizeof_dummy1; - char *dummy1; - CORE_ADDR dummy_addr; - CORE_ADDR old_sp; - struct type *value_type; - unsigned char struct_return; - CORE_ADDR struct_addr = 0; - struct regcache *retbuf; - struct cleanup *retbuf_cleanup; - struct inferior_status *inf_status; - struct cleanup *inf_status_cleanup; - CORE_ADDR funaddr; - int using_gcc; /* Set to version of gcc in use, or zero if not gcc */ - CORE_ADDR real_pc; - struct type *param_type = NULL; - struct type *ftype = check_typedef (SYMBOL_TYPE (function)); - int n_method_args = 0; - - dummy = alloca (SIZEOF_CALL_DUMMY_WORDS); - sizeof_dummy1 = REGISTER_SIZE * SIZEOF_CALL_DUMMY_WORDS / sizeof (ULONGEST); - dummy1 = alloca (sizeof_dummy1); - memcpy (dummy, CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS); - - if (!target_has_execution) - noprocess (); - - /* Create a cleanup chain that contains the retbuf (buffer - containing the register values). This chain is create BEFORE the - inf_status chain so that the inferior status can cleaned up - (restored or discarded) without having the retbuf freed. */ - retbuf = regcache_xmalloc (current_gdbarch); - retbuf_cleanup = make_cleanup_regcache_xfree (retbuf); - - /* A cleanup for the inferior status. Create this AFTER the retbuf - so that this can be discarded or applied without interfering with - the regbuf. */ - inf_status = save_inferior_status (1); - inf_status_cleanup = make_cleanup_restore_inferior_status (inf_status); - - if (DEPRECATED_PUSH_DUMMY_FRAME_P ()) - { - /* DEPRECATED_PUSH_DUMMY_FRAME is responsible for saving the - inferior registers (and frame_pop() for restoring them). (At - least on most machines) they are saved on the stack in the - inferior. */ - DEPRECATED_PUSH_DUMMY_FRAME; - } - else - { - /* FIXME: cagney/2003-02-26: Step zero of this little tinker is - to extract the generic dummy frame code from the architecture - vector. Hence this direct call. - - A follow-on change is to modify this interface so that it takes - thread OR frame OR tpid as a parameter, and returns a dummy - frame handle. The handle can then be used further down as a - parameter SAVE_DUMMY_FRAME_TOS. Hmm, thinking about it, since - everything is ment to be using generic dummy frames, why not - even use some of the dummy frame code to here - do a regcache - dup and then pass the duped regcache, along with all the other - stuff, at one single point. - - In fact, you can even save the structure's return address in the - dummy frame and fix one of those nasty lost struct return edge - conditions. */ - generic_push_dummy_frame (); - } - - old_sp = read_sp (); - - /* Ensure that the initial SP is correctly aligned. */ - if (gdbarch_frame_align_p (current_gdbarch)) - { - /* NOTE: cagney/2002-09-18: - - On a RISC architecture, a void parameterless generic dummy - frame (i.e., no parameters, no result) typically does not - need to push anything the stack and hence can leave SP and - FP. Similarly, a framelss (possibly leaf) function does not - push anything on the stack and, hence, that too can leave FP - and SP unchanged. As a consequence, a sequence of void - parameterless generic dummy frame calls to frameless - functions will create a sequence of effectively identical - frames (SP, FP and TOS and PC the same). This, not - suprisingly, results in what appears to be a stack in an - infinite loop --- when GDB tries to find a generic dummy - frame on the internal dummy frame stack, it will always find - the first one. - - To avoid this problem, the code below always grows the stack. - That way, two dummy frames can never be identical. It does - burn a few bytes of stack but that is a small price to pay - :-). */ - sp = gdbarch_frame_align (current_gdbarch, old_sp); - if (sp == old_sp) - { - if (INNER_THAN (1, 2)) - /* Stack grows down. */ - sp = gdbarch_frame_align (current_gdbarch, old_sp - 1); - else - /* Stack grows up. */ - sp = gdbarch_frame_align (current_gdbarch, old_sp + 1); - } - gdb_assert ((INNER_THAN (1, 2) && sp <= old_sp) - || (INNER_THAN (2, 1) && sp >= old_sp)); - } - else - /* FIXME: cagney/2002-09-18: Hey, you loose! Who knows how badly - aligned the SP is! Further, per comment above, if the generic - dummy frame ends up empty (because nothing is pushed) GDB won't - be able to correctly perform back traces. If a target is - having trouble with backtraces, first thing to do is add - FRAME_ALIGN() to its architecture vector. After that, try - adding SAVE_DUMMY_FRAME_TOS() and modifying - DEPRECATED_FRAME_CHAIN so that when the next outer frame is a - generic dummy, it returns the current frame's base. */ - sp = old_sp; - - if (INNER_THAN (1, 2)) - { - /* Stack grows down */ - sp -= sizeof_dummy1; - start_sp = sp; - } - else - { - /* Stack grows up */ - start_sp = sp; - sp += sizeof_dummy1; - } - - /* NOTE: cagney/2002-09-10: Don't bother re-adjusting the stack - after allocating space for the call dummy. A target can specify - a SIZEOF_DUMMY1 (via SIZEOF_CALL_DUMMY_WORDS) such that all local - alignment requirements are met. */ - - funaddr = find_function_addr (function, &value_type); - CHECK_TYPEDEF (value_type); - - { - struct block *b = block_for_pc (funaddr); - /* If compiled without -g, assume GCC 2. */ - using_gcc = (b == NULL ? 2 : BLOCK_GCC_COMPILED (b)); - } - - /* Are we returning a value using a structure return or a normal - value return? */ - - struct_return = using_struct_return (function, funaddr, value_type, - using_gcc); - - /* Create a call sequence customized for this function - and the number of arguments for it. */ - for (i = 0; i < (int) (SIZEOF_CALL_DUMMY_WORDS / sizeof (dummy[0])); i++) - store_unsigned_integer (&dummy1[i * REGISTER_SIZE], - REGISTER_SIZE, - (ULONGEST) dummy[i]); - -#ifdef GDB_TARGET_IS_HPPA - real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, - value_type, using_gcc); -#else - 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 - - 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); - 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 - sp = old_sp; /* It really is used, for some ifdef's... */ -#endif - - if (nargs < TYPE_NFIELDS (ftype)) - error ("too few arguments in function call"); - - for (i = nargs - 1; i >= 0; i--) - { - int prototyped; - - /* FIXME drow/2002-05-31: Should just always mark methods as - prototyped. Can we respect TYPE_VARARGS? Probably not. */ - if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) - prototyped = 1; - else - prototyped = TYPE_PROTOTYPED (ftype); - - if (i < TYPE_NFIELDS (ftype)) - args[i] = value_arg_coerce (args[i], TYPE_FIELD_TYPE (ftype, i), - prototyped); - else - args[i] = value_arg_coerce (args[i], NULL, 0); - - /*elz: this code is to handle the case in which the function to be called - has a pointer to function as parameter and the corresponding actual argument - is the address of a function and not a pointer to function variable. - In aCC compiled code, the calls through pointers to functions (in the body - of the function called by hand) are made via $$dyncall_external which - requires some registers setting, this is taken care of if we call - via a function pointer variable, but not via a function address. - In cc this is not a problem. */ - - if (using_gcc == 0) - if (param_type && TYPE_CODE (ftype) != TYPE_CODE_METHOD) - /* if this parameter is a pointer to function */ - if (TYPE_CODE (param_type) == TYPE_CODE_PTR) - if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC) - /* elz: FIXME here should go the test about the compiler used - to compile the target. We want to issue the error - message only if the compiler used was HP's aCC. - If we used HP's cc, then there is no problem and no need - to return at this point */ - if (using_gcc == 0) /* && compiler == aCC */ - /* go see if the actual parameter is a variable of type - pointer to function or just a function */ - if (args[i]->lval == not_lval) - { - char *arg_name; - if (find_pc_partial_function ((CORE_ADDR) args[i]->aligner.contents[0], &arg_name, NULL, NULL)) - error ("\ -You cannot use function <%s> as argument. \n\ -You must use a pointer to function type variable. Command ignored.", arg_name); - } - } - - if (REG_STRUCT_HAS_ADDR_P ()) - { - /* This is a machine like the sparc, where we may need to pass a - pointer to the structure, not the structure itself. */ - for (i = nargs - 1; i >= 0; i--) - { - struct type *arg_type = check_typedef (VALUE_TYPE (args[i])); - if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT - || TYPE_CODE (arg_type) == TYPE_CODE_UNION - || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY - || TYPE_CODE (arg_type) == TYPE_CODE_STRING - || TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING - || TYPE_CODE (arg_type) == TYPE_CODE_SET - || (TYPE_CODE (arg_type) == TYPE_CODE_FLT - && TYPE_LENGTH (arg_type) > 8) - ) - && REG_STRUCT_HAS_ADDR (using_gcc, arg_type)) - { - CORE_ADDR addr; - int len; /* = TYPE_LENGTH (arg_type); */ - int aligned_len; - arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i])); - len = TYPE_LENGTH (arg_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. */ - aligned_len = STACK_ALIGN (len); - else - aligned_len = len; - if (INNER_THAN (1, 2)) - { - /* stack grows downward */ - sp -= aligned_len; - /* ... so the address of the thing we push is the - stack pointer after we push it. */ - addr = sp; - } - else - { - /* The stack grows up, so the address of the thing - we push is the stack pointer before we push it. */ - addr = sp; - sp += aligned_len; - } - /* Push the structure. */ - write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len); - /* The value we're going to pass is the address of the - thing we just pushed. */ - /*args[i] = value_from_longest (lookup_pointer_type (value_type), - (LONGEST) addr); */ - args[i] = value_from_pointer (lookup_pointer_type (arg_type), - addr); - } - } - } - - - /* Reserve space for the return structure to be written on the - stack, if necessary. Make certain that the value is correctly - aligned. */ - - if (struct_return) - { - int len = TYPE_LENGTH (value_type); - if (STACK_ALIGN_P ()) - /* 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)) - { - /* Stack grows downward. Align STRUCT_ADDR and SP after - making space for the return value. */ - sp -= len; - if (gdbarch_frame_align_p (current_gdbarch)) - sp = gdbarch_frame_align (current_gdbarch, sp); - struct_addr = sp; - } - else - { - /* Stack grows upward. Align the frame, allocate space, and - then again, re-align the frame??? */ - if (gdbarch_frame_align_p (current_gdbarch)) - sp = gdbarch_frame_align (current_gdbarch, sp); - struct_addr = sp; - sp += len; - if (gdbarch_frame_align_p (current_gdbarch)) - sp = gdbarch_frame_align (current_gdbarch, sp); - } - } - - /* elz: on HPPA no need for this extra alignment, maybe it is needed - on other architectures. This is because all the alignment is - taken care of in the above code (ifdef REG_STRUCT_HAS_ADDR) and - in hppa_push_arguments */ - /* NOTE: cagney/2003-03-24: The below code is very broken. Given an - odd sized parameter the below will mis-align the stack. As was - suggested back in '96, better to let PUSH_ARGUMENTS handle it. */ - 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_dummy_call() adjust the - stack in a target-defined manner. */ - if (STACK_ALIGN_P () && INNER_THAN (1, 2)) - { - /* If stack grows down, we must leave a hole at the top. */ - int len = 0; - - for (i = nargs - 1; i >= 0; i--) - len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i])); - if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) - len += DEPRECATED_CALL_DUMMY_STACK_ADJUST; - sp -= STACK_ALIGN (len) - len; - } - } - - /* 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 (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 - save the machine state, push the arguments, and jump directly - to the callee function. Since this doesn't actually involve - executing a JSR/BSR instruction, the return address must be set - up by hand, either by pushing onto the stack or copying into a - 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 = DEPRECATED_PUSH_RETURN_ADDRESS (real_pc, sp); - - /* 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! */ - if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) - sp += DEPRECATED_CALL_DUMMY_STACK_ADJUST; - sp = STACK_ALIGN (sp); - } - -/* XXX This seems wrong. For stacks that grow down we shouldn't do - anything here! */ - /* 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. */ - if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) - if (INNER_THAN (1, 2)) - { - /* stack grows downward */ - sp -= DEPRECATED_CALL_DUMMY_STACK_ADJUST; - } - - /* Store the address at which the structure is supposed to be - written. */ - /* NOTE: 2003-03-24: Since PUSH_ARGUMENTS can (and typically does) - store the struct return address, this call is entirely redundant. */ - if (struct_return && DEPRECATED_STORE_STRUCT_RETURN_P ()) - DEPRECATED_STORE_STRUCT_RETURN (struct_addr, sp); - - /* Write the stack pointer. This is here because the statements above - 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.) */ - /* 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); - - { - char *name; - struct symbol *symbol; - - name = NULL; - symbol = find_pc_function (funaddr); - if (symbol) - { - name = SYMBOL_PRINT_NAME (symbol); - } - else - { - /* Try the minimal symbols. */ - struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (funaddr); - - if (msymbol) - { - name = SYMBOL_PRINT_NAME (msymbol); - } - } - if (name == NULL) - { - char format[80]; - sprintf (format, "at %s", local_hex_format ()); - name = alloca (80); - /* FIXME-32x64: assumes funaddr fits in a long. */ - sprintf (name, format, (unsigned long) funaddr); - } - - /* Execute the stack dummy routine, calling FUNCTION. - When it is done, discard the empty frame - after storing the contents of all regs into retbuf. */ - rc = run_stack_dummy (real_pc + CALL_DUMMY_START_OFFSET, retbuf); - - if (rc == 1) - { - /* We stopped inside the FUNCTION because of a random signal. - Further execution of the FUNCTION is not allowed. */ - - if (unwind_on_signal_p) - { - /* The user wants the context restored. */ - - /* We must get back to the frame we were before the dummy - call. */ - frame_pop (get_current_frame ()); - - /* FIXME: Insert a bunch of wrap_here; name can be very long if it's - a C++ name with arguments and stuff. */ - error ("\ -The program being debugged was signaled while in a function called from GDB.\n\ -GDB has restored the context to what it was before the call.\n\ -To change this behavior use \"set unwindonsignal off\"\n\ -Evaluation of the expression containing the function (%s) will be abandoned.", - name); - } - else - { - /* The user wants to stay in the frame where we stopped (default).*/ - - /* If we restored the inferior status (via the cleanup), - we would print a spurious error message (Unable to - restore previously selected frame), would write the - registers from the inf_status (which is wrong), and - would do other wrong things. */ - discard_cleanups (inf_status_cleanup); - discard_inferior_status (inf_status); - - /* FIXME: Insert a bunch of wrap_here; name can be very long if it's - a C++ name with arguments and stuff. */ - error ("\ -The program being debugged was signaled while in a function called from GDB.\n\ -GDB remains in the frame where the signal was received.\n\ -To change this behavior use \"set unwindonsignal on\"\n\ -Evaluation of the expression containing the function (%s) will be abandoned.", - name); - } - } - - if (rc == 2) - { - /* We hit a breakpoint inside the FUNCTION. */ - - /* If we restored the inferior status (via the cleanup), we - would print a spurious error message (Unable to restore - previously selected frame), would write the registers from - the inf_status (which is wrong), and would do other wrong - things. */ - discard_cleanups (inf_status_cleanup); - discard_inferior_status (inf_status); - - /* The following error message used to say "The expression - which contained the function call has been discarded." It - is a hard concept to explain in a few words. Ideally, GDB - would be able to resume evaluation of the expression when - the function finally is done executing. Perhaps someday - this will be implemented (it would not be easy). */ - - /* FIXME: Insert a bunch of wrap_here; name can be very long if it's - a C++ name with arguments and stuff. */ - error ("\ -The program being debugged stopped while in a function called from GDB.\n\ -When the function (%s) is done executing, GDB will silently\n\ -stop (instead of continuing to evaluate the expression containing\n\ -the function call).", name); - } - - /* If we get here the called FUNCTION run to completion. */ - - /* Restore the inferior status, via its cleanup. At this stage, - leave the RETBUF alone. */ - do_cleanups (inf_status_cleanup); - - /* Figure out the value returned by the function. */ - /* elz: I defined this new macro for the hppa architecture only. - this gives us a way to get the value returned by the function - from the stack, at the same address we told the function to put - it. We cannot assume on the pa that r28 still contains the - address of the returned structure. Usually this will be - overwritten by the callee. I don't know about other - architectures, so I defined this macro */ -#ifdef VALUE_RETURNED_FROM_STACK - if (struct_return) - { - do_cleanups (retbuf_cleanup); - return VALUE_RETURNED_FROM_STACK (value_type, struct_addr); - } -#endif - /* NOTE: cagney/2002-09-10: Only when the stack has been correctly - aligned (using frame_align()) do we can trust STRUCT_ADDR and - fetch the return value direct from the stack. This lack of - trust comes about because legacy targets have a nasty habit of - silently, and local to PUSH_ARGUMENTS(), moving STRUCT_ADDR. - For such targets, just hope that value_being_returned() can - find the adjusted value. */ - if (struct_return && gdbarch_frame_align_p (current_gdbarch)) - { - struct value *retval = value_at (value_type, struct_addr, NULL); - do_cleanups (retbuf_cleanup); - return retval; - } - else - { - struct value *retval = value_being_returned (value_type, retbuf, - struct_return); - do_cleanups (retbuf_cleanup); - return retval; - } - } -} - /* 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. @@ -3485,29 +2683,4 @@ _initialize_valops (void) &setlist), &showlist); overload_resolution = 1; - - add_show_from_set ( - add_set_cmd ("unwindonsignal", no_class, var_boolean, - (char *) &unwind_on_signal_p, -"Set unwinding of stack if a signal is received while in a call dummy.\n\ -The unwindonsignal lets the user determine what gdb should do if a signal\n\ -is received while in a function called from gdb (call dummy). If set, gdb\n\ -unwinds the stack and restore the context to what as it was before the call.\n\ -The default is to stop in the frame where the signal was received.", &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("coerce-float-to-double", class_obscure, var_boolean, - (char *) &coerce_float_to_double, - "Set coercion of floats to doubles when calling functions\n" - "Variables of type float should generally be converted to doubles before\n" - "calling an unprototyped function, and left alone when calling a prototyped\n" - "function. However, some older debug info formats do not provide enough\n" - "information to determine that a function is prototyped. If this flag is\n" - "set, GDB will perform the conversion for a function it considers\n" - "unprototyped.\n" - "The default is to perform the conversion.\n", - &setlist), - &showlist); - coerce_float_to_double = 1; } diff --git a/gdb/value.h b/gdb/value.h index ad488a7..54854e5 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -549,9 +549,6 @@ extern struct value *varying_to_slice (struct value *); extern struct value *value_slice (struct value *, int, int); -extern struct value *call_function_by_hand (struct value *, int, - struct value **); - extern struct value *value_literal_complex (struct value *, struct value *, struct type *); diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 859e2b3..4f1fcc9 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -143,12 +143,12 @@ vax_frame_init_saved_regs (struct frame_info *frame) } get_frame_saved_regs (frame)[SP_REGNUM] = next_addr + 4; - if (regmask & (1 << FP_REGNUM)) + if (regmask & (1 << DEPRECATED_FP_REGNUM)) get_frame_saved_regs (frame)[SP_REGNUM] += 4 + (4 * read_memory_integer (next_addr + 4, 4)); get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 16; - get_frame_saved_regs (frame)[FP_REGNUM] = get_frame_base (frame) + 12; + get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = get_frame_base (frame) + 12; get_frame_saved_regs (frame)[VAX_AP_REGNUM] = get_frame_base (frame) + 8; get_frame_saved_regs (frame)[PS_REGNUM] = get_frame_base (frame) + 4; } @@ -252,19 +252,19 @@ vax_push_dummy_frame (void) for (regnum = 11; regnum >= 0; regnum--) sp = push_word (sp, read_register (regnum)); sp = push_word (sp, read_register (PC_REGNUM)); - sp = push_word (sp, read_register (FP_REGNUM)); + sp = push_word (sp, read_register (DEPRECATED_FP_REGNUM)); sp = push_word (sp, read_register (VAX_AP_REGNUM)); sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000); sp = push_word (sp, 0); write_register (SP_REGNUM, sp); - write_register (FP_REGNUM, sp); + write_register (DEPRECATED_FP_REGNUM, sp); write_register (VAX_AP_REGNUM, sp + (17 * 4)); } static void vax_pop_frame (void) { - CORE_ADDR fp = read_register (FP_REGNUM); + CORE_ADDR fp = read_register (DEPRECATED_FP_REGNUM); int regnum; int regmask = read_memory_integer (fp + 4, 4); @@ -272,7 +272,7 @@ vax_pop_frame (void) (regmask & 0xffff) | (read_register (PS_REGNUM) & 0xffff0000)); write_register (PC_REGNUM, read_memory_integer (fp + 16, 4)); - write_register (FP_REGNUM, read_memory_integer (fp + 12, 4)); + write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp + 12, 4)); write_register (VAX_AP_REGNUM, read_memory_integer (fp + 8, 4)); fp += 16; for (regnum = 0; regnum < 12; regnum++) @@ -622,7 +622,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Register info */ set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, VAX_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, VAX_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM); set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM); @@ -696,5 +696,5 @@ _initialize_vax_tdep (void) { gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL); - tm_print_insn = vax_print_insn; + deprecated_tm_print_insn = vax_print_insn; } diff --git a/gdb/version.in b/gdb/version.in index 47a3e49..08b7d9e 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-04-19-cvs +2003-04-30-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index f3c08e3..5872d54 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -935,7 +935,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Register numbers of various important registers. */ set_gdbarch_sp_regnum (gdbarch, 7); /* %rsp */ - set_gdbarch_fp_regnum (gdbarch, 6); /* %rbp */ + set_gdbarch_deprecated_fp_regnum (gdbarch, 6); /* %rbp */ set_gdbarch_pc_regnum (gdbarch, 16); /* %rip */ set_gdbarch_ps_regnum (gdbarch, 17); /* %eflags */ set_gdbarch_fp0_regnum (gdbarch, X86_64_NUM_GREGS); /* %st(0) */ @@ -977,7 +977,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_deprecated_get_saved_register (gdbarch, cfi_get_saved_register); /* FIXME: kettenis/20021026: Should we set parm_boundary to 64 here? */ - set_gdbarch_read_fp (gdbarch, cfi_read_fp); + set_gdbarch_deprecated_target_read_fp (gdbarch, cfi_read_fp); set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 2d3b7af..1ff96a4 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1035,7 +1035,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_num_regs (gdbarch, E_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, 0); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); - set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_register_name (gdbarch, xstormy16_register_name); set_gdbarch_register_size (gdbarch, xstormy16_reg_size); @@ -1130,5 +1130,5 @@ _initialize_xstormy16_tdep (void) extern int print_insn_xstormy16 (); register_gdbarch_init (bfd_arch_xstormy16, xstormy16_gdbarch_init); - tm_print_insn = print_insn_xstormy16; + deprecated_tm_print_insn = print_insn_xstormy16; } diff --git a/include/ChangeLog b/include/ChangeLog index 37bf713..6d18714 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +2003-04-28 H.J. Lu <hjl@gnu.org> + + * bfdlink.h (bfd_link_info): Add relax_finalizing. + +2003-04-23 H.J. Lu <hjl@gnu.org> + + * bfdlink.h (bfd_link_callbacks): Add error_handler. + 2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com> * coff/tic4x.h: Namespace cleanup. Replace s/c4x/tic4x diff --git a/include/bfdlink.h b/include/bfdlink.h index c258262..380923a 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -288,6 +288,9 @@ struct bfd_link_info /* TRUE if global symbols in discarded sections should be stripped. */ unsigned int strip_discarded: 1; + /* TRUE if relaxation is being finalized. */ + unsigned int relax_finalizing: 1; + /* Which symbols to strip. */ enum bfd_link_strip strip; @@ -481,6 +484,11 @@ struct bfd_link_callbacks bfd_boolean (*notice) PARAMS ((struct bfd_link_info *, const char *name, bfd *abfd, asection *section, bfd_vma address)); + /* A function which is called for reporting a linker error. ID is the + error identifier. The remaining input is the same as einfo () in + ld. */ + bfd_boolean (*error_handler) + PARAMS ((int id, const char * fmt, ...)); }; /* The linker builds link_order structures which tell the code how to diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 353eb59..b6db306 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,8 @@ +2003-04-24 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * coff/h8300.h (H8300HNMAGIC, H8300SNMAGIC): New. + (H8300HNBADMAG, H8300SNBADMAG): New. + 2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> * sh.h: Replace occurrances of 'Hitachi' with 'Renesas'. diff --git a/include/coff/h8300.h b/include/coff/h8300.h index c30dc00..908848c 100644 --- a/include/coff/h8300.h +++ b/include/coff/h8300.h @@ -22,12 +22,16 @@ #define H8300MAGIC 0x8300 #define H8300HMAGIC 0x8301 #define H8300SMAGIC 0x8302 +#define H8300HNMAGIC 0x8303 +#define H8300SNMAGIC 0x8304 -#define H8300BADMAG(x) (((x).f_magic != H8300MAGIC)) -#define H8300HBADMAG(x) (((x).f_magic != H8300HMAGIC)) -#define H8300SBADMAG(x) (((x).f_magic != H8300SMAGIC)) +#define H8300BADMAG(x) (((x).f_magic != H8300MAGIC)) +#define H8300HBADMAG(x) (((x).f_magic != H8300HMAGIC)) +#define H8300SBADMAG(x) (((x).f_magic != H8300SMAGIC)) +#define H8300HNBADMAG(x) (((x).f_magic != H8300HNMAGIC)) +#define H8300SNBADMAG(x) (((x).f_magic != H8300SNMAGIC)) -/********************** RELOCATION DIRECTIVES **********************/ +/* Relocation directives. */ /* The external reloc has an offset field, because some of the reloc types on the h8 don't have room in the instruction for the entire diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index b84eac5..945ce63 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,16 @@ +2003-04-24 Dhananjay Deshpande <dhananjayd@kpitcummins.com> + + * elf/h8.h (E_H8_MACH_H8300HN, E_H8_MACH_H8300SN): New + +2003-04-23 J"orn Rennecke <joern.rennecke@superh.com> + + * common.h (EM_SH): Amend comment to refer to SuperH. + +2003-04-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * common.h: Replace references to Mitsubishi M32R with + references to Renesas M32R. + 2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> * common.h: Replace occurrances of 'Hitachi' with 'Renesas'. diff --git a/include/elf/common.h b/include/elf/common.h index 02665b7..ca79342 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -126,7 +126,7 @@ #define EM_RCE 39 /* Old name for MCore */ #define EM_ARM 40 /* ARM */ #define EM_OLD_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Renesas (formerly Hitachi) SH */ +#define EM_SH 42 /* Renesas (formerly Hitachi) / SuperH SH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_TRICORE 44 /* Siemens Tricore embedded processor */ #define EM_ARC 45 /* ARC Cores */ @@ -172,7 +172,7 @@ #define EM_D10V 85 /* Mitsubishi D10V */ #define EM_D30V 86 /* Mitsubishi D30V */ #define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_M32R 88 /* Renesas M32R (formerly Mitsubishi M32R) */ #define EM_MN10300 89 /* Matsushita MN10300 */ #define EM_MN10200 90 /* Matsushita MN10200 */ #define EM_PJ 91 /* picoJava */ diff --git a/include/elf/h8.h b/include/elf/h8.h index ac9db56..5fdf62c 100644 --- a/include/elf/h8.h +++ b/include/elf/h8.h @@ -1,5 +1,5 @@ /* H8300/h8500 ELF support for BFD. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -92,5 +92,7 @@ END_RELOC_NUMBERS (R_H8_max) #define E_H8_MACH_H8300 0x00800000 #define E_H8_MACH_H8300H 0x00810000 #define E_H8_MACH_H8300S 0x00820000 +#define E_H8_MACH_H8300HN 0x00830000 +#define E_H8_MACH_H8300SN 0x00840000 #endif diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 027fe91..ae5a7c5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2003-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * vsnprintf.c (vsnprintf): Don't pad string with extra nulls. + (main): Test that we don't write too much data. + 2003-04-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * configure.in (funcs, AC_CHECK_FUNCS): Add snprintf and diff --git a/libiberty/vsnprintf.c b/libiberty/vsnprintf.c index 9328e43..fd3dd18 100644 --- a/libiberty/vsnprintf.c +++ b/libiberty/vsnprintf.c @@ -78,9 +78,13 @@ vsnprintf (s, n, format, ap) result = strlen (buf); if (n > 0) { - strncpy (s, buf, n); - if (n - 1 < (size_t) result) - s[n - 1] = 0; + if ((long) n > result) + memcpy (s, buf, result+1); + else + { + memcpy (s, buf, n-1); + s[n - 1] = 0; + } } free (buf); return result; @@ -114,35 +118,35 @@ main () CLEAR (buf); status = checkit (buf, 10, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "foobar:9") == 0); + VERIFY (status==8 && memcmp (buf, "foobar:9\0XXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 9, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "foobar:9") == 0); + VERIFY (status==8 && memcmp (buf, "foobar:9\0XXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 8, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "foobar:") == 0); + VERIFY (status==8 && memcmp (buf, "foobar:\0XXXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 7, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "foobar") == 0); + VERIFY (status==8 && memcmp (buf, "foobar\0XXXXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 6, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "fooba") == 0); + VERIFY (status==8 && memcmp (buf, "fooba\0XXXXXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 2, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "f") == 0); + VERIFY (status==8 && memcmp (buf, "f\0XXXXXXXXXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 1, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "") == 0); + VERIFY (status==8 && memcmp (buf, "\0XXXXXXXXXXXXX\0", 15) == 0); CLEAR (buf); status = checkit (buf, 0, "%s:%d", "foobar", 9); - VERIFY (status==8 && strcmp (buf, "XXXXXXXXXXXXXX") == 0); + VERIFY (status==8 && memcmp (buf, "XXXXXXXXXXXXXX\0", 15) == 0); return 0; } diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8148ca9..9ff6e84 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,13 @@ +2003-04-22 Doug Evans <dje@sebabeach.org> + + * fr30-desc.c,fr30-desc.h,fr30-opc.c,fr30-opc.h: Regenerate. + * frv-desc.c,frv-desc.h,frv-opc.c,frv-opc.h: Regenerate. + * ip2k-desc.c,ip2k-desc.h,ip2k-opc.c,ip2k-opc.h: Regenerate. + * m32r-desc.c,m32r-desc.h,m32r-opc.c,m32r-opc.h: Regenerate. + * m32r-opinst.c: Regenerate. + * openrisc-desc.c,openrisc-desc.h,openrisc-opc.c,openrisc-opc.h: Regenerate. + * xstormy16-desc.c,xstormy16-desc.h,xstormy16-opc.c,xstormy16-opc.h: Regenerate. + 2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> * h8500-opc.c: Replace occurrances of 'Hitachi' with 'Renesas'. diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c index a263da7..01d896f 100644 --- a/opcodes/fr30-desc.c +++ b/opcodes/fr30-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/fr30-desc.h b/opcodes/fr30-desc.h index 41de0bb..6be96d9 100644 --- a/opcodes/fr30-desc.h +++ b/opcodes/fr30-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/fr30-opc.c b/opcodes/fr30-opc.c index b47cbcd..34c5156 100644 --- a/opcodes/fr30-opc.c +++ b/opcodes/fr30-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/fr30-opc.h b/opcodes/fr30-opc.h index 2b89a90..bfa2427 100644 --- a/opcodes/fr30-opc.h +++ b/opcodes/fr30-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/frv-desc.c b/opcodes/frv-desc.c index 54bed6b..5fac77a 100644 --- a/opcodes/frv-desc.c +++ b/opcodes/frv-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -1826,6 +1826,7 @@ const CGEN_IFLD frv_cgen_ifld_table[] = { FRV_F_S5, "f-s5", 0, 32, 4, 5, { 0, { (1<<MACH_BASE) } } }, { FRV_F_U12_H, "f-u12-h", 0, 32, 17, 6, { 0, { (1<<MACH_BASE) } } }, { FRV_F_U12_L, "f-u12-l", 0, 32, 5, 6, { 0, { (1<<MACH_BASE) } } }, + { FRV_F_U12, "f-u12", 0, 0, 0, 0,{ 0|A(VIRTUAL), { (1<<MACH_BASE) } } }, { FRV_F_INT_CC, "f-int-cc", 0, 32, 30, 4, { 0, { (1<<MACH_BASE) } } }, { FRV_F_FLT_CC, "f-flt-cc", 0, 32, 30, 4, { 0, { (1<<MACH_BASE) } } }, { FRV_F_COND, "f-cond", 0, 32, 8, 1, { 0, { (1<<MACH_BASE) } } }, @@ -1838,9 +1839,11 @@ const CGEN_IFLD frv_cgen_ifld_table[] = { FRV_F_AE, "f-ae", 0, 32, 25, 1, { 0, { (1<<MACH_BASE) } } }, { FRV_F_SPR_H, "f-spr-h", 0, 32, 30, 6, { 0, { (1<<MACH_BASE) } } }, { FRV_F_SPR_L, "f-spr-l", 0, 32, 17, 6, { 0, { (1<<MACH_BASE) } } }, + { FRV_F_SPR, "f-spr", 0, 0, 0, 0,{ 0|A(VIRTUAL), { (1<<MACH_BASE) } } }, { FRV_F_LABEL16, "f-label16", 0, 32, 15, 16, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, { FRV_F_LABELH6, "f-labelH6", 0, 32, 30, 6, { 0, { (1<<MACH_BASE) } } }, { FRV_F_LABELL18, "f-labelL18", 0, 32, 17, 18, { 0, { (1<<MACH_BASE) } } }, + { FRV_F_LABEL24, "f-label24", 0, 0, 0, 0,{ 0|A(PCREL_ADDR)|A(VIRTUAL), { (1<<MACH_BASE) } } }, { FRV_F_ICCI_1_NULL, "f-ICCi_1-null", 0, 32, 11, 2, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, { FRV_F_ICCI_2_NULL, "f-ICCi_2-null", 0, 32, 26, 2, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, { FRV_F_ICCI_3_NULL, "f-ICCi_3-null", 0, 32, 1, 2, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, @@ -1890,20 +1893,20 @@ const CGEN_MAYBE_MULTI_IFLD FRV_F_LABEL24_MULTI_IFIELD []; const CGEN_MAYBE_MULTI_IFLD FRV_F_U12_MULTI_IFIELD [] = { - { 0, { (const PTR) &frv_cgen_ifld_table[46] } }, - { 0, { (const PTR) &frv_cgen_ifld_table[47] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U12_H] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U12_L] } }, { 0, { (const PTR) 0 } } }; const CGEN_MAYBE_MULTI_IFLD FRV_F_SPR_MULTI_IFIELD [] = { - { 0, { (const PTR) &frv_cgen_ifld_table[58] } }, - { 0, { (const PTR) &frv_cgen_ifld_table[59] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_SPR_H] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_SPR_L] } }, { 0, { (const PTR) 0 } } }; const CGEN_MAYBE_MULTI_IFLD FRV_F_LABEL24_MULTI_IFIELD [] = { - { 0, { (const PTR) &frv_cgen_ifld_table[61] } }, - { 0, { (const PTR) &frv_cgen_ifld_table[62] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_LABELH6] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_LABELL18] } }, { 0, { (const PTR) 0 } } }; @@ -1924,247 +1927,247 @@ const CGEN_OPERAND frv_cgen_operand_table[] = { /* pc: program counter */ { "pc", FRV_OPERAND_PC, HW_H_PC, 0, 0, - { 0, { (const PTR) &frv_cgen_ifld_table[0] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_NIL] } }, { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* pack: packing bit */ { "pack", FRV_OPERAND_PACK, HW_H_PACK, 31, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[2] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_PACK] } }, { 0, { (1<<MACH_BASE) } } }, /* GRi: source register 1 */ { "GRi", FRV_OPERAND_GRI, HW_H_GR, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[8] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRI] } }, { 0, { (1<<MACH_BASE) } } }, /* GRj: source register 2 */ { "GRj", FRV_OPERAND_GRJ, HW_H_GR, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[9] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRJ] } }, { 0, { (1<<MACH_BASE) } } }, /* GRk: destination register */ { "GRk", FRV_OPERAND_GRK, HW_H_GR, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[10] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRK] } }, { 0, { (1<<MACH_BASE) } } }, /* GRkhi: destination register */ { "GRkhi", FRV_OPERAND_GRKHI, HW_H_GR_HI, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[10] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRK] } }, { 0, { (1<<MACH_BASE) } } }, /* GRklo: destination register */ { "GRklo", FRV_OPERAND_GRKLO, HW_H_GR_LO, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[10] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRK] } }, { 0, { (1<<MACH_BASE) } } }, /* GRdoublek: destination register */ { "GRdoublek", FRV_OPERAND_GRDOUBLEK, HW_H_GR_DOUBLE, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[10] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_GRK] } }, { 0, { (1<<MACH_BASE) } } }, /* ACC40Si: signed accumulator */ { "ACC40Si", FRV_OPERAND_ACC40SI, HW_H_ACC40S, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[19] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACC40SI] } }, { 0, { (1<<MACH_BASE) } } }, /* ACC40Ui: unsigned accumulator */ { "ACC40Ui", FRV_OPERAND_ACC40UI, HW_H_ACC40U, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[20] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACC40UI] } }, { 0, { (1<<MACH_BASE) } } }, /* ACC40Sk: target accumulator */ { "ACC40Sk", FRV_OPERAND_ACC40SK, HW_H_ACC40S, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[21] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACC40SK] } }, { 0, { (1<<MACH_BASE) } } }, /* ACC40Uk: target accumulator */ { "ACC40Uk", FRV_OPERAND_ACC40UK, HW_H_ACC40U, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[22] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACC40UK] } }, { 0, { (1<<MACH_BASE) } } }, /* ACCGi: source register */ { "ACCGi", FRV_OPERAND_ACCGI, HW_H_ACCG, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[17] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACCGI] } }, { 0, { (1<<MACH_BASE) } } }, /* ACCGk: target register */ { "ACCGk", FRV_OPERAND_ACCGK, HW_H_ACCG, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[18] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ACCGK] } }, { 0, { (1<<MACH_BASE) } } }, /* CPRi: source register */ { "CPRi", FRV_OPERAND_CPRI, HW_H_CPR, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[14] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CPRI] } }, { 0, { (1<<MACH_FRV) } } }, /* CPRj: source register */ { "CPRj", FRV_OPERAND_CPRJ, HW_H_CPR, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[15] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CPRJ] } }, { 0, { (1<<MACH_FRV) } } }, /* CPRk: destination register */ { "CPRk", FRV_OPERAND_CPRK, HW_H_CPR, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[16] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CPRK] } }, { 0, { (1<<MACH_FRV) } } }, /* CPRdoublek: destination register */ { "CPRdoublek", FRV_OPERAND_CPRDOUBLEK, HW_H_CPR_DOUBLE, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[16] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CPRK] } }, { 0, { (1<<MACH_FRV) } } }, /* FRinti: source register 1 */ { "FRinti", FRV_OPERAND_FRINTI, HW_H_FR_INT, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[11] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRI] } }, { 0, { (1<<MACH_BASE) } } }, /* FRintj: source register 2 */ { "FRintj", FRV_OPERAND_FRINTJ, HW_H_FR_INT, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[12] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRJ] } }, { 0, { (1<<MACH_BASE) } } }, /* FRintk: target register */ { "FRintk", FRV_OPERAND_FRINTK, HW_H_FR_INT, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[13] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRK] } }, { 0, { (1<<MACH_BASE) } } }, /* FRi: source register 1 */ { "FRi", FRV_OPERAND_FRI, HW_H_FR, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[11] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRI] } }, { 0, { (1<<MACH_BASE) } } }, /* FRj: source register 2 */ { "FRj", FRV_OPERAND_FRJ, HW_H_FR, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[12] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRJ] } }, { 0, { (1<<MACH_BASE) } } }, /* FRk: destination register */ { "FRk", FRV_OPERAND_FRK, HW_H_FR, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[13] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRK] } }, { 0, { (1<<MACH_BASE) } } }, /* FRkhi: destination register */ { "FRkhi", FRV_OPERAND_FRKHI, HW_H_FR_HI, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[13] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRK] } }, { 0, { (1<<MACH_BASE) } } }, /* FRklo: destination register */ { "FRklo", FRV_OPERAND_FRKLO, HW_H_FR_LO, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[13] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRK] } }, { 0, { (1<<MACH_BASE) } } }, /* FRdoublei: source register 1 */ { "FRdoublei", FRV_OPERAND_FRDOUBLEI, HW_H_FR_DOUBLE, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[11] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRI] } }, { 0, { (1<<MACH_BASE) } } }, /* FRdoublej: source register 2 */ { "FRdoublej", FRV_OPERAND_FRDOUBLEJ, HW_H_FR_DOUBLE, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[12] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRJ] } }, { 0, { (1<<MACH_BASE) } } }, /* FRdoublek: target register */ { "FRdoublek", FRV_OPERAND_FRDOUBLEK, HW_H_FR_DOUBLE, 30, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[13] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FRK] } }, { 0, { (1<<MACH_BASE) } } }, /* CRi: source register 1 */ { "CRi", FRV_OPERAND_CRI, HW_H_CCCR, 14, 3, - { 0, { (const PTR) &frv_cgen_ifld_table[23] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CRI] } }, { 0, { (1<<MACH_BASE) } } }, /* CRj: source register 2 */ { "CRj", FRV_OPERAND_CRJ, HW_H_CCCR, 2, 3, - { 0, { (const PTR) &frv_cgen_ifld_table[24] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CRJ] } }, { 0, { (1<<MACH_BASE) } } }, /* CRj_int: destination register */ { "CRj_int", FRV_OPERAND_CRJ_INT, HW_H_CCCR, 26, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[27] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CRJ_INT] } }, { 0, { (1<<MACH_BASE) } } }, /* CRj_float: destination register */ { "CRj_float", FRV_OPERAND_CRJ_FLOAT, HW_H_CCCR, 26, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[28] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CRJ_FLOAT] } }, { 0, { (1<<MACH_BASE) } } }, /* CRk: destination register */ { "CRk", FRV_OPERAND_CRK, HW_H_CCCR, 27, 3, - { 0, { (const PTR) &frv_cgen_ifld_table[25] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CRK] } }, { 0, { (1<<MACH_BASE) } } }, /* CCi: condition register */ { "CCi", FRV_OPERAND_CCI, HW_H_CCCR, 11, 3, - { 0, { (const PTR) &frv_cgen_ifld_table[26] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CCI] } }, { 0, { (1<<MACH_BASE) } } }, /* ICCi_1: condition register */ { "ICCi_1", FRV_OPERAND_ICCI_1, HW_H_ICCR, 11, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[29] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ICCI_1] } }, { 0, { (1<<MACH_BASE) } } }, /* ICCi_2: condition register */ { "ICCi_2", FRV_OPERAND_ICCI_2, HW_H_ICCR, 26, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[30] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ICCI_2] } }, { 0, { (1<<MACH_BASE) } } }, /* ICCi_3: condition register */ { "ICCi_3", FRV_OPERAND_ICCI_3, HW_H_ICCR, 1, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[31] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_ICCI_3] } }, { 0, { (1<<MACH_BASE) } } }, /* FCCi_1: condition register */ { "FCCi_1", FRV_OPERAND_FCCI_1, HW_H_FCCR, 11, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[32] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FCCI_1] } }, { 0, { (1<<MACH_BASE) } } }, /* FCCi_2: condition register */ { "FCCi_2", FRV_OPERAND_FCCI_2, HW_H_FCCR, 26, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[33] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FCCI_2] } }, { 0, { (1<<MACH_BASE) } } }, /* FCCi_3: condition register */ { "FCCi_3", FRV_OPERAND_FCCI_3, HW_H_FCCR, 1, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[34] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FCCI_3] } }, { 0, { (1<<MACH_BASE) } } }, /* FCCk: condition register */ { "FCCk", FRV_OPERAND_FCCK, HW_H_FCCR, 26, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[35] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_FCCK] } }, { 0, { (1<<MACH_BASE) } } }, /* eir: exception insn reg */ { "eir", FRV_OPERAND_EIR, HW_H_UINT, 17, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[36] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_EIR] } }, { 0, { (1<<MACH_BASE) } } }, /* s10: 10 bit signed immediate */ { "s10", FRV_OPERAND_S10, HW_H_SINT, 9, 10, - { 0, { (const PTR) &frv_cgen_ifld_table[37] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S10] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* u16: 16 bit unsigned immediate */ { "u16", FRV_OPERAND_U16, HW_H_UINT, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[40] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U16] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* s16: 16 bit signed immediate */ { "s16", FRV_OPERAND_S16, HW_H_SINT, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[41] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S16] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* s6: 6 bit signed immediate */ { "s6", FRV_OPERAND_S6, HW_H_SINT, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[42] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S6] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* s6_1: 6 bit signed immediate */ { "s6_1", FRV_OPERAND_S6_1, HW_H_SINT, 11, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[43] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S6_1] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* u6: 6 bit unsigned immediate */ { "u6", FRV_OPERAND_U6, HW_H_UINT, 5, 6, - { 0, { (const PTR) &frv_cgen_ifld_table[44] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U6] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* s5: 5 bit signed immediate */ { "s5", FRV_OPERAND_S5, HW_H_SINT, 4, 5, - { 0, { (const PTR) &frv_cgen_ifld_table[45] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S5] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* cond: conditional arithmetic */ { "cond", FRV_OPERAND_COND, HW_H_UINT, 8, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[50] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_COND] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* ccond: lr branch condition */ { "ccond", FRV_OPERAND_CCOND, HW_H_UINT, 12, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[51] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_CCOND] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* hint: 2 bit branch predictor */ { "hint", FRV_OPERAND_HINT, HW_H_UINT, 17, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[52] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_HINT] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* hint_taken: 2 bit branch predictor */ { "hint_taken", FRV_OPERAND_HINT_TAKEN, HW_H_HINT_TAKEN, 17, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[52] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_HINT] } }, { 0, { (1<<MACH_BASE) } } }, /* hint_not_taken: 2 bit branch predictor */ { "hint_not_taken", FRV_OPERAND_HINT_NOT_TAKEN, HW_H_HINT_NOT_TAKEN, 17, 2, - { 0, { (const PTR) &frv_cgen_ifld_table[52] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_HINT] } }, { 0, { (1<<MACH_BASE) } } }, /* LI: link indicator */ { "LI", FRV_OPERAND_LI, HW_H_UINT, 25, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[53] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_LI] } }, { 0, { (1<<MACH_BASE) } } }, /* lock: cache lock indicator */ { "lock", FRV_OPERAND_LOCK, HW_H_UINT, 25, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[54] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_LOCK] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* debug: debug mode indicator */ { "debug", FRV_OPERAND_DEBUG, HW_H_UINT, 25, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[55] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_DEBUG] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* A: all accumulator indicator */ { "A", FRV_OPERAND_A, HW_H_UINT, 17, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[56] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_A] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* ae: all entries indicator */ { "ae", FRV_OPERAND_AE, HW_H_UINT, 25, 1, - { 0, { (const PTR) &frv_cgen_ifld_table[57] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_AE] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* label16: 18 bit pc relative address */ { "label16", FRV_OPERAND_LABEL16, HW_H_IADDR, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[60] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_LABEL16] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* label24: 26 bit pc relative address */ { "label24", FRV_OPERAND_LABEL24, HW_H_IADDR, 17, 24, @@ -2172,11 +2175,11 @@ const CGEN_OPERAND frv_cgen_operand_table[] = { 0|A(PCREL_ADDR)|A(VIRTUAL), { (1<<MACH_BASE) } } }, /* d12: 12 bit signed immediate */ { "d12", FRV_OPERAND_D12, HW_H_SINT, 11, 12, - { 0, { (const PTR) &frv_cgen_ifld_table[39] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_D12] } }, { 0, { (1<<MACH_BASE) } } }, /* s12: 12 bit signed immediate */ { "s12", FRV_OPERAND_S12, HW_H_SINT, 11, 12, - { 0, { (const PTR) &frv_cgen_ifld_table[39] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_D12] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* u12: 12 bit signed immediate */ { "u12", FRV_OPERAND_U12, HW_H_SINT, 5, 12, @@ -2188,15 +2191,15 @@ const CGEN_OPERAND frv_cgen_operand_table[] = { 0|A(VIRTUAL), { (1<<MACH_BASE) } } }, /* ulo16: 16 bit unsigned immediate, for #lo() */ { "ulo16", FRV_OPERAND_ULO16, HW_H_UINT, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[40] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U16] } }, { 0, { (1<<MACH_BASE) } } }, /* slo16: 16 bit unsigned immediate, for #lo() */ { "slo16", FRV_OPERAND_SLO16, HW_H_SINT, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[41] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_S16] } }, { 0, { (1<<MACH_BASE) } } }, /* uhi16: 16 bit unsigned immediate, for #hi() */ { "uhi16", FRV_OPERAND_UHI16, HW_H_UINT, 15, 16, - { 0, { (const PTR) &frv_cgen_ifld_table[40] } }, + { 0, { (const PTR) &frv_cgen_ifld_table[FRV_F_U16] } }, { 0, { (1<<MACH_BASE) } } }, /* psr_esr: PSR.ESR bit */ { "psr_esr", FRV_OPERAND_PSR_ESR, HW_H_PSR_ESR, 0, 0, diff --git a/opcodes/frv-desc.h b/opcodes/frv-desc.h index 893919f..53cad79 100644 --- a/opcodes/frv-desc.h +++ b/opcodes/frv-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/frv-opc.c b/opcodes/frv-opc.c index 9632557..5e56e35 100644 --- a/opcodes/frv-opc.c +++ b/opcodes/frv-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/frv-opc.h b/opcodes/frv-opc.h index 266031b..018a643 100644 --- a/opcodes/frv-opc.h +++ b/opcodes/frv-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/ip2k-desc.c b/opcodes/ip2k-desc.c index ab6f7bf..f8e4932 100644 --- a/opcodes/ip2k-desc.c +++ b/opcodes/ip2k-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -348,39 +348,39 @@ const CGEN_OPERAND ip2k_cgen_operand_table[] = { /* pc: program counter */ { "pc", IP2K_OPERAND_PC, HW_H_PC, 0, 0, - { 0, { (const PTR) &ip2k_cgen_ifld_table[0] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_NIL] } }, { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* addr16cjp: 13-bit address */ { "addr16cjp", IP2K_OPERAND_ADDR16CJP, HW_H_UINT, 12, 13, - { 0, { (const PTR) &ip2k_cgen_ifld_table[4] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_ADDR16CJP] } }, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* fr: register */ { "fr", IP2K_OPERAND_FR, HW_H_REGISTERS, 8, 9, - { 0, { (const PTR) &ip2k_cgen_ifld_table[3] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_REG] } }, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* lit8: 8-bit signed literal */ { "lit8", IP2K_OPERAND_LIT8, HW_H_SINT, 7, 8, - { 0, { (const PTR) &ip2k_cgen_ifld_table[2] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_IMM8] } }, { 0, { (1<<MACH_BASE) } } }, /* bitno: bit number */ { "bitno", IP2K_OPERAND_BITNO, HW_H_UINT, 11, 3, - { 0, { (const PTR) &ip2k_cgen_ifld_table[6] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_BITNO] } }, { 0, { (1<<MACH_BASE) } } }, /* addr16p: page number */ { "addr16p", IP2K_OPERAND_ADDR16P, HW_H_UINT, 2, 3, - { 0, { (const PTR) &ip2k_cgen_ifld_table[16] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_PAGE3] } }, { 0, { (1<<MACH_BASE) } } }, /* addr16h: high 8 bits of address */ { "addr16h", IP2K_OPERAND_ADDR16H, HW_H_UINT, 7, 8, - { 0, { (const PTR) &ip2k_cgen_ifld_table[2] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_IMM8] } }, { 0, { (1<<MACH_BASE) } } }, /* addr16l: low 8 bits of address */ { "addr16l", IP2K_OPERAND_ADDR16L, HW_H_UINT, 7, 8, - { 0, { (const PTR) &ip2k_cgen_ifld_table[2] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_IMM8] } }, { 0, { (1<<MACH_BASE) } } }, /* reti3: reti flags */ { "reti3", IP2K_OPERAND_RETI3, HW_H_UINT, 2, 3, - { 0, { (const PTR) &ip2k_cgen_ifld_table[14] } }, + { 0, { (const PTR) &ip2k_cgen_ifld_table[IP2K_F_RETI3] } }, { 0, { (1<<MACH_BASE) } } }, /* pabits: page bits */ { "pabits", IP2K_OPERAND_PABITS, HW_H_PABITS, 0, 0, diff --git a/opcodes/ip2k-desc.h b/opcodes/ip2k-desc.h index 74819ac..84db7fb 100644 --- a/opcodes/ip2k-desc.h +++ b/opcodes/ip2k-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/ip2k-opc.c b/opcodes/ip2k-opc.c index 691cc78..5140cff 100644 --- a/opcodes/ip2k-opc.c +++ b/opcodes/ip2k-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/ip2k-opc.h b/opcodes/ip2k-opc.h index 2f8a2e1..041cb04 100644 --- a/opcodes/ip2k-opc.h +++ b/opcodes/ip2k-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c index 98fecb2..30a0719 100644 --- a/opcodes/m32r-desc.c +++ b/opcodes/m32r-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -320,67 +320,67 @@ const CGEN_OPERAND m32r_cgen_operand_table[] = { /* pc: program counter */ { "pc", M32R_OPERAND_PC, HW_H_PC, 0, 0, - { 0, { (const PTR) &m32r_cgen_ifld_table[0] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_NIL] } }, { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* sr: source register */ { "sr", M32R_OPERAND_SR, HW_H_GR, 12, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[6] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R2] } }, { 0, { (1<<MACH_BASE) } } }, /* dr: destination register */ { "dr", M32R_OPERAND_DR, HW_H_GR, 4, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[5] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R1] } }, { 0, { (1<<MACH_BASE) } } }, /* src1: source register 1 */ { "src1", M32R_OPERAND_SRC1, HW_H_GR, 4, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[5] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R1] } }, { 0, { (1<<MACH_BASE) } } }, /* src2: source register 2 */ { "src2", M32R_OPERAND_SRC2, HW_H_GR, 12, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[6] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R2] } }, { 0, { (1<<MACH_BASE) } } }, /* scr: source control register */ { "scr", M32R_OPERAND_SCR, HW_H_CR, 12, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[6] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R2] } }, { 0, { (1<<MACH_BASE) } } }, /* dcr: destination control register */ { "dcr", M32R_OPERAND_DCR, HW_H_CR, 4, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[5] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_R1] } }, { 0, { (1<<MACH_BASE) } } }, /* simm8: 8 bit signed immediate */ { "simm8", M32R_OPERAND_SIMM8, HW_H_SINT, 8, 8, - { 0, { (const PTR) &m32r_cgen_ifld_table[7] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_SIMM8] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* simm16: 16 bit signed immediate */ { "simm16", M32R_OPERAND_SIMM16, HW_H_SINT, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[8] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_SIMM16] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* uimm4: 4 bit trap number */ { "uimm4", M32R_OPERAND_UIMM4, HW_H_UINT, 12, 4, - { 0, { (const PTR) &m32r_cgen_ifld_table[10] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM4] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* uimm5: 5 bit shift count */ { "uimm5", M32R_OPERAND_UIMM5, HW_H_UINT, 11, 5, - { 0, { (const PTR) &m32r_cgen_ifld_table[11] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM5] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* uimm16: 16 bit unsigned immediate */ { "uimm16", M32R_OPERAND_UIMM16, HW_H_UINT, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[12] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM16] } }, { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } } }, /* imm1: 1 bit immediate */ { "imm1", M32R_OPERAND_IMM1, HW_H_UINT, 15, 1, - { 0, { (const PTR) &m32r_cgen_ifld_table[25] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_IMM1] } }, { 0|A(HASH_PREFIX), { (1<<MACH_M32RX) } } }, /* accd: accumulator destination register */ { "accd", M32R_OPERAND_ACCD, HW_H_ACCUMS, 4, 2, - { 0, { (const PTR) &m32r_cgen_ifld_table[22] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACCD] } }, { 0, { (1<<MACH_M32RX) } } }, /* accs: accumulator source register */ { "accs", M32R_OPERAND_ACCS, HW_H_ACCUMS, 12, 2, - { 0, { (const PTR) &m32r_cgen_ifld_table[21] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACCS] } }, { 0, { (1<<MACH_M32RX) } } }, /* acc: accumulator reg (d) */ { "acc", M32R_OPERAND_ACC, HW_H_ACCUMS, 8, 1, - { 0, { (const PTR) &m32r_cgen_ifld_table[20] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_ACC] } }, { 0, { (1<<MACH_M32RX) } } }, /* hash: # prefix */ { "hash", M32R_OPERAND_HASH, HW_H_SINT, 0, 0, @@ -388,31 +388,31 @@ const CGEN_OPERAND m32r_cgen_operand_table[] = { 0, { (1<<MACH_BASE) } } }, /* hi16: high 16 bit immediate, sign optional */ { "hi16", M32R_OPERAND_HI16, HW_H_HI16, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[14] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_HI16] } }, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } }, /* slo16: 16 bit signed immediate, for low() */ { "slo16", M32R_OPERAND_SLO16, HW_H_SLO16, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[8] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_SIMM16] } }, { 0, { (1<<MACH_BASE) } } }, /* ulo16: 16 bit unsigned immediate, for low() */ { "ulo16", M32R_OPERAND_ULO16, HW_H_ULO16, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[12] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM16] } }, { 0, { (1<<MACH_BASE) } } }, /* uimm24: 24 bit address */ { "uimm24", M32R_OPERAND_UIMM24, HW_H_ADDR, 8, 24, - { 0, { (const PTR) &m32r_cgen_ifld_table[13] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_UIMM24] } }, { 0|A(HASH_PREFIX)|A(RELOC)|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* disp8: 8 bit displacement */ { "disp8", M32R_OPERAND_DISP8, HW_H_IADDR, 8, 8, - { 0, { (const PTR) &m32r_cgen_ifld_table[15] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_DISP8] } }, { 0|A(RELAX)|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* disp16: 16 bit displacement */ { "disp16", M32R_OPERAND_DISP16, HW_H_IADDR, 16, 16, - { 0, { (const PTR) &m32r_cgen_ifld_table[16] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_DISP16] } }, { 0|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* disp24: 24 bit displacement */ { "disp24", M32R_OPERAND_DISP24, HW_H_IADDR, 8, 24, - { 0, { (const PTR) &m32r_cgen_ifld_table[17] } }, + { 0, { (const PTR) &m32r_cgen_ifld_table[M32R_F_DISP24] } }, { 0|A(RELAX)|A(RELOC)|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* condbit: condition bit */ { "condbit", M32R_OPERAND_CONDBIT, HW_H_COND, 0, 0, diff --git a/opcodes/m32r-desc.h b/opcodes/m32r-desc.h index b099730..85e22ee 100644 --- a/opcodes/m32r-desc.h +++ b/opcodes/m32r-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c index 5b20f4d..b60c1bf 100644 --- a/opcodes/m32r-opc.c +++ b/opcodes/m32r-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/m32r-opc.h b/opcodes/m32r-opc.h index 0a69dc4..22e6924 100644 --- a/opcodes/m32r-opc.h +++ b/opcodes/m32r-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/m32r-opinst.c b/opcodes/m32r-opinst.c index f89c230..5365d15 100644 --- a/opcodes/m32r-opinst.c +++ b/opcodes/m32r-opinst.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/openrisc-desc.c b/opcodes/openrisc-desc.c index 5ec4766..6de9107 100644 --- a/opcodes/openrisc-desc.c +++ b/opcodes/openrisc-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -242,6 +242,7 @@ const CGEN_IFLD openrisc_cgen_ifld_table[] = { OPENRISC_F_I16_2, "f-i16-2", 0, 32, 25, 5, { 0, { (1<<MACH_BASE) } } }, { OPENRISC_F_DISP26, "f-disp26", 0, 32, 25, 26, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, { OPENRISC_F_ABS26, "f-abs26", 0, 32, 25, 26, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, + { OPENRISC_F_I16NC, "f-i16nc", 0, 0, 0, 0,{ 0|A(SIGN_OPT)|A(VIRTUAL), { (1<<MACH_BASE) } } }, { OPENRISC_F_F_15_8, "f-f-15-8", 0, 32, 15, 8, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, { OPENRISC_F_F_10_3, "f-f-10-3", 0, 32, 10, 3, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, { OPENRISC_F_F_4_1, "f-f-4-1", 0, 32, 4, 1, { 0|A(RESERVED), { (1<<MACH_BASE) } } }, @@ -264,8 +265,8 @@ const CGEN_MAYBE_MULTI_IFLD OPENRISC_F_I16NC_MULTI_IFIELD []; const CGEN_MAYBE_MULTI_IFLD OPENRISC_F_I16NC_MULTI_IFIELD [] = { - { 0, { (const PTR) &openrisc_cgen_ifld_table[19] } }, - { 0, { (const PTR) &openrisc_cgen_ifld_table[20] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_I16_1] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_I16_2] } }, { 0, { (const PTR) 0 } } }; @@ -286,7 +287,7 @@ const CGEN_OPERAND openrisc_cgen_operand_table[] = { /* pc: program counter */ { "pc", OPENRISC_OPERAND_PC, HW_H_PC, 0, 0, - { 0, { (const PTR) &openrisc_cgen_ifld_table[0] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_NIL] } }, { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* sr: special register */ { "sr", OPENRISC_OPERAND_SR, HW_H_SR, 0, 0, @@ -298,51 +299,51 @@ const CGEN_OPERAND openrisc_cgen_operand_table[] = { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* simm-16: 16 bit signed immediate */ { "simm-16", OPENRISC_OPERAND_SIMM_16, HW_H_SINT, 15, 16, - { 0, { (const PTR) &openrisc_cgen_ifld_table[7] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_SIMM16] } }, { 0, { (1<<MACH_BASE) } } }, /* uimm-16: 16 bit unsigned immediate */ { "uimm-16", OPENRISC_OPERAND_UIMM_16, HW_H_UINT, 15, 16, - { 0, { (const PTR) &openrisc_cgen_ifld_table[8] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_UIMM16] } }, { 0, { (1<<MACH_BASE) } } }, /* disp-26: pc-rel 26 bit */ { "disp-26", OPENRISC_OPERAND_DISP_26, HW_H_IADDR, 25, 26, - { 0, { (const PTR) &openrisc_cgen_ifld_table[21] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_DISP26] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* abs-26: abs 26 bit */ { "abs-26", OPENRISC_OPERAND_ABS_26, HW_H_IADDR, 25, 26, - { 0, { (const PTR) &openrisc_cgen_ifld_table[22] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_ABS26] } }, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* uimm-5: imm5 */ { "uimm-5", OPENRISC_OPERAND_UIMM_5, HW_H_UINT, 4, 5, - { 0, { (const PTR) &openrisc_cgen_ifld_table[9] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_UIMM5] } }, { 0, { (1<<MACH_BASE) } } }, /* rD: destination register */ { "rD", OPENRISC_OPERAND_RD, HW_H_GR, 25, 5, - { 0, { (const PTR) &openrisc_cgen_ifld_table[4] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_R1] } }, { 0, { (1<<MACH_BASE) } } }, /* rA: source register A */ { "rA", OPENRISC_OPERAND_RA, HW_H_GR, 20, 5, - { 0, { (const PTR) &openrisc_cgen_ifld_table[5] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_R2] } }, { 0, { (1<<MACH_BASE) } } }, /* rB: source register B */ { "rB", OPENRISC_OPERAND_RB, HW_H_GR, 15, 5, - { 0, { (const PTR) &openrisc_cgen_ifld_table[6] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_R3] } }, { 0, { (1<<MACH_BASE) } } }, /* op-f-23: f-op23 */ { "op-f-23", OPENRISC_OPERAND_OP_F_23, HW_H_UINT, 23, 3, - { 0, { (const PTR) &openrisc_cgen_ifld_table[15] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_OP4] } }, { 0, { (1<<MACH_BASE) } } }, /* op-f-3: f-op3 */ { "op-f-3", OPENRISC_OPERAND_OP_F_3, HW_H_UINT, 25, 5, - { 0, { (const PTR) &openrisc_cgen_ifld_table[16] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_OP5] } }, { 0, { (1<<MACH_BASE) } } }, /* hi16: high 16 bit immediate, sign optional */ { "hi16", OPENRISC_OPERAND_HI16, HW_H_HI16, 15, 16, - { 0, { (const PTR) &openrisc_cgen_ifld_table[7] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_SIMM16] } }, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } }, /* lo16: low 16 bit immediate, sign optional */ { "lo16", OPENRISC_OPERAND_LO16, HW_H_LO16, 15, 16, - { 0, { (const PTR) &openrisc_cgen_ifld_table[11] } }, + { 0, { (const PTR) &openrisc_cgen_ifld_table[OPENRISC_F_LO16] } }, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } }, /* ui16nc: 16 bit immediate, sign optional */ { "ui16nc", OPENRISC_OPERAND_UI16NC, HW_H_LO16, 10, 16, diff --git a/opcodes/openrisc-desc.h b/opcodes/openrisc-desc.h index a85930e..d1edee2 100644 --- a/opcodes/openrisc-desc.h +++ b/opcodes/openrisc-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/openrisc-opc.c b/opcodes/openrisc-opc.c index 687996c..943f4d5 100644 --- a/opcodes/openrisc-opc.c +++ b/opcodes/openrisc-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/openrisc-opc.h b/opcodes/openrisc-opc.h index 494ba5c..bd8bb7c 100644 --- a/opcodes/openrisc-opc.h +++ b/opcodes/openrisc-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/xstormy16-desc.c b/opcodes/xstormy16-desc.c index 77d7613..9c9f30b 100644 --- a/opcodes/xstormy16-desc.c +++ b/opcodes/xstormy16-desc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -297,6 +297,7 @@ const CGEN_IFLD xstormy16_cgen_ifld_table[] = { XSTORMY16_F_REL12A, "f-rel12a", 0, 32, 4, 11, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, { XSTORMY16_F_ABS24_1, "f-abs24-1", 0, 32, 8, 8, { 0, { (1<<MACH_BASE) } } }, { XSTORMY16_F_ABS24_2, "f-abs24-2", 0, 32, 16, 16, { 0, { (1<<MACH_BASE) } } }, + { XSTORMY16_F_ABS24, "f-abs24", 0, 0, 0, 0,{ 0|A(ABS_ADDR)|A(VIRTUAL), { (1<<MACH_BASE) } } }, { 0, 0, 0, 0, 0, 0, {0, {0}} } }; @@ -313,8 +314,8 @@ const CGEN_MAYBE_MULTI_IFLD XSTORMY16_F_ABS24_MULTI_IFIELD []; const CGEN_MAYBE_MULTI_IFLD XSTORMY16_F_ABS24_MULTI_IFIELD [] = { - { 0, { (const PTR) &xstormy16_cgen_ifld_table[34] } }, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[35] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_ABS24_1] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_ABS24_2] } }, { 0, { (const PTR) 0 } } }; @@ -335,7 +336,7 @@ const CGEN_OPERAND xstormy16_cgen_operand_table[] = { /* pc: program counter */ { "pc", XSTORMY16_OPERAND_PC, HW_H_PC, 0, 0, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[0] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_NIL] } }, { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* psw-z8: */ { "psw-z8", XSTORMY16_OPERAND_PSW_Z8, HW_H_Z8, 0, 0, @@ -367,95 +368,95 @@ const CGEN_OPERAND xstormy16_cgen_operand_table[] = { 0|A(SEM_ONLY), { (1<<MACH_BASE) } } }, /* Rd: general register destination */ { "Rd", XSTORMY16_OPERAND_RD, HW_H_GR, 12, 4, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[2] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RD] } }, { 0, { (1<<MACH_BASE) } } }, /* Rdm: general register destination */ { "Rdm", XSTORMY16_OPERAND_RDM, HW_H_GR, 13, 3, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[3] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RDM] } }, { 0, { (1<<MACH_BASE) } } }, /* Rm: general register for memory */ { "Rm", XSTORMY16_OPERAND_RM, HW_H_GR, 4, 3, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[4] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RM] } }, { 0, { (1<<MACH_BASE) } } }, /* Rs: general register source */ { "Rs", XSTORMY16_OPERAND_RS, HW_H_GR, 8, 4, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[5] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RS] } }, { 0, { (1<<MACH_BASE) } } }, /* Rb: base register */ { "Rb", XSTORMY16_OPERAND_RB, HW_H_RB, 17, 3, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[6] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RB] } }, { 0, { (1<<MACH_BASE) } } }, /* Rbj: base register for jump */ { "Rbj", XSTORMY16_OPERAND_RBJ, HW_H_RBJ, 11, 1, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[7] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_RBJ] } }, { 0, { (1<<MACH_BASE) } } }, /* bcond2: branch condition opcode */ { "bcond2", XSTORMY16_OPERAND_BCOND2, HW_H_BRANCHCOND, 4, 4, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[9] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP2] } }, { 0, { (1<<MACH_BASE) } } }, /* ws2: word size opcode */ { "ws2", XSTORMY16_OPERAND_WS2, HW_H_WORDSIZE, 7, 1, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[11] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP2M] } }, { 0, { (1<<MACH_BASE) } } }, /* bcond5: branch condition opcode */ { "bcond5", XSTORMY16_OPERAND_BCOND5, HW_H_BRANCHCOND, 16, 4, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[18] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_OP5] } }, { 0, { (1<<MACH_BASE) } } }, /* imm2: 2 bit unsigned immediate */ { "imm2", XSTORMY16_OPERAND_IMM2, HW_H_UINT, 10, 2, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[21] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM2] } }, { 0, { (1<<MACH_BASE) } } }, /* imm3: 3 bit unsigned immediate */ { "imm3", XSTORMY16_OPERAND_IMM3, HW_H_UINT, 4, 3, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[22] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM3] } }, { 0, { (1<<MACH_BASE) } } }, /* imm3b: 3 bit unsigned immediate for bit tests */ { "imm3b", XSTORMY16_OPERAND_IMM3B, HW_H_UINT, 17, 3, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[23] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM3B] } }, { 0, { (1<<MACH_BASE) } } }, /* imm4: 4 bit unsigned immediate */ { "imm4", XSTORMY16_OPERAND_IMM4, HW_H_UINT, 8, 4, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[24] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM4] } }, { 0, { (1<<MACH_BASE) } } }, /* imm8: 8 bit unsigned immediate */ { "imm8", XSTORMY16_OPERAND_IMM8, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[25] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM8] } }, { 0, { (1<<MACH_BASE) } } }, /* imm8small: 8 bit unsigned immediate */ { "imm8small", XSTORMY16_OPERAND_IMM8SMALL, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[25] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM8] } }, { 0, { (1<<MACH_BASE) } } }, /* imm12: 12 bit signed immediate */ { "imm12", XSTORMY16_OPERAND_IMM12, HW_H_SINT, 20, 12, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[26] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM12] } }, { 0, { (1<<MACH_BASE) } } }, /* imm16: 16 bit immediate */ { "imm16", XSTORMY16_OPERAND_IMM16, HW_H_UINT, 16, 16, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[27] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_IMM16] } }, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } } }, /* lmem8: 8 bit unsigned immediate low memory */ { "lmem8", XSTORMY16_OPERAND_LMEM8, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[28] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_LMEM8] } }, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* hmem8: 8 bit unsigned immediate high memory */ { "hmem8", XSTORMY16_OPERAND_HMEM8, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[29] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_HMEM8] } }, { 0|A(ABS_ADDR), { (1<<MACH_BASE) } } }, /* rel8-2: 8 bit relative address */ { "rel8-2", XSTORMY16_OPERAND_REL8_2, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[30] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL8_2] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* rel8-4: 8 bit relative address */ { "rel8-4", XSTORMY16_OPERAND_REL8_4, HW_H_UINT, 8, 8, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[31] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL8_4] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* rel12: 12 bit relative address */ { "rel12", XSTORMY16_OPERAND_REL12, HW_H_UINT, 20, 12, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[32] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL12] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* rel12a: 12 bit relative address */ { "rel12a", XSTORMY16_OPERAND_REL12A, HW_H_UINT, 4, 11, - { 0, { (const PTR) &xstormy16_cgen_ifld_table[33] } }, + { 0, { (const PTR) &xstormy16_cgen_ifld_table[XSTORMY16_F_REL12A] } }, { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } } }, /* abs24: 24 bit absolute address */ { "abs24", XSTORMY16_OPERAND_ABS24, HW_H_UINT, 8, 24, @@ -1118,6 +1119,11 @@ static const CGEN_IBASE xstormy16_cgen_insn_table[MAX_INSNS] = XSTORMY16_INSN_DIVLH, "divlh", "divlh", 16, { 0, { (1<<MACH_BASE) } } }, +/* reset */ + { + XSTORMY16_INSN_RESET, "reset", "reset", 16, + { 0, { (1<<MACH_BASE) } } + }, /* nop */ { XSTORMY16_INSN_NOP, "nop", "nop", 16, diff --git a/opcodes/xstormy16-desc.h b/opcodes/xstormy16-desc.h index fe18a13..a880321 100644 --- a/opcodes/xstormy16-desc.h +++ b/opcodes/xstormy16-desc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. diff --git a/opcodes/xstormy16-opc.c b/opcodes/xstormy16-opc.c index 90db6f0..34c0b0e 100644 --- a/opcodes/xstormy16-opc.c +++ b/opcodes/xstormy16-opc.c @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -910,6 +910,12 @@ static const CGEN_OPCODE xstormy16_cgen_insn_opcode_table[MAX_INSNS] = { { MNEM, 0 } }, & ifmt_iret, { 0xe0 } }, +/* reset */ + { + { 0, 0, 0, 0 }, + { { MNEM, 0 } }, + & ifmt_iret, { 0xf } + }, /* nop */ { { 0, 0, 0, 0 }, diff --git a/opcodes/xstormy16-opc.h b/opcodes/xstormy16-opc.h index fbe7fe1..f2366ca 100644 --- a/opcodes/xstormy16-opc.h +++ b/opcodes/xstormy16-opc.h @@ -2,7 +2,7 @@ THIS FILE IS MACHINE GENERATED WITH CGEN. -Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU Binutils and/or GDB, the GNU debugger. @@ -67,8 +67,9 @@ typedef enum cgen_insn_type { , XSTORMY16_INSN_CALLRGR, XSTORMY16_INSN_CALLRIMM, XSTORMY16_INSN_CALLGR, XSTORMY16_INSN_CALLFIMM , XSTORMY16_INSN_ICALLRGR, XSTORMY16_INSN_ICALLGR, XSTORMY16_INSN_ICALLFIMM, XSTORMY16_INSN_IRET , XSTORMY16_INSN_RET, XSTORMY16_INSN_MUL, XSTORMY16_INSN_DIV, XSTORMY16_INSN_SDIV - , XSTORMY16_INSN_SDIVLH, XSTORMY16_INSN_DIVLH, XSTORMY16_INSN_NOP, XSTORMY16_INSN_HALT - , XSTORMY16_INSN_HOLD, XSTORMY16_INSN_HOLDX, XSTORMY16_INSN_BRK, XSTORMY16_INSN_SYSCALL + , XSTORMY16_INSN_SDIVLH, XSTORMY16_INSN_DIVLH, XSTORMY16_INSN_RESET, XSTORMY16_INSN_NOP + , XSTORMY16_INSN_HALT, XSTORMY16_INSN_HOLD, XSTORMY16_INSN_HOLDX, XSTORMY16_INSN_BRK + , XSTORMY16_INSN_SYSCALL } CGEN_INSN_TYPE; /* Index of `invalid' insn place holder. */ |