diff options
author | David Carlton <carlton@bactrian.org> | 2003-04-16 19:57:09 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-04-16 19:57:09 +0000 |
commit | 0bb428781c4782c6236beb58c06052dccd382aa1 (patch) | |
tree | c2745e3799c869e29769a81c22cc151fdbe84a97 | |
parent | 8ddfa96fcd388fb183d7aac8befd08c138e105dd (diff) | |
download | gdb-0bb428781c4782c6236beb58c06052dccd382aa1.zip gdb-0bb428781c4782c6236beb58c06052dccd382aa1.tar.gz gdb-0bb428781c4782c6236beb58c06052dccd382aa1.tar.bz2 |
2003-04-16 David Carlton <carlton@bactrian.org>
* Merge with mainline; tag is carlton_dictionary-20030416-merge.
477 files changed, 33518 insertions, 24294 deletions
@@ -1,3 +1,38 @@ +2003-04-16 David Carlton <carlton@bactrian.org> + + * Merge with mainline; tag is carlton_dictionary-20030416-merge. + +2003-04-11 Alexandre Oliva <aoliva@redhat.com> + + * libtool.m4 (lt_cv_deplibs_check_method): Use pass_all on mips*. + * */configure: Rebuilt. + +2003-03-14 Nathanael Nerode <neroden@gcc.gnu.org> + + * Makefile.tpl: Move .NOEXPORT, MAKEOVERRIDES back down. + * Makefile.in: Regenerate. + +2003-03-14 Michael Chastain <mec@shout.net> + + * Makefile.in: Regenerate with correct Makefile.def. + +2003-03-12 Nathanael Nerode <neroden@gcc.gnu.org> + + * Makefile.tpl: Move .NOEXPORT, MAKEOVERRIDES up. Delete unused + Make macro. + * Makefile.in: Regenerate. + * configure.in: Clean up gxx_include_dir logic. + * configure: Regenerate. + +2003-03-09 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> + + * configure.in (gxx_include_dir): Fix typo. + * configure: Regenerated. + +2003-03-06 Andrew Cagney <cagney@redhat.com> + + * texinfo/texinfo.tex: Import version 2003-02-03.16. + 2003-03-05 David Carlton <carlton@math.stanford.edu> * Merge with mainline. Tag is carlton_dictionary-20030305-merge. diff --git a/Makefile.in b/Makefile.in index 41b1b64..f70250d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -84,7 +84,6 @@ INSTALL_DATA = $(INSTALL) -m 644 # ------------------------------------------------- links=@configlinks@ -enable_version_specific_runtime_libs = @enable_version_specific_runtime_libs@ # The file containing GCC's version number. gcc_version_trigger = @gcc_version_trigger@ gcc_version = @gcc_version@ @@ -7525,10 +7524,10 @@ config.status: configure $(gcc_version_trigger) AUTOCONF = autoconf $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4 cd $(srcdir) && $(AUTOCONF) -# -.NOEXPORT: -MAKEOVERRIDES= +# ------------------------------ +# Special directives to GNU Make +# ------------------------------ # Tell GNU make 3.79 not to run the top level in parallel. This # prevents contention for $builddir/$target/config.cache, as well @@ -7536,4 +7535,8 @@ MAKEOVERRIDES= NOTPARALLEL = .NOTPARALLEL $(NOTPARALLEL): +# Don't pass command-line variables to submakes. +.NOEXPORT: +MAKEOVERRIDES= + # end of Makefile.in diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5f949ed..1650199 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,9 +1,450 @@ +2003-04-15 Alexandre Oliva <aoliva@redhat.com> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Fix typo in + 2003-04-09's change. + +2003-04-15 Brian Ford <ford@vss.fsi.com> + + * peicode.h (coff_swap_scnhdr_in): If a section holds + uninitialized data and is from an object file or from an + executable image that has not initialized the s_size field, or if + the physical size is padded, use the virtual size (stored in + s_paddr) instead. + +2003-04-15 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Properly report + filename for alignment reduction. + +2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> + + * archures.c: Replace occurrances of 'Hitachi' with 'Renesas'. + * reloc.c: Likewise. + * coff-h8300.c: Likewise. + * coff-h8500.c: Likewise. + * coff-sh.c: Likewise. + * cpu-h8300.c: Likewise. + * cpu-sh.c: Likewise. + * elf32-h8300.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-sh64-com.c: Likewise. + * elf32-sh64.c: Likewise. + * elf64-sh64.c: Likewise. + * bfd-in2.h: Regenerate. + +2003-04-14 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Maintain maximum + alignment for common symbols. Warn reducing alignment for + common symbols. Report old filename when symbol size changes. + +2003-04-12 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Adjust two other + occurrences of the same test changed in the previous patch. + Optimize. + +2003-04-11 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_get_global_gotsym_index): New. + (mips_elf_calculate_relocation): Decay GOT_PAGE/GOT_OFST to + GOT_DISP/addend only if the symbol got a global GOT entry. + +2003-04-10 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_calculate_relocation): Decay + GOT_PAGE/GOT_OFST referencing overridable symbol to + GOT_DISP/addend. + (_bfd_mips_elf_check_relocs): Handle GOT_PAGE referencing + global symbol as GOT_DISP. + +2003-04-10 Bob Wilson <bob.wilson@acm.org> + + * elf32-xtensa.c (elf_xtensa_relocate_section): Don't continue to the + next relocation on an undefined symbol. + +2003-04-09 Richard Henderson <rth@redhat.com> + + * elf64-alpha.c (elf64_alpha_relocate_section) <R_ALPHA_GPREL32>: + Ignore relocations against r_symndx == 0. + +2003-04-09 H.J. Lu <hjl@gnu.org> + + * elf64-alpha.c (elf64_alpha_relocate_section): Don't return + FALSE for undefined symbols. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + +2003-04-09 Alexandre Oliva <aoliva@redhat.com> + + * dwarf2.c (_bfd_dwarf2_find_nearest_line): Try DWARF3-standard + and IRIX-specific shift-to-64-bit 4-byte lengths before following + addr_size. + +2003-04-08 Alexandre Oliva <aoliva@redhat.com> + + * elf32-mips.c (bfd_elf32_bfd_reloc_type_lookup): Detect (ctor) + pointer size from ABI, not arch_bits_per_address. + +2003-04-07 Kevin Buettner <kevinb@redhat.com> + + * elfn32-mips.c (elf32_mips_grok_prstatus): Adjust core file related + constants for n32 ABI. + +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * simple.c (bfd_simple_get_relocated_section_contents): Disable + free that leads to GDB vs BFD memory corruption. + +2003-04-04 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc11.c (m68hc11_elf_relax_delete_bytes): Also adjust + symbols that mark the end of the section. + (m68hc11_elf_relax_section): Use R_M68HC11_PCREL_8 relocs when + converting to a relative branch so that the offset is computed after + the relaxation; also relocate a jsr into a bsr if possible but don't + relax them if they are to a far symbol as we need to call the + trampoline code. + (elf_m68hc11_howto_table): Set pcrel_offset to true. + +2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com> + + * archures.c: Namespace cleanup. Rename bfd_mach_c3x to + bfd_mach_tic3x and bfd_mach_c4x to bfd_mach_tic4x + * bfd-in2.h: Regenerate + * coff-tic4x.c: Namespace cleanup. Replace s/c4x/tic4x/ + * cpu-tic4x.c: Ditto + +2003-04-03 Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Compute ps and ss + differently for object files and executables. + * peicode.h (coff_swap_scnhdr_in): Only set the s_size field + for object files or for executables who have not already + initialised the field. + * libpei.h (bfd_pe_executable_p): New macro. Return true if + the PE format bfd is an executable. + +2003-04-03 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_check_relocs): Don't use SYMBOL_REFERENCES_LOCAL + here as it's too early to reliably determine locality. + (ppc_elf_gc_sweep_hook): Likewise. + (SYMBOL_REFERENCES_LOCAL): Expand comment. + +2003-04-02 Bob Wilson <bob.wilson@acm.org> + + * xtensa-modules.c: Remove comment indicating that this is a + generated file. + +2003-04-02 Alan Modra <amodra@bigpond.net.au> + + * elfxx-mips.c (_bfd_mips_elf_hide_symbol): Test for NULL dynobj. + +2003-04-01 Bob Wilson <bob.wilson@acm.org> + + * Makefile.am (ALL_MACHINES): Add cpu-xtensa.lo. + (ALL_MACHINES_CFILES): Add cpu-xtensa.c. + (BFD32_BACKENDS): Add elf32-xtensa.lo, xtensa-isa.lo, and + xtensa-modules.lo. + (BFD32_BACKENDS_CFILES): Add elf32-xtensa.c, xtensa-isa.c, and + xtensa-modules.c. + (cpu-xtensa.lo): New target. + (elf32-xtensa.lo): Likewise. + (xtensa-isa.lo): Likewise. + (xtensa-modules.lo): Likewise. + * Makefile.in: Regenerate. + * archures.c (bfd_architecture): Add bfd_{arch,mach}_xtensa. + (bfd_archures_list): Add bfd_xtensa_arch. + * config.bfd: Handle xtensa-*-*. + * configure.in: Handle bfd_elf32_xtensa_{le,be}_vec. + * configure: Regenerate. + * reloc.c: Add BFD_RELOC_XTENSA_{RTLD,GLOB_DAT,JMP_SLOT,RELATIVE, + PLT,OP0,OP1,OP2,ASM_EXPAND,ASM_SIMPLIFY}. + * targets.c (bfd_elf32_xtensa_be_vec): Declare. + (bfd_elf32_xtensa_le_vec): Likewise. + (bfd_target_vector): Add bfd_elf32_xtensa_{be,le}_vec. + * cpu-xtensa.c: New file. + * elf32-xtensa.c: Likewise. + * xtensa-isa.c: Likewise. + * xtensa-modules.c: Likewise. + * libbfd.h: Regenerate. + * bfd-in2.h: Likewise. + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * archures.c (bfd_mach_arm_unknown): Define. + * bfd-in.h (bfd_arm_merge_machines, bfd_arm+update_notes, + bfd_arm_get_mach_from_notes): Prototype. + * bfd-in2.h: Regenerate. + * coff-arm.c (coff_arm_merge_private_bfd_data): Call + bfd_arm_merge_machines. + (coff_arm_final_link_postscript): Call bfd_arm_update_notes. + * coffcode.h (coff_set_arch_mach_hook): Call + bfd_arm_get_mach_from_notes. + * coffgen.c (coff_real_object_p): Revert previous delta. + * cpu_arm.c (arm_check_note): New function. Examine a note in a + .note section. + (bfd_arm_merge_machines): New function: Handle the merging of ARM + binaries compiled for different architectures.. + (bfd_arm_update_notes): New function: Update an ARM note section. + (bfd_arm_get_mach_from_notes): New function: Extract a bfd machine + number from an ARM note section. + * elf32-arm.h (elf32_arm_object_p): Use + bfd_arm_get_mach_from_notes. + (elf32_arm_merge_private_bfd_data): Use bfd_arm_merge_machines. + (elf32_arm_final_write_processing): Use bfd_arm_update_notes. + +2003-04-01 Ben Elliston <bje@wasabisystems.com> + + * dwarf2.c (read_attribute_value): Correct typo in comment. + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * dwarf2.c (concat_filename): Use bfd_malloc() and strdup() + instead of concat(). + (decode_line_info): Only free filename if it is not NULL. + (add_line_info): Make a copy of the filename when storing it into + the info structure. + +2003-03-31 Andreas Schwab <schwab@suse.de> + Daniel Jacobowitz <drow@mvista.com> + + * simple.c (bfd_simple_get_relocated_section_contents): Add + parameter symbol_table. Optionally use it instead of the symbol + table from the bfd. Save and restore output offsets and output + sections around bfd_get_relocated_section_contents. Fix a memory + leak. + (simple_save_output_info, simple_restore_output_info): New + functions. + * bfd-in2.h: Regenerate. + * dwarf2.c (read_abbrevs): Use + bfd_simple_get_relocated_section_contents instead of + bfd_get_section_contents. + (decode_line_info): Likewise. + (_bfd_dwarf2_find_nearest_line): Likewise. Don't call + find_rela_addend. + (find_rela_addend): Remove. + * elfxx-ia64.c (elfNN_ia64_reloc): Weaken sanity check for + debugging sections. + (elfNN_ia64_hash_table_create): Create the hash table with malloc, + not bfd_zalloc. + +2003-03-31 David Heine <dlheine@suif.stanford.edu> + + * aoutx.h (aout_link_hash_table_create): Use bfd_malloc instead of + bfd_alloc. + * dwarf2.c (concat_filename): Always allocate space for the + returned filename. + (decode_line_info): Free the allocated filename returned by + concat_filename. + * elf-eh-frame.c (bfd_elf_write_section_eh_frame): Fix memory leaks. + * elf.c (copy_private_bfd_data): Likewise. + (_bfd_elf_slurp_version_tables): Fix bug freeing contents pointer. + * elflink.h (elf_link_sort_relocs): Fix memory leak. + * format.c (bfd_check_format_matches): Likewise. + * linker.c (bfd_generic_final_link): Likewise. + * opncls.c (find_separate_debug_info): Likewise. + * simple.c (bfd_simple_get_relocated_section_contents): Likewise. + +2003-03-28 H.J. Lu <hjl@gnu.org> + + * elflink.h (elf_link_add_object_symbols): Correctly combine + visibilities. + +2003-03-27 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset + to -1 before recomputing got offsets. + +2003-03-26 Andreas Schwab <schwab@suse.de> + + * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. + (elf_m68k_relocate_section): Use it to correctly handle symbols + forced to be local. + (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got + entries for symbols that are forced to be local. + +2003-03-25 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (_bfd_mips_relax_section): New function. + * elfxx-mips.h (_bfd_mips_relax_section): Declare. + * elfn32-mips.c, elf64-mips.c: Use it. + +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. + * reloc.c: Add BFD_RELOC_ARM_CP_OFF_IMM_S2. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * coff-arm.c (coff_arm_merge_private_bfd_data): Allow iWMMXt + object files to be linked with XScale ones. + (coff_arm_final_link_postscript): Update note section. + * coffcode.h (coff_set_arch_mach_hook): Handle note section. + * coffgen.c (coff_real_object_p): Call bfd_coff_set_arch_mach_hook + after identifying a coff binary. + * cpu-arm.c (processors): Add iWMMXt. + (arch_inf): Likewise. + * elf32-arm.h (arm_object_p): Handle note section. + (elf32_arm_merge_private_bfd_data): Allow iWMMXt object files to + be linked with XScale ones. + (elf32_arm_section_flags): New function: Set flags on note section. + (elf32_arm_final_write_processing): Handle note section. + +2003-03-21 DJ Delorie <dj@redhat.com> + + * elf32-xstormy16.c (elf32_xstormy16_relocate_section): Call + _bfd_elf_rela_local_sym. + +2003-03-20 H.J. Lu <hjl@gnu.org> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Don't try relax for + non-ELF outputs. + +2003-03-20 Nick Clifton <nickc@redhat.com> + + * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Initialise $idata2 and + $idata5 in case bfd_coff_final_link is not called. + +2003-03-19 Jakub Jelinek <jakub@redhat.com> + + * elf64-sparc.c (struct sparc64_elf_section_data): Add reloc_count + field. + (canon_reloc_count): Define. + (sparc64_elf_slurp_one_reloc_table, sparc64_elf_slurp_reloc_table, + sparc64_elf_canonicalize_dynamic_reloc): Use it instead of + reloc_count. + (sparc64_elf_canonicalize_reloc): New routine. + (bfd_elf64_canonicalize_reloc): Define. + +2003-03-18 Jakub Jelinek <jakub@redhat.com> + + * elfxx-ia64.c (elfNN_ia64_relax_section): Handle relaxation + againt mergeable sections. Take r_addend into account when caching + trampolines. + +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. + +2003-03-14 Gene Smith <gene.smith@siemens.com> + + * ieee.c (ieee_write_expression): Handle the case where symbol is + NULL. + General formatting improvements. + +2003-03-13 Nick Clifton <nickc@redhat.com> + + * configure.in (LINGUAS): Add zh_CN. + * configure: Regenerate. + * po/zh_CN.po: New file. + +2003-03-13 Elias Athanasopoulos <elathan@phys.uoa.gr> + + * aout-cris.c (BYTES_IN_WORD): Don't define. + aout-encap.c: Likewise. + aout-ns32k.c: Likewise. + aout-tic30.c: Likewise. + hp300bsd.c: Likewise. + i386aout.c: Likewise. + i386dynix.c: Likewise. + i386linux.c: Likewise. + i386lynx.c: Likewise. + i386mach3.c: Likewise. + m68k4knetbsd.c: Likewise. + m68klinux.c: Likewise. + m68klynx.c: Likewise. + m68knetbsd.c: Likewise. + m88kmach3.c: Likewise. + mipsbsd.c: Likewise. + newsos3.c: Likewise. + sparclinux.c: Likewise. + sparclynx.c: Likewise. + sparcnetbsd.c: Likewise. + vaxbsd.c: Likewise. Fix comment formatting. + +2003-03-12 Alexandre Oliva <aoliva@redhat.com> + + * Reverted 2003-03-02's patch. + + * elfxx-target.h (bfd_elfNN_canonicalize_reloc): Make it + overridable. + * elf64-mips.c (mips_elf64_canonicalize_reloc, + mips_elf64_get_dynamic_reloc_upper_bound, + mips_elf64_canonicalize_dynamic_reloc): New, adapted from elf.c. + (bfd_elf64_get_canonicalize_reloc, + bfd_elf64_get_dynamic_reloc_upper_bound, + bfd_elf64_canonicalize_dynamic_reloc): Define. + (mips_elf64_slurp_reloc_table): Support dynamic. + (mips_elf64_slurp_one_reloc_table): Adjust. + +2003-03-12 Nick Clifton <nickc@redhat.com> + + * xsym.c (bfd_sym_fetch_type_information_table_entry): Change + 'index' to 'offset' in test for zero value. + +2003-03-11 Alexandre Oliva <aoliva@redhat.com> + + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Do not create + dynamic relocations pointing to local or section symbols, use the + NULL symbol instead. Document the choice to not emit an + additional R_MIPS_64 relocation. + +2003-03-11 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Subtract tls seg vma from + zero index dynamic tls relocs generated for the GOT. Tidy code. + Set "relocation" to 1 on DTPMOD32 relocs. Optimize HA adjustment. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + +2003-03-07 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_relocate_section): Don't look for a nop after + a tls_get_addr call. + + * elf32-ppc.c (ELIMINATE_COPY_RELOCS): Define as one. + (ppc_elf_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define as one. + (ppc64_elf_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + * elf32-i386.c (ELIMINATE_COPY_RELOCS): Define as one. Use throughout. + (elf_i386_adjust_dynamic_symbol): For weak symbols, copy + ELF_LINK_NON_GOT_REF from weakdef. + +2003-03-06 Jakub Jelinek <jakub@redhat.com> + Andrew Haley <aph@redhat.com> + + * elflink.h (elf_bfd_discard_info): Don't process eh frames if + output is relocateable. + +2003-03-06 Steven Konopa <skonopa@kgo.csc.com> + + * som.c (som_fixup_formats): Correct formats for R_AUX_UNWIND and + R_COMMENT. + +2003-03-06 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_create_linker_section): Don't capitalize + error messages. + (ELIMINATE_COPY_RELOCS): Define to zero. + (ppc_elf_relocate_section): Don't deref htab->tls_sec when calculating + TLSLD relocs. Report reloc types on a number of errors. Optimize + LOCAL24PC check for non-local syms. Don't capitalize error messages. + * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define to zero. + (ppc64_elf_relocate_section): Don't deref htab->tls_sec when + calculating TLSLD relocs. Report reloc types on a number of errors. + Don't capitalize error messages. + 2003-03-03 H.J. Lu <hjl@gnu.org> * elfxx-ia64.c (USE_BRL): Removed. (oor_ip): Removed. -Mon Mar 3 20:48:23 2003 J"orn Rennecke <joern.rennecke@superh.com> +2003-03-03 J"orn Rennecke <joern.rennecke@superh.com> * elf32-sh.c (sh_elf_howto_tab): Make R_SH_IND12W into an ordinary relocation (no special function), and make it non-partial_inplace. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 401568f..ee04261 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -101,6 +101,7 @@ ALL_MACHINES = \ cpu-we32k.lo \ cpu-w65.lo \ cpu-xstormy16.lo \ + cpu-xtensa.lo \ cpu-z8k.lo ALL_MACHINES_CFILES = \ @@ -155,6 +156,7 @@ ALL_MACHINES_CFILES = \ cpu-we32k.c \ cpu-w65.c \ cpu-xstormy16.c \ + cpu-xtensa.c \ cpu-z8k.c # The .o files needed by all of the 32 bit vectors that are configured into @@ -249,6 +251,7 @@ BFD32_BACKENDS = \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ + elf32-xtensa.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ @@ -317,7 +320,9 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ xcofflink.lo \ - xsym.lo + xsym.lo \ + xtensa-isa.lo \ + xtensa-modules.lo BFD32_BACKENDS_CFILES = \ aout-adobe.c \ @@ -408,6 +413,7 @@ BFD32_BACKENDS_CFILES = \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ + elf32-xtensa.c \ elf32.c \ elflink.c \ elf-strtab.c \ @@ -475,7 +481,9 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ xcofflink.c \ - xsym.c + xsym.c \ + xtensa-isa.c \ + xtensa-modules.c # The .o files needed by all of the 64 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all @@ -957,6 +965,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ @@ -1286,6 +1295,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -1490,6 +1502,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h aix5ppc-core.lo: aix5ppc-core.c aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index a05b342..3de6121 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -226,6 +226,7 @@ ALL_MACHINES = \ cpu-we32k.lo \ cpu-w65.lo \ cpu-xstormy16.lo \ + cpu-xtensa.lo \ cpu-z8k.lo @@ -281,6 +282,7 @@ ALL_MACHINES_CFILES = \ cpu-we32k.c \ cpu-w65.c \ cpu-xstormy16.c \ + cpu-xtensa.c \ cpu-z8k.c @@ -376,6 +378,7 @@ BFD32_BACKENDS = \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ + elf32-xtensa.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ @@ -444,7 +447,9 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ xcofflink.lo \ - xsym.lo + xsym.lo \ + xtensa-isa.lo \ + xtensa-modules.lo BFD32_BACKENDS_CFILES = \ @@ -536,6 +541,7 @@ BFD32_BACKENDS_CFILES = \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ + elf32-xtensa.c \ elf32.c \ elflink.c \ elf-strtab.c \ @@ -603,7 +609,9 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ xcofflink.c \ - xsym.c + xsym.c \ + xtensa-isa.c \ + xtensa-modules.c # The .o files needed by all of the 64 bit vectors that are configured into @@ -799,7 +807,7 @@ configure.in version.h DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) @@ -1490,6 +1498,7 @@ cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ @@ -1819,6 +1828,9 @@ elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/xtensa.h $(INCDIR)/xtensa-isa.h elf32-target.h elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ @@ -2023,6 +2035,10 @@ xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ libxcoff.h xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h aix5ppc-core.lo: aix5ppc-core.c aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c index 7027b17..4d1e48d 100644 --- a/bfd/aout-cris.c +++ b/bfd/aout-cris.c @@ -1,5 +1,5 @@ /* BFD backend for CRIS a.out binaries. - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hans-Peter Nilsson. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ functions. Beware; some of the information there is outdated. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define N_TXTOFF(x) 32 #define ENTRY_CAN_BE_ZERO #define TEXT_START_ADDR 0 diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c index 1a794ec..96c7082 100644 --- a/bfd/aout-encap.c +++ b/bfd/aout-encap.c @@ -1,5 +1,5 @@ /* BFD back-end for a.out files encapsulated with COFF headers. - Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002 + Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 #endif #include "bfd.h" diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c index 4809ffb..0972b5d 100644 --- a/bfd/aout-ns32k.c +++ b/bfd/aout-ns32k.c @@ -1,5 +1,5 @@ /* BFD back-end for ns32k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Ian Dall (idall@eleceng.adelaide.edu.au). @@ -19,8 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define BYTES_IN_WORD 4 - #include "bfd.h" #include "aout/aout64.h" #include "ns32k.h" diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 6d5f48c..6e65fcf 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1,5 +1,5 @@ /* BFD back-end for TMS320C30 a.out binaries. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ #define TARGET_IS_BIG_ENDIAN_P #define N_HEADER_IN_TEXT(x) 1 -#define BYTES_IN_WORD 4 #define TEXT_START_ADDR 1024 #define TARGET_PAGE_SIZE 128 #define SEGMENT_SIZE TARGET_PAGE_SIZE diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 998bca7..7f02d13 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1,6 +1,6 @@ /* BFD semi-generic back-end for a.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -105,9 +105,7 @@ DESCRIPTION in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} to use the @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your - configuration is selected. - -*/ + configuration is selected. */ /* Some assumptions: * Any BFD with D_PAGED set is ZMAGIC, and vice versa. @@ -157,9 +155,8 @@ DESCRIPTION The standard records contain only an address, a symbol index, and a type field. The extended records (used on 29ks and sparcs) also have a full integer for an - addend. + addend. */ -*/ #ifndef CTOR_TABLE_RELOC_HOWTO #define CTOR_TABLE_RELOC_IDX 2 #define CTOR_TABLE_RELOC_HOWTO(BFD) \ @@ -230,7 +227,8 @@ reloc_howto_type howto_table_ext[] = /* Convert standard reloc records to "arelent" format (incl byte swap). */ -reloc_howto_type howto_table_std[] = { +reloc_howto_type howto_table_std[] = +{ /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE), HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), @@ -3067,9 +3065,10 @@ NAME(aout,link_hash_table_create) (abfd) struct aout_link_hash_table *ret; bfd_size_type amt = sizeof (struct aout_link_hash_table); - ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt); + ret = (struct aout_link_hash_table *) bfd_malloc (amt); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; + if (! NAME(aout,link_hash_table_init) (ret, abfd, NAME(aout,link_hash_newfunc))) { @@ -3906,10 +3905,8 @@ NAME(aout,final_link) (abfd, info, callback) for (o = abfd->sections; o != NULL; o = o->next) { for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = TRUE; - } + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = TRUE; } have_link_order_relocs = FALSE; diff --git a/bfd/archures.c b/bfd/archures.c index 62edda1..20087b2 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -163,7 +163,7 @@ DESCRIPTION . bfd_arch_m88k, {* Motorola 88xxx *} . bfd_arch_m98k, {* Motorola 98xxx *} . bfd_arch_pyramid, {* Pyramid Technology *} -. bfd_arch_h8300, {* Hitachi H8/300 *} +. 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 @@ -208,8 +208,8 @@ DESCRIPTION . bfd_arch_z8k, {* Zilog Z8000 *} .#define bfd_mach_z8001 1 .#define bfd_mach_z8002 2 -. bfd_arch_h8500, {* Hitachi H8/500 *} -. bfd_arch_sh, {* Hitachi SH *} +. bfd_arch_h8500, {* Renesas H8/500 (formerly Hitachi H8/500) *} +. bfd_arch_sh, {* Renesas SH (formerly Hitachi SH) *} .#define bfd_mach_sh 1 .#define bfd_mach_sh2 0x20 .#define bfd_mach_sh_dsp 0x2d @@ -224,6 +224,7 @@ DESCRIPTION .#define bfd_mach_alpha_ev5 0x20 .#define bfd_mach_alpha_ev6 0x30 . bfd_arch_arm, {* Advanced Risc Machines ARM. *} +.#define bfd_mach_arm_unknown 0 .#define bfd_mach_arm_2 1 .#define bfd_mach_arm_2a 2 .#define bfd_mach_arm_3 3 @@ -235,12 +236,13 @@ DESCRIPTION .#define bfd_mach_arm_5TE 9 .#define bfd_mach_arm_XScale 10 .#define bfd_mach_arm_ep9312 11 +.#define bfd_mach_arm_iWMMXt 12 . bfd_arch_ns32k, {* National Semiconductors ns32000 *} . bfd_arch_w65, {* WDC 65816 *} . bfd_arch_tic30, {* Texas Instruments TMS320C30 *} . bfd_arch_tic4x, {* Texas Instruments TMS320C3X/4X *} -.#define bfd_mach_c3x 30 -.#define bfd_mach_c4x 40 +.#define bfd_mach_tic3x 30 +.#define bfd_mach_tic4x 40 . bfd_arch_tic54x, {* Texas Instruments TMS320C54X *} . bfd_arch_tic80, {* TI TMS320c80 (MVP) *} . bfd_arch_v850, {* NEC V850 *} @@ -306,6 +308,8 @@ DESCRIPTION .#define bfd_mach_msp44 44 .#define bfd_mach_msp15 15 .#define bfd_mach_msp16 16 +. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *} +.#define bfd_mach_xtensa 1 . bfd_arch_last . }; */ @@ -397,6 +401,7 @@ extern const bfd_arch_info_type bfd_vax_arch; extern const bfd_arch_info_type bfd_we32k_arch; extern const bfd_arch_info_type bfd_w65_arch; extern const bfd_arch_info_type bfd_xstormy16_arch; +extern const bfd_arch_info_type bfd_xtensa_arch; extern const bfd_arch_info_type bfd_z8k_arch; static const bfd_arch_info_type * const bfd_archures_list[] = @@ -454,6 +459,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_w65_arch, &bfd_we32k_arch, &bfd_xstormy16_arch, + &bfd_xtensa_arch, &bfd_z8k_arch, #endif 0 diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 917b46f..c39bfedd 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -835,6 +835,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd PARAMS ((bfd *, struct bfd_link_info *)); +/* ARM Note section processing. */ +extern bfd_boolean bfd_arm_merge_machines + PARAMS ((bfd *, bfd *)); + +extern bfd_boolean bfd_arm_update_notes + PARAMS ((bfd *, const char *)); + +extern unsigned int bfd_arm_get_mach_from_notes + PARAMS ((bfd *, const char *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 9540eeb..d349f77 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -842,6 +842,16 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd PARAMS ((bfd *, struct bfd_link_info *)); +/* ARM Note section processing. */ +extern bfd_boolean bfd_arm_merge_machines + PARAMS ((bfd *, bfd *)); + +extern bfd_boolean bfd_arm_update_notes + PARAMS ((bfd *, const char *)); + +extern unsigned int bfd_arm_get_mach_from_notes + PARAMS ((bfd *, const char *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); @@ -1619,7 +1629,7 @@ enum bfd_architecture bfd_arch_m88k, /* Motorola 88xxx */ bfd_arch_m98k, /* Motorola 98xxx */ bfd_arch_pyramid, /* Pyramid Technology */ - bfd_arch_h8300, /* Hitachi H8/300 */ + 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 @@ -1664,8 +1674,8 @@ enum bfd_architecture bfd_arch_z8k, /* Zilog Z8000 */ #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 - bfd_arch_h8500, /* Hitachi H8/500 */ - bfd_arch_sh, /* Hitachi SH */ + bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ + bfd_arch_sh, /* Renesas SH (formerly Hitachi SH) */ #define bfd_mach_sh 1 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d @@ -1680,6 +1690,7 @@ enum bfd_architecture #define bfd_mach_alpha_ev5 0x20 #define bfd_mach_alpha_ev6 0x30 bfd_arch_arm, /* Advanced Risc Machines ARM. */ +#define bfd_mach_arm_unknown 0 #define bfd_mach_arm_2 1 #define bfd_mach_arm_2a 2 #define bfd_mach_arm_3 3 @@ -1691,12 +1702,13 @@ enum bfd_architecture #define bfd_mach_arm_5TE 9 #define bfd_mach_arm_XScale 10 #define bfd_mach_arm_ep9312 11 +#define bfd_mach_arm_iWMMXt 12 bfd_arch_ns32k, /* National Semiconductors ns32000 */ bfd_arch_w65, /* WDC 65816 */ bfd_arch_tic30, /* Texas Instruments TMS320C30 */ bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ -#define bfd_mach_c3x 30 -#define bfd_mach_c4x 40 +#define bfd_mach_tic3x 30 +#define bfd_mach_tic4x 40 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ bfd_arch_tic80, /* TI TMS320c80 (MVP) */ bfd_arch_v850, /* NEC V850 */ @@ -1762,6 +1774,8 @@ enum bfd_architecture #define bfd_mach_msp44 44 #define bfd_mach_msp15 15 #define bfd_mach_msp16 16 + bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ +#define bfd_mach_xtensa 1 bfd_arch_last }; @@ -2331,9 +2345,6 @@ to compensate for the borrow when the low bits are added. */ /* Like BFD_RELOC_LO16, but PC relative. */ BFD_RELOC_PCREL_LO16, -/* Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC. */ - BFD_RELOC_MIPSEMB_16_PCREL_S2, - /* Relocation against a MIPS literal section. */ BFD_RELOC_MIPS_LITERAL, @@ -2566,6 +2577,7 @@ field in the instruction. */ BFD_RELOC_ARM_SWI, BFD_RELOC_ARM_MULTI, BFD_RELOC_ARM_CP_OFF_IMM, + BFD_RELOC_ARM_CP_OFF_IMM_S2, BFD_RELOC_ARM_ADR_IMM, BFD_RELOC_ARM_LDR_IMM, BFD_RELOC_ARM_LITERAL, @@ -2586,7 +2598,7 @@ field in the instruction. */ BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, -/* Hitachi SH relocs. Not all of these appear in object files. */ +/* Renesas SH relocs. Not all of these appear in object files. */ BFD_RELOC_SH_PCDISP8BY2, BFD_RELOC_SH_PCDISP12BY2, BFD_RELOC_SH_IMM4, @@ -3427,6 +3439,38 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */ BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21, BFD_RELOC_IQ2000_UHI16, + +/* Special Xtensa relocation used only by PLT entries in ELF shared +objects to indicate that the runtime linker should set the value +to one of its own internal functions or data structures. */ + BFD_RELOC_XTENSA_RTLD, + +/* Xtensa relocations for ELF shared objects. */ + BFD_RELOC_XTENSA_GLOB_DAT, + BFD_RELOC_XTENSA_JMP_SLOT, + BFD_RELOC_XTENSA_RELATIVE, + +/* Xtensa relocation used in ELF object files for symbols that may require +PLT entries. Otherwise, this is just a generic 32-bit relocation. */ + BFD_RELOC_XTENSA_PLT, + +/* Generic Xtensa relocations. Only the operand number is encoded +in the relocation. The details are determined by extracting the +instruction opcode. */ + BFD_RELOC_XTENSA_OP0, + BFD_RELOC_XTENSA_OP1, + BFD_RELOC_XTENSA_OP2, + +/* Xtensa relocation to mark that the assembler expanded the +instructions from an original target. The expansion size is +encoded in the reloc size. */ + BFD_RELOC_XTENSA_ASM_EXPAND, + +/* Xtensa relocation to mark that the linker should simplify +assembler-expanded instructions. This is commonly used +internally by the linker after analysis of a +BFD_RELOC_XTENSA_ASM_EXPAND. */ + BFD_RELOC_XTENSA_ASM_SIMPLIFY, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type * @@ -4386,7 +4430,7 @@ bfd_link_split_section PARAMS ((bfd *abfd, asection *sec)); /* Extracted from simple.c. */ bfd_byte * -bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf)); +bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table)); #ifdef __cplusplus } diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 2fadcbe..f089a6c 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -2247,7 +2247,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) || obfd->xvec->flavour != bfd_target_coff_flavour) return TRUE; - /* Verify that the APCS is the same for the two BFDs */ + /* Determine what should happen if the input ARM architecture + does not match the output ARM architecture. */ + if (! bfd_arm_merge_machines (ibfd, obfd)) + return FALSE; + + /* Verify that the APCS is the same for the two BFDs. */ if (APCS_SET (ibfd)) { if (APCS_SET (obfd)) @@ -2584,7 +2589,7 @@ coff_arm_final_link_postscript (abfd, pfinfo) globals->bfd_of_glue_owner->output_has_begun = TRUE; } - return TRUE; + return bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); } #include "coffcode.h" diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 2c99af1..dab7e01 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,4 +1,4 @@ -/* BFD back-end for Hitachi H8/300 COFF binaries. +/* BFD back-end for Renesas H8/300 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c index c54d977..656bb48 100644 --- a/bfd/coff-h8500.c +++ b/bfd/coff-h8500.c @@ -1,24 +1,24 @@ -/* BFD back-end for Hitachi H8/500 COFF binaries. - Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002 +/* BFD back-end for Renesas H8/500 COFF binaries. + Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 8a4723f..bcf059d 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -1,25 +1,25 @@ -/* BFD back-end for Hitachi Super-H COFF binaries. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +/* BFD back-end for Renesas Super-H COFF binaries. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Steve Chamberlain, <sac@cygnus.com>. Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c index 3062b9f..5c8de41 100644 --- a/bfd/coff-tic4x.c +++ b/bfd/coff-tic4x.c @@ -1,6 +1,7 @@ /* BFD back-end for TMS320C4X coff binaries. - Copyright 1996, 1997, 1998, 1999, 2000, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) This file is part of BFD, the Binary File Descriptor library. @@ -365,7 +366,7 @@ static const bfd_coff_backend_data ticoff1_swap_table = /* TI COFF v0, DOS tools (little-endian headers). */ const bfd_target tic4x_coff0_vec = { - "coff0-c4x", /* Name. */ + "coff0-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -409,7 +410,7 @@ const bfd_target tic4x_coff0_vec = /* TI COFF v0, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff0_beh_vec = { - "coff0-beh-c4x", /* Name. */ + "coff0-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -454,7 +455,7 @@ const bfd_target tic4x_coff0_beh_vec = /* TI COFF v1, DOS tools (little-endian headers). */ const bfd_target tic4x_coff1_vec = { - "coff1-c4x", /* Name. */ + "coff1-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -499,7 +500,7 @@ const bfd_target tic4x_coff1_vec = /* TI COFF v1, SPARC tools (big-endian headers). */ const bfd_target tic4x_coff1_beh_vec = { - "coff1-beh-c4x", /* Name. */ + "coff1-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ @@ -544,7 +545,7 @@ const bfd_target tic4x_coff1_beh_vec = /* TI COFF v2, TI DOS tools output (little-endian headers). */ const bfd_target tic4x_coff2_vec = { - "coff2-c4x", /* Name. */ + "coff2-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_LITTLE, /* Header byte order is little (DOS tools). */ @@ -589,7 +590,7 @@ const bfd_target tic4x_coff2_vec = /* TI COFF v2, TI SPARC tools output (big-endian headers). */ const bfd_target tic4x_coff2_beh_vec = { - "coff2-beh-c4x", /* Name. */ + "coff2-beh-tic4x", /* Name. */ bfd_target_coff_flavour, BFD_ENDIAN_LITTLE, /* Data byte order is little. */ BFD_ENDIAN_BIG, /* Header byte order is big. */ diff --git a/bfd/coffcode.h b/bfd/coffcode.h index ee50a10..5c6c286 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1883,21 +1883,25 @@ coff_set_arch_mach_hook (abfd, filehdr) case ARMPEMAGIC: case THUMBPEMAGIC: arch = bfd_arch_arm; - switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) + machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); + if (machine == bfd_mach_arm_unknown) { - case F_ARM_2: machine = bfd_mach_arm_2; break; - case F_ARM_2a: machine = bfd_mach_arm_2a; break; - case F_ARM_3: machine = bfd_mach_arm_3; break; - default: - case F_ARM_3M: machine = bfd_mach_arm_3M; break; - case F_ARM_4: machine = bfd_mach_arm_4; break; - case F_ARM_4T: machine = bfd_mach_arm_4T; break; - /* The COFF header does not have enough bits available - to cover all the different ARM architectures. So - we interpret F_ARM_5, the highest flag value to mean - "the highest ARM architecture known to BFD" which is - currently the XScale. */ - case F_ARM_5: machine = bfd_mach_arm_XScale; break; + switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) + { + case F_ARM_2: machine = bfd_mach_arm_2; break; + case F_ARM_2a: machine = bfd_mach_arm_2a; break; + case F_ARM_3: machine = bfd_mach_arm_3; break; + default: + case F_ARM_3M: machine = bfd_mach_arm_3M; break; + case F_ARM_4: machine = bfd_mach_arm_4; break; + case F_ARM_4T: machine = bfd_mach_arm_4T; break; + /* The COFF header does not have enough bits available + to cover all the different ARM architectures. So + we interpret F_ARM_5, the highest flag value to mean + "the highest ARM architecture known to BFD" which is + currently the XScale. */ + case F_ARM_5: machine = bfd_mach_arm_XScale; break; + } } break; #endif diff --git a/bfd/coffgen.c b/bfd/coffgen.c index c905ab1..fcb00fc 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -226,7 +226,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f)) goto fail; - /* Now copy data as required; construct all asections etc */ + /* Now copy data as required; construct all asections etc. */ if (nscns != 0) { unsigned int i; @@ -241,8 +241,6 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) } } - /* make_abs_section (abfd); */ - return abfd->xvec; fail: diff --git a/bfd/config.bfd b/bfd/config.bfd index c678496..d034ce8 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -58,6 +58,7 @@ thumb*) targ_archs=bfd_arm_arch ;; v850*) targ_archs=bfd_v850_arch ;; x86_64) targ_archs=bfd_i386_arch ;; xscale*) targ_archs=bfd_arm_arch ;; +xtensa*) targ_archs=bfd_xtensa_arch ;; z8k*) targ_archs=bfd_z8k_arch ;; *) targ_archs=bfd_${targ_cpu}_arch ;; esac @@ -1214,6 +1215,11 @@ case "${targ}" in targ_defvec=bfd_elf32_xstormy16_vec ;; + xtensa-*-*) + targ_defvec=bfd_elf32_xtensa_le_vec + targ_selvecs=bfd_elf32_xtensa_be_vec + ;; + z8k*-*-*) targ_defvec=z8kcoff_vec targ_underscore=yes diff --git a/bfd/configure b/bfd/configure index f41ac1d..ad1475d 100755 --- a/bfd/configure +++ b/bfd/configure @@ -37,7 +37,7 @@ ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" ac_help="$ac_help - --install-libbfd controls installation of libbfd and related headers" + --enable-install-libbfd controls installation of libbfd and related headers" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help @@ -59,6 +59,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -173,6 +174,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -343,6 +345,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -508,12 +515,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -552,12 +563,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:556: checking for Cygwin environment" >&5 +echo "configure:567: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 561 "configure" +#line 572 "configure" #include "confdefs.h" int main() { @@ -568,7 +579,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -585,19 +596,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:589: checking for mingw32 environment" >&5 +echo "configure:600: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 594 "configure" +#line 605 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -662,7 +673,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:666: checking host system type" >&5 +echo "configure:677: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -683,7 +694,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:687: checking target system type" >&5 +echo "configure:698: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -701,7 +712,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:705: checking build system type" >&5 +echo "configure:716: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -726,7 +737,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:730: checking for $ac_word" >&5 +echo "configure:741: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,7 +767,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:760: checking for $ac_word" >&5 +echo "configure:771: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -807,7 +818,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:811: checking for $ac_word" >&5 +echo "configure:822: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -839,7 +850,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:843: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:854: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -850,12 +861,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 854 "configure" +#line 865 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -881,12 +892,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:885: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:896: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:890: checking whether we are using GNU C" >&5 +echo "configure:901: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -895,7 +906,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -914,7 +925,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:918: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:929: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -946,7 +957,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:950: checking for POSIXized ISC" >&5 +echo "configure:961: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -979,7 +990,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:983: checking for a BSD compatible install" >&5 +echo "configure:994: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1032,7 +1043,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1036: checking whether build environment is sane" >&5 +echo "configure:1047: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1089,7 +1100,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1093: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1104: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1135,7 +1146,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1139: checking for working aclocal" >&5 +echo "configure:1150: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1148,7 +1159,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1152: checking for working autoconf" >&5 +echo "configure:1163: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1161,7 +1172,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1165: checking for working automake" >&5 +echo "configure:1176: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1174,7 +1185,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1178: checking for working autoheader" >&5 +echo "configure:1189: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1187,7 +1198,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1191: checking for working makeinfo" >&5 +echo "configure:1202: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1222,7 +1233,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 +echo "configure:1237: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1254,7 +1265,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1258: checking for $ac_word" >&5 +echo "configure:1269: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1286,7 +1297,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1290: checking for $ac_word" >&5 +echo "configure:1301: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1401,7 +1412,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1405: checking for ld used by GCC" >&5 +echo "configure:1416: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1431,10 +1442,10 @@ echo "configure:1405: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1435: checking for GNU ld" >&5 +echo "configure:1446: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1438: checking for non-GNU ld" >&5 +echo "configure:1449: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1469,7 +1480,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1473: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1484: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1486,7 +1497,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1490: checking for $LD option to reload object files" >&5 +echo "configure:1501: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1498,7 +1509,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1502: checking for BSD-compatible nm" >&5 +echo "configure:1513: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1536,7 +1547,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1540: checking whether ln -s works" >&5 +echo "configure:1551: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1557,7 +1568,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1561: checking how to recognise dependant libraries" >&5 +echo "configure:1572: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1730,13 +1741,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1734: checking for object suffix" >&5 +echo "configure:1745: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1756,7 +1767,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1760: checking for executable suffix" >&5 +echo "configure:1771: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1766,10 +1777,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1793,7 +1804,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1797: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1808: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1855,7 +1866,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1859: checking for file" >&5 +echo "configure:1870: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1926,7 +1937,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1930: checking for $ac_word" >&5 +echo "configure:1941: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1958,7 +1969,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1962: checking for $ac_word" >&5 +echo "configure:1973: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1993,7 +2004,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1997: checking for $ac_word" >&5 +echo "configure:2008: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2025,7 +2036,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2029: checking for $ac_word" >&5 +echo "configure:2040: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2092,8 +2103,21 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2096 "configure"' > conftest.$ac_ext - if { (eval echo configure:2097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2107 "configure"' > conftest.$ac_ext + if { (eval echo configure:2108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2105,6 +2129,7 @@ case $host in LD="${LD-ld} -64" ;; esac + fi fi rm -rf conftest* ;; @@ -2112,7 +2137,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2130,7 +2155,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2134: checking whether the C compiler needs -belf" >&5 +echo "configure:2159: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2143,14 +2168,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 2147 "configure" +#line 2172 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2340,7 +2365,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2344: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2369: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2363,7 +2388,7 @@ fi echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2367: checking whether to install libbfd" >&5 +echo "configure:2392: checking whether to install libbfd" >&5 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2400,7 +2425,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2404: checking for executable suffix" >&5 +echo "configure:2429: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2410,10 +2435,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2440,7 +2465,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2444: checking for $ac_word" >&5 +echo "configure:2469: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2470,7 +2495,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2474: checking for $ac_word" >&5 +echo "configure:2499: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2546,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2525: checking for $ac_word" >&5 +echo "configure:2550: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2553,7 +2578,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2557: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2582: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2564,12 +2589,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2568 "configure" +#line 2593 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2595,12 +2620,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2599: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2624: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2604: checking whether we are using GNU C" >&5 +echo "configure:2629: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2609,7 +2634,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2628,7 +2653,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2632: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2657: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2660,9 +2685,9 @@ else fi -ALL_LINGUAS="fr tr ja es sv da" +ALL_LINGUAS="fr tr ja es sv da zh_CN" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2666: checking how to run the C preprocessor" >&5 +echo "configure:2691: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2677,13 +2702,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2681 "configure" +#line 2706 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2687: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2694,13 +2719,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2698 "configure" +#line 2723 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2711,13 +2736,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2715 "configure" +#line 2740 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2744,7 +2769,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2748: checking for $ac_word" >&5 +echo "configure:2773: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2772,12 +2797,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2776: checking for ANSI C header files" >&5 +echo "configure:2801: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2781 "configure" +#line 2806 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2785,7 +2810,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2802,7 +2827,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2806 "configure" +#line 2831 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2820,7 +2845,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2824 "configure" +#line 2849 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2841,7 +2866,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2845 "configure" +#line 2870 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2852,7 +2877,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2876,12 +2901,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2880: checking for working const" >&5 +echo "configure:2905: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2885 "configure" +#line 2910 "configure" #include "confdefs.h" int main() { @@ -2930,7 +2955,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2951,21 +2976,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2955: checking for inline" >&5 +echo "configure:2980: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2962 "configure" +#line 2987 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2994: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2991,12 +3016,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2995: checking for off_t" >&5 +echo "configure:3020: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3000 "configure" +#line 3025 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3024,12 +3049,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3028: checking for size_t" >&5 +echo "configure:3053: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3033 "configure" +#line 3058 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3059,19 +3084,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3063: checking for working alloca.h" >&5 +echo "configure:3088: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3068 "configure" +#line 3093 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3092,12 +3117,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3096: checking for alloca" >&5 +echo "configure:3121: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3101 "configure" +#line 3126 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3125,7 +3150,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3157,12 +3182,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3161: checking whether alloca needs Cray hooks" >&5 +echo "configure:3186: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3166 "configure" +#line 3191 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3187,12 +3212,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3191: checking for $ac_func" >&5 +echo "configure:3216: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3196 "configure" +#line 3221 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3215,7 +3240,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3242,7 +3267,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3246: checking stack direction for C alloca" >&5 +echo "configure:3271: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3250,7 +3275,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3254 "configure" +#line 3279 "configure" #include "confdefs.h" find_stack_direction () { @@ -3269,7 +3294,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3290,21 +3315,21 @@ EOF fi -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3298: checking for $ac_hdr" >&5 +echo "configure:3323: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3303 "configure" +#line 3328 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3333,12 +3358,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3337: checking for $ac_func" >&5 +echo "configure:3362: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3342 "configure" +#line 3367 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3361,7 +3386,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3386,7 +3411,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3390: checking for working mmap" >&5 +echo "configure:3415: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3394,7 +3419,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3398 "configure" +#line 3423 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3422,24 +3447,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3547,7 +3559,7 @@ main() } EOF -if { (eval echo configure:3551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3575,17 +3587,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3579: checking for $ac_hdr" >&5 +echo "configure:3591: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3584 "configure" +#line 3596 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3615,12 +3627,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3619: checking for $ac_func" >&5 +echo "configure:3631: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3624 "configure" +#line 3636 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3643,7 +3655,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3672,12 +3684,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3676: checking for $ac_func" >&5 +echo "configure:3688: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3681 "configure" +#line 3693 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3700,7 +3712,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3734,19 +3746,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3738: checking for LC_MESSAGES" >&5 +echo "configure:3750: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3743 "configure" +#line 3755 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3767,7 +3779,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3771: checking whether NLS is requested" >&5 +echo "configure:3783: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3787,7 +3799,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3791: checking whether included gettext is requested" >&5 +echo "configure:3803: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3806,17 +3818,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3810: checking for libintl.h" >&5 +echo "configure:3822: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3815 "configure" +#line 3827 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3833,19 +3845,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3837: checking for gettext in libc" >&5 +echo "configure:3849: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3842 "configure" +#line 3854 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3861,7 +3873,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3865: checking for bindtextdomain in -lintl" >&5 +echo "configure:3877: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3869,7 +3881,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3873 "configure" +#line 3885 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3880,7 +3892,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3896,19 +3908,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3900: checking for gettext in libintl" >&5 +echo "configure:3912: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3905 "configure" +#line 3917 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3936,7 +3948,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3940: checking for $ac_word" >&5 +echo "configure:3952: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3970,12 +3982,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3974: checking for $ac_func" >&5 +echo "configure:3986: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3979 "configure" +#line 3991 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3998,7 +4010,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4025,7 +4037,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4029: checking for $ac_word" >&5 +echo "configure:4041: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4061,7 +4073,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4065: checking for $ac_word" >&5 +echo "configure:4077: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4093,7 +4105,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4097 "configure" +#line 4109 "configure" #include "confdefs.h" int main() { @@ -4101,7 +4113,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4133,7 +4145,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4137: checking for $ac_word" >&5 +echo "configure:4149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4167,7 +4179,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4171: checking for $ac_word" >&5 +echo "configure:4183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4203,7 +4215,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4207: checking for $ac_word" >&5 +echo "configure:4219: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4293,7 +4305,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4297: checking for catalogs to be installed" >&5 +echo "configure:4309: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4321,17 +4333,17 @@ echo "configure:4297: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4325: checking for linux/version.h" >&5 +echo "configure:4337: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4330 "configure" +#line 4342 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4409,7 +4421,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4413: checking for a BSD compatible install" >&5 +echo "configure:4425: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4492,7 +4504,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4496: checking for build system executable suffix" >&5 +echo "configure:4508: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4520,17 +4532,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4524: checking for $ac_hdr" >&5 +echo "configure:4536: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4529 "configure" +#line 4541 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4560,17 +4572,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4564: checking for $ac_hdr" >&5 +echo "configure:4576: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4569 "configure" +#line 4581 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4597,12 +4609,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4601: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4613: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4606 "configure" +#line 4618 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -4611,7 +4623,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4636,12 +4648,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4640: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4652: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4645 "configure" +#line 4657 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4649,7 +4661,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4674,7 +4686,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4678: checking for opendir in -ldir" >&5 +echo "configure:4690: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4682,7 +4694,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4686 "configure" +#line 4698 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4693,7 +4705,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4715,7 +4727,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4719: checking for opendir in -lx" >&5 +echo "configure:4731: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4723,7 +4735,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4727 "configure" +#line 4739 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4734,7 +4746,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4759,12 +4771,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4763: checking for $ac_func" >&5 +echo "configure:4775: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4768 "configure" +#line 4780 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4787,7 +4799,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4822,12 +4834,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4826: checking whether strstr must be declared" >&5 +echo "configure:4838: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4831 "configure" +#line 4843 "configure" #include "confdefs.h" #include <stdio.h> @@ -4848,7 +4860,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4869,12 +4881,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4873: checking whether malloc must be declared" >&5 +echo "configure:4885: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4878 "configure" +#line 4890 "configure" #include "confdefs.h" #include <stdio.h> @@ -4895,7 +4907,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4916,12 +4928,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4920: checking whether realloc must be declared" >&5 +echo "configure:4932: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4925 "configure" +#line 4937 "configure" #include "confdefs.h" #include <stdio.h> @@ -4942,7 +4954,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4963,12 +4975,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4967: checking whether free must be declared" >&5 +echo "configure:4979: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4972 "configure" +#line 4984 "configure" #include "confdefs.h" #include <stdio.h> @@ -4989,7 +5001,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -5010,12 +5022,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5014: checking whether getenv must be declared" >&5 +echo "configure:5026: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5019 "configure" +#line 5031 "configure" #include "confdefs.h" #include <stdio.h> @@ -5036,7 +5048,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5223,16 +5235,16 @@ if test "${target}" = "${host}"; then # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 -echo "configure:5227: checking for c_impl in struct core_dumpx" >&5 +echo "configure:5239: checking for c_impl in struct core_dumpx" >&5 cat > conftest.$ac_ext <<EOF -#line 5229 "configure" +#line 5241 "configure" #include "confdefs.h" #include <core.h> int main() { struct core_dumpx c; c.c_impl = 0; ; return 0; } EOF -if { (eval echo configure:5236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ST_C_IMPL 1 @@ -5300,17 +5312,17 @@ rm -f conftest* do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5304: checking for $ac_hdr" >&5 +echo "configure:5316: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5309 "configure" +#line 5321 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5338,12 +5350,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5342: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5354: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5347 "configure" +#line 5359 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5352,7 +5364,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5374,12 +5386,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5378: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5390: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5383 "configure" +#line 5395 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5388,7 +5400,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5410,12 +5422,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5414: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5426: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5419 "configure" +#line 5431 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5424,7 +5436,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5446,12 +5458,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5450: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5462: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5455 "configure" +#line 5467 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5460,7 +5472,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5482,12 +5494,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5486: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5498: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5491 "configure" +#line 5503 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5496,7 +5508,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5518,12 +5530,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5522: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5534: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5527 "configure" +#line 5539 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5532,7 +5544,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5536: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5554,12 +5566,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5558: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5570: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5563 "configure" +#line 5575 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5568,7 +5580,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5590,12 +5602,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5594: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5606: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5599 "configure" +#line 5611 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5604,7 +5616,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5620: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5626,12 +5638,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5630: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5642: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5635 "configure" +#line 5647 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5640,7 +5652,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5662,12 +5674,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5666: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5678: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5671 "configure" +#line 5683 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5676,7 +5688,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5692: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5698,12 +5710,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5702: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5714: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5707 "configure" +#line 5719 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5712,7 +5724,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5734,12 +5746,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5738: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5750: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5743 "configure" +#line 5755 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5748,7 +5760,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5770,12 +5782,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5774: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5786: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5779 "configure" +#line 5791 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5784,7 +5796,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5806,12 +5818,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5810: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5822: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5815 "configure" +#line 5827 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5820,7 +5832,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:5824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5842,12 +5854,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5846: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5858: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5851 "configure" +#line 5863 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5856,7 +5868,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5878,12 +5890,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5882: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5894: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5887 "configure" +#line 5899 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5892,7 +5904,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -6143,6 +6155,8 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; @@ -6360,10 +6374,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6363: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6378: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6366 "configure" +#line 6381 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6405,21 +6419,21 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6412: checking for $ac_hdr" >&5 +echo "configure:6427: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6417 "configure" +#line 6432 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6437: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6448,12 +6462,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6451: checking for $ac_func" >&5 +echo "configure:6466: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6456 "configure" +#line 6471 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6476,7 +6490,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6501,7 +6515,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6504: checking for working mmap" >&5 +echo "configure:6519: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6509,7 +6523,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6512 "configure" +#line 6527 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6537,24 +6551,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -6662,7 +6663,7 @@ main() } EOF -if { (eval echo configure:6665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6687,12 +6688,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6690: checking for $ac_func" >&5 +echo "configure:6692: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6695 "configure" +#line 6697 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6715,7 +6716,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index 82dc090..347ad97 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -103,7 +103,7 @@ bfd_default_target_size=32 AC_PROG_CC -ALL_LINGUAS="fr tr ja es sv da" +ALL_LINGUAS="fr tr ja es sv da zh_CN" CY_GNU_GETTEXT # Permit host specific settings. @@ -639,6 +639,8 @@ do bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; + bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index 923c250..66c3a46 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -1,5 +1,5 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -21,11 +21,14 @@ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "libiberty.h" static const bfd_arch_info_type * compatible PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); static bfd_boolean scan PARAMS ((const struct bfd_arch_info *, const char *)); +static bfd_boolean arm_check_note + PARAMS ((bfd *, char *, bfd_size_type, const char *, char **)); /* This routine is provided two arch_infos and works out which ARM machine which would be compatible with both and returns a pointer @@ -96,7 +99,8 @@ processors[] = { bfd_mach_arm_4, "strongarm110" }, { bfd_mach_arm_4, "strongarm1100" }, { bfd_mach_arm_XScale, "xscale" }, - { bfd_mach_arm_ep9312, "ep9312" } + { bfd_mach_arm_ep9312, "ep9312" }, + { bfd_mach_arm_iWMMXt, "iwmmxt" } }; static bfd_boolean @@ -142,8 +146,282 @@ static const bfd_arch_info_type arch_info_struct[] = N (bfd_mach_arm_5T, "armv5t", FALSE, & arch_info_struct[8]), N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]), N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]), - N (bfd_mach_arm_ep9312, "ep9312", FALSE, NULL) + N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]), + N (bfd_mach_arm_iWMMXt,"iwmmxt", FALSE, NULL) }; const bfd_arch_info_type bfd_arm_arch = N (0, "arm", TRUE, & arch_info_struct[0]); + +/* Support functions used by both the COFF and ELF versions of the ARM port. */ + +/* Handle the mergeing of the 'machine' settings of input file IBFD + and an output file OBFD. These values actually represent the + different possible ARM architecture variants. + Returns TRUE if they were merged successfully or FALSE otherwise. */ + +bfd_boolean +bfd_arm_merge_machines (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + unsigned int in = bfd_get_mach (ibfd); + unsigned int out = bfd_get_mach (obfd); + + /* If the output architecture is unknown, we now have a value to set. */ + if (out == bfd_mach_arm_unknown) + bfd_set_arch_mach (obfd, bfd_arch_arm, in); + + /* If the input architecure is unknown, + then so must be the output architecture. */ + else if (in == bfd_mach_arm_unknown) + /* FIXME: We ought to have some way to + override this on the command line. */ + bfd_set_arch_mach (obfd, bfd_arch_arm, bfd_mach_arm_unknown); + + /* If they are the same then nothing needs to be done. */ + else if (out == in) + ; + + /* Otherwise the general principle that a earlier architecture can be + linked with a later architecure to produce a binary that will execute + on the later architecture. + + We fail however if we attempt to link a Cirrus EP9312 binary with an + Intel XScale binary, since these architecture have co-processors which + will not both be present on the same physical hardware. */ + else if (in == bfd_mach_arm_ep9312 + && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt)) + { + _bfd_error_handler (_("\ +ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), + bfd_archive_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + else if (out == bfd_mach_arm_ep9312 + && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt)) + { + _bfd_error_handler (_("\ +ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), + bfd_archive_filename (obfd), + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + else if (in > out) + bfd_set_arch_mach (obfd, bfd_arch_arm, in); + /* else + Nothing to do. */ + + return TRUE; +} + +typedef struct +{ + unsigned char namesz[4]; /* Size of entry's owner string. */ + unsigned char descsz[4]; /* Size of the note descriptor. */ + unsigned char type[4]; /* Interpretation of the descriptor. */ + char name[1]; /* Start of the name+desc data. */ +} arm_Note; + +static bfd_boolean +arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) + bfd * abfd; + char * buffer; + bfd_size_type buffer_size; + const char * expected_name; + char ** description_return; +{ + unsigned long namesz; + unsigned long descsz; + unsigned long type; + char * descr; + + if (buffer_size < offsetof (arm_Note, name)) + return FALSE; + + /* We have to extract the values this way to allow for a + host whose endian-ness is different from the target. */ + namesz = bfd_get_32 (abfd, buffer); + descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz)); + type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type)); + descr = buffer + offsetof (arm_Note, name); + + /* Check for buffer overflow. */ + if (namesz + descsz + offsetof (arm_Note, name) > buffer_size) + return FALSE; + + if (expected_name == NULL) + { + if (namesz != 0) + return FALSE; + } + else + { + if (namesz != (strlen (expected_name) + 1 + 3) & ~3) + return FALSE; + + if (strcmp (descr, expected_name) != 0) + return FALSE; + + descr += (namesz + 3) & ~3; + } + + /* FIXME: We should probably check the type as well. */ + + if (description_return != NULL) + * description_return = descr; + + return TRUE; +} + +#define NOTE_ARCH_STRING "arch: " + +bfd_boolean +bfd_arm_update_notes (abfd, note_section) + bfd * abfd; + const char * note_section; +{ + asection * arm_arch_section; + bfd_size_type buffer_size; + char * buffer; + char * arch_string; + char * expected; + + /* Look for a note section. If one is present check the architecture + string encoded in it, and set it to the current architecture if it is + different. */ + arm_arch_section = bfd_get_section_by_name (abfd, note_section); + + if (arm_arch_section == NULL) + return TRUE; + + buffer_size = arm_arch_section->_raw_size; + if (buffer_size == 0) + return FALSE; + + buffer = bfd_malloc (buffer_size); + if (buffer == NULL) + return FALSE; + + if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + goto FAIL; + + /* Parse the note. */ + if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string)) + goto FAIL; + + /* Check the architecture in the note against the architecture of the bfd. */ + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_arm_unknown: expected = "unknown"; break; + case bfd_mach_arm_2: expected = "armv2"; break; + case bfd_mach_arm_2a: expected = "armv2a"; break; + case bfd_mach_arm_3: expected = "armv3"; break; + case bfd_mach_arm_3M: expected = "armv3M"; break; + case bfd_mach_arm_4: expected = "armv4"; break; + case bfd_mach_arm_4T: expected = "armv4t"; break; + case bfd_mach_arm_5: expected = "armv5"; break; + case bfd_mach_arm_5T: expected = "armv5t"; break; + case bfd_mach_arm_5TE: expected = "armv5te"; break; + case bfd_mach_arm_XScale: expected = "XScale"; break; + case bfd_mach_arm_ep9312: expected = "ep9312"; break; + case bfd_mach_arm_iWMMXt: expected = "iWMMXt"; break; + } + + if (strcmp (arch_string, expected) != 0) + { + strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected); + + if (! bfd_set_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + { + (*_bfd_error_handler) + (_("warning: unable to update contents of %s section in %s"), + note_section, bfd_get_filename (abfd)); + goto FAIL; + } + } + + free (buffer); + return TRUE; + + FAIL: + free (buffer); + return FALSE; +} + + +static struct +{ + const char * string; + unsigned int mach; +} +architectures[] = +{ + { "armv2", bfd_mach_arm_2 }, + { "armv2a", bfd_mach_arm_2a }, + { "armv3", bfd_mach_arm_3 }, + { "armv3M", bfd_mach_arm_3M }, + { "armv4", bfd_mach_arm_4 }, + { "armv4t", bfd_mach_arm_4T }, + { "armv5", bfd_mach_arm_5 }, + { "armv5t", bfd_mach_arm_5T }, + { "armv5te", bfd_mach_arm_5TE }, + { "XScale", bfd_mach_arm_XScale }, + { "ep9312", bfd_mach_arm_ep9312 }, + { "iWMMXt", bfd_mach_arm_iWMMXt } +}; + +/* Extract the machine number stored in a note section. */ +unsigned int +bfd_arm_get_mach_from_notes (abfd, note_section) + bfd * abfd; + const char * note_section; +{ + asection * arm_arch_section; + bfd_size_type buffer_size; + char * buffer; + char * arch_string; + int i; + + /* Look for a note section. If one is present check the architecture + string encoded in it, and set it to the current architecture if it is + different. */ + arm_arch_section = bfd_get_section_by_name (abfd, note_section); + + if (arm_arch_section == NULL) + return bfd_mach_arm_unknown; + + buffer_size = arm_arch_section->_raw_size; + if (buffer_size == 0) + return bfd_mach_arm_unknown; + + buffer = bfd_malloc (buffer_size); + if (buffer == NULL) + return bfd_mach_arm_unknown; + + if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, + (file_ptr) 0, buffer_size)) + goto FAIL; + + /* Parse the note. */ + if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string)) + goto FAIL; + + /* Interpret the architecture string. */ + for (i = ARRAY_SIZE (architectures); i--;) + if (strcmp (arch_string, architectures[i].string) == 0) + { + free (buffer); + return architectures[i].mach; + } + + FAIL: + free (buffer); + return bfd_mach_arm_unknown; +} diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index eafcb98..daef763 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -1,23 +1,23 @@ -/* BFD library support routines for the Hitachi H8/300 architecture. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002 +/* BFD library support routines for the Renesas H8/300 architecture. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c index 9d9087f..fc4bf42 100644 --- a/bfd/cpu-sh.c +++ b/bfd/cpu-sh.c @@ -1,4 +1,4 @@ -/* BFD library support routines for the Hitachi-SH architecture. +/* BFD library support routines for the Renesas 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/cpu-tic4x.c b/bfd/cpu-tic4x.c index 2260f70..a7f40e1 100644 --- a/bfd/cpu-tic4x.c +++ b/bfd/cpu-tic4x.c @@ -1,5 +1,5 @@ /* bfd back-end for TMS320C[34]x support - Copyright 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) @@ -23,12 +23,12 @@ #include "sysdep.h" #include "libbfd.h" -static bfd_boolean c4x_scan +static bfd_boolean tic4x_scan PARAMS ((const struct bfd_arch_info *, const char * )); static bfd_boolean -c4x_scan (info, string) +tic4x_scan (info, string) const struct bfd_arch_info *info; const char *string; { @@ -42,9 +42,9 @@ c4x_scan (info, string) return FALSE; if (*string == '3') - return (info->mach == bfd_mach_c3x); + return (info->mach == bfd_mach_tic3x); else if (*string == '4') - return info->mach == bfd_mach_c4x; + return info->mach == bfd_mach_tic4x; return FALSE; } @@ -56,13 +56,13 @@ const bfd_arch_info_type bfd_tic3x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c3x, /* Machine number. */ - "c3x", /* Architecture name. */ + bfd_mach_tic3x, /* Machine number. */ + "tic3x", /* Architecture name. */ "tms320c3x", /* Printable name. */ 0, /* Alignment power. */ FALSE, /* Not the default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, 0 }; @@ -72,13 +72,13 @@ const bfd_arch_info_type bfd_tic4x_arch = 32, /* 32 bits in an address. */ 32, /* 32 bits in a byte. */ bfd_arch_tic4x, - bfd_mach_c4x, /* Machine number. */ - "c4x", /* Architecture name. */ + bfd_mach_tic4x, /* Machine number. */ + "tic4x", /* Architecture name. */ "tms320c4x", /* Printable name. */ 0, /* Alignment power. */ TRUE, /* The default architecture. */ bfd_default_compatible, - c4x_scan, + tic4x_scan, &bfd_tic3x_arch, }; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index e7077a1..7a9e5b0 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1,5 +1,5 @@ /* DWARF 2 support. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions @@ -245,8 +245,6 @@ static bfd_boolean lookup_address_in_line_info_table static bfd_boolean lookup_address_in_function_table PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **)); static bfd_boolean scan_unit_for_functions PARAMS ((struct comp_unit *)); -static bfd_vma find_rela_addend - PARAMS ((bfd *, asection *, bfd_size_type, asymbol**)); static struct comp_unit *parse_comp_unit PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int)); static bfd_boolean comp_unit_contains_address @@ -546,13 +544,11 @@ read_abbrevs (abfd, offset, stash) } stash->dwarf_abbrev_size = msec->_raw_size; - stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size); + stash->dwarf_abbrev_buffer + = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, + stash->syms); if (! stash->dwarf_abbrev_buffer) return 0; - - if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer, - (bfd_vma) 0, msec->_raw_size)) - return 0; } if (offset >= stash->dwarf_abbrev_size) @@ -654,7 +650,7 @@ read_attribute_value (attr, form, unit, info_ptr) switch (form) { case DW_FORM_addr: - /* FIXME: DWARF3 draft sais DW_FORM_ref_addr is offset_size. */ + /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */ case DW_FORM_ref_addr: DW_ADDR (attr) = read_address (unit, info_ptr); info_ptr += unit->addr_size; @@ -821,11 +817,11 @@ struct funcinfo bfd_vma high; }; -/* add_line_info: adds a new entry to the line_info list in the - line_info_table, ensuring that the list is sorted. Note that the - line_info list is sorted from highest to lowest VMA (with possible - duplicates); that is, line_info->prev_line always accesses an equal - or smaller VMA. */ +/* Adds a new entry to the line_info list in the line_info_table, ensuring + that the list is sorted. Note that the line_info list is sorted from + highest to lowest VMA (with possible duplicates); that is, + line_info->prev_line always accesses an equal or smaller VMA. */ + static void add_line_info (table, address, filename, line, column, end_sequence) struct line_info_table* table; @@ -905,12 +901,25 @@ add_line_info (table, address, filename, line, column, end_sequence) /* Set member data of 'info'. */ info->address = address; - info->filename = filename; info->line = line; info->column = column; info->end_sequence = end_sequence; + + amt = strlen (filename); + if (amt) + { + info->filename = bfd_alloc (table->abfd, amt + 1); + if (info->filename) + strcpy (info->filename, filename); + } + else + info->filename = NULL; } +/* Extract a fully qualified filename from a line info table. + The returned string has been malloc'ed and it is the caller's + responsibility to free it. */ + static char * concat_filename (table, file) struct line_info_table* table; @@ -922,25 +931,32 @@ concat_filename (table, file) { (*_bfd_error_handler) (_("Dwarf Error: mangled line number section (bad file number).")); - return "<unknown>"; + return strdup ("<unknown>"); } filename = table->files[file - 1].name; - if (IS_ABSOLUTE_PATH(filename)) - return filename; - else + + if (! IS_ABSOLUTE_PATH (filename)) { char* dirname = (table->files[file - 1].dir ? table->dirs[table->files[file - 1].dir - 1] : table->comp_dir); - /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The - best we can do is return the filename part. */ - if (dirname == NULL) - return filename; - else - return (char*) concat (dirname, "/", filename, NULL); + /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. + The best we can do is return the filename part. */ + if (dirname != NULL) + { + unsigned int len = strlen (dirname) + strlen (filename) + 2; + char * name; + + name = bfd_malloc (len); + if (name) + sprintf (name, "%s/%s", dirname, filename); + return name; + } } + + return strdup (filename); } static void @@ -1019,21 +1035,15 @@ decode_line_info (unit, stash) } stash->dwarf_line_size = msec->_raw_size; - stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size); + stash->dwarf_line_buffer + = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, + stash->syms); if (! stash->dwarf_line_buffer) return 0; - - if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer, - (bfd_vma) 0, msec->_raw_size)) - return 0; - - /* FIXME: We ought to apply the relocs against this section before - we process it... */ } - /* Since we are using un-relocated data, it is possible to get a bad value - for the line_offset. Validate it here so that we won't get a segfault - below. */ + /* It is possible to get a bad value for the line_offset. Validate + it here so that we won't get a segfault below. */ if (unit->line_offset >= stash->dwarf_line_size) { (*_bfd_error_handler) (_("Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)."), @@ -1272,6 +1282,8 @@ decode_line_info (unit, stash) based, the references are 1 based. */ file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; + if (filename) + free (filename); filename = concat_filename (table, file); break; } @@ -1296,6 +1308,7 @@ decode_line_info (unit, stash) default: { int i; + /* Unknown standard opcode, ignore it. */ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) { @@ -1305,6 +1318,9 @@ decode_line_info (unit, stash) } } } + + if (filename) + free (filename); } return table; @@ -1521,60 +1537,6 @@ scan_unit_for_functions (unit) return TRUE; } -/* Look for a RELA relocation to be applied on OFFSET of section SEC, - and return the addend if such a relocation is found. Since this is - only used to find relocations referring to the .debug_abbrev - section, we make sure the relocation refers to this section, but - this is not strictly necessary, and it can probably be safely - removed if needed. However, it is important to note that this - function only returns the addend, it doesn't serve the purpose of - applying a generic relocation. - - If no suitable relocation is found, or if it is not a real RELA - relocation, this function returns 0. */ - -static bfd_vma -find_rela_addend (abfd, sec, offset, syms) - bfd* abfd; - asection* sec; - bfd_size_type offset; - asymbol** syms; -{ - long reloc_size = bfd_get_reloc_upper_bound (abfd, sec); - arelent **relocs = NULL; - long reloc_count, relc; - - if (reloc_size <= 0) - return 0; - - relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); - if (relocs == NULL) - return 0; - - reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, syms); - - if (reloc_count <= 0) - { - free (relocs); - return 0; - } - - for (relc = 0; relc < reloc_count; relc++) - if (relocs[relc]->address == offset - && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM - && strcmp ((*relocs[relc]->sym_ptr_ptr)->name, - ".debug_abbrev") == 0) - { - bfd_vma addend = (relocs[relc]->howto->partial_inplace - ? 0 : relocs[relc]->addend); - free (relocs); - return addend; - } - - free (relocs); - return 0; -} - /* Parse a DWARF2 compilation unit starting at INFO_PTR. This includes the compilation unit header that proceeds the DIE's, but does not include the length field that preceeds each compilation @@ -1602,7 +1564,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size) char *info_ptr = stash->info_ptr; char *end_ptr = info_ptr + unit_length; bfd_size_type amt; - bfd_size_type off; version = read_2_bytes (abfd, info_ptr); info_ptr += 2; @@ -1611,12 +1572,6 @@ parse_comp_unit (abfd, stash, unit_length, offset_size) abbrev_offset = read_4_bytes (abfd, info_ptr); else abbrev_offset = read_8_bytes (abfd, info_ptr); - /* The abbrev offset is generally a relocation pointing to - .debug_abbrev+offset. On RELA targets, we have to find the - relocation and extract the addend to obtain the actual - abbrev_offset, so do it here. */ - off = info_ptr - stash->sec_info_ptr; - abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms); info_ptr += offset_size; addr_size = read_1_byte (abfd, info_ptr); info_ptr += 1; @@ -1939,8 +1894,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, start = stash->info_ptr_end - stash->info_ptr; - if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, - (bfd_vma) 0, size)) + if ((bfd_simple_get_relocated_section_contents + (abfd, msec, stash->info_ptr + start, symbols)) == NULL) continue; stash->info_ptr_end = stash->info_ptr + start + size; @@ -1953,21 +1908,6 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, stash->syms = symbols; } - /* FIXME: There is a problem with the contents of the - .debug_info section. The 'low' and 'high' addresses of the - comp_units are computed by relocs against symbols in the - .text segment. We need these addresses in order to determine - the nearest line number, and so we have to resolve the - relocs. There is a similar problem when the .debug_line - section is processed as well (e.g., there may be relocs - against the operand of the DW_LNE_set_address operator). - - Unfortunately getting hold of the reloc information is hard... - - For now, this means that disassembling object files (as - opposed to fully executables) does not always work as well as - we would like. */ - /* A null info_ptr indicates that there is no dwarf2 info (or that an error occured while setting up the stash). */ if (! stash->info_ptr) @@ -1987,26 +1927,34 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, bfd_boolean found; unsigned int offset_size = addr_size; - if (addr_size == 4) + length = read_4_bytes (abfd, stash->info_ptr); + /* A 0xffffff length is the DWARF3 way of indicating we use + 64-bit offsets, instead of 32-bit offsets. */ + if (length == 0xffffffff) { - length = read_4_bytes (abfd, stash->info_ptr); - if (length == 0xffffffff) - { - offset_size = 8; - length = read_8_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 8; - } - else if (length == 0) - { - /* Handle (non-standard) 64-bit DWARF2 formats. */ - offset_size = 8; - length = read_4_bytes (abfd, stash->info_ptr + 4); - stash->info_ptr += 4; - } + offset_size = 8; + length = read_8_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 12; + } + /* A zero length is the IRIX way of indicating 64-bit offsets, + mostly because the 64-bit length will generally fit in 32 + bits, and the endianness helps. */ + else if (length == 0) + { + offset_size = 8; + length = read_4_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 8; + } + /* In the absence of the hints above, we assume addr_size-sized + offsets, for backward-compatibility with pre-DWARF3 64-bit + platforms. */ + else if (addr_size == 8) + { + length = read_8_bytes (abfd, stash->info_ptr); + stash->info_ptr += 8; } else - length = read_8_bytes (abfd, stash->info_ptr); - stash->info_ptr += addr_size; + stash->info_ptr += 4; if (length > 0) { @@ -2034,10 +1982,10 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, { if (comp_unit_contains_address (each, addr)) return comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash); } else { diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 7764074..7d0b52b 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -2,21 +2,21 @@ Copyright 2001, 2002, 2003 Free Software Foundation, Inc. Written by Jakub Jelinek <jakub@redhat.com>. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -39,7 +39,7 @@ static void write_value static int cie_compare PARAMS ((struct cie *, struct cie *)); static int vma_compare - PARAMS ((const PTR a, const PTR b)); + PARAMS ((const PTR, const PTR)); /* Helper function for reading uleb128 encoded data. */ @@ -1112,7 +1112,7 @@ vma_compare (a, b) fde_count x [encoded] initial_loc, fde (array of encoded pairs containing FDE initial_location field and FDE address, - sorted by increasing initial_loc) */ + sorted by increasing initial_loc). */ bfd_boolean _bfd_elf_write_section_eh_frame_hdr (abfd, info) @@ -1125,6 +1125,7 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) bfd_byte *contents; asection *eh_frame_sec; bfd_size_type size; + bfd_boolean retval; htab = elf_hash_table (info); hdr_info = &htab->eh_info; @@ -1141,15 +1142,18 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame"); if (eh_frame_sec == NULL) - return FALSE; + { + free (contents); + return FALSE; + } memset (contents, 0, EH_FRAME_HDR_SIZE); - contents[0] = 1; /* Version */ - contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset */ + contents[0] = 1; /* Version. */ + contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset. */ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count) { - contents[2] = DW_EH_PE_udata4; /* FDE count encoding */ - contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* search table enc */ + contents[2] = DW_EH_PE_udata4; /* FDE count encoding. */ + contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* Search table enc. */ } else { @@ -1177,7 +1181,9 @@ _bfd_elf_write_section_eh_frame_hdr (abfd, info) } } - return bfd_set_section_contents (abfd, sec->output_section, - contents, (file_ptr) sec->output_offset, - sec->_cooked_size); + retval = bfd_set_section_contents (abfd, sec->output_section, + contents, (file_ptr) sec->output_offset, + sec->_cooked_size); + free (contents); + return retval; } @@ -5068,7 +5068,10 @@ copy_private_bfd_data (ibfd, obfd) amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); map = (struct elf_segment_map *) bfd_alloc (obfd, amt); if (map == NULL) - return FALSE; + { + free (sections); + return FALSE; + } /* Initialise the fields of the segment map. Set the physical physical address to the LMA of the first section that has @@ -5303,7 +5306,10 @@ swap_out_syms (abfd, sttp, relocatable_p) amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym; outbound_syms = bfd_alloc (abfd, amt); if (outbound_syms == NULL) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } symtab_hdr->contents = (PTR) outbound_syms; outbound_shndx = NULL; @@ -5313,7 +5319,11 @@ swap_out_syms (abfd, sttp, relocatable_p) amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx); outbound_shndx = bfd_zalloc (abfd, amt); if (outbound_shndx == NULL) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } + symtab_shndx_hdr->contents = outbound_shndx; symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; symtab_shndx_hdr->sh_size = amt; @@ -5357,7 +5367,10 @@ swap_out_syms (abfd, sttp, relocatable_p) syms[idx]->name, TRUE, FALSE); if (sym.st_name == (unsigned long) -1) - return FALSE; + { + _bfd_stringtab_free (stt); + return FALSE; + } } type_ptr = elf_symbol_from (abfd, syms[idx]); @@ -5446,6 +5459,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), syms[idx]->name ? syms[idx]->name : "<Local sym>", sec->name); bfd_set_error (bfd_error_invalid_operation); + _bfd_stringtab_free (stt); return FALSE; } @@ -5906,7 +5920,7 @@ _bfd_elf_slurp_version_tables (abfd) return TRUE; error_return: - if (contents == NULL) + if (contents != NULL) free (contents); return FALSE; } diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 509b481..631b2b9 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -2119,11 +2119,19 @@ static bfd_boolean elf32_arm_object_p (abfd) bfd *abfd; { - /* XXX - we ought to examine a .note section here. */ + unsigned int mach; + + mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); - if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) + if (mach != bfd_mach_arm_unknown) + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + + else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312); + else + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + return TRUE; } @@ -2263,6 +2271,11 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) return TRUE; } + /* Determine what should happen if the input ARM architecture + does not match the output ARM architecture. */ + if (! bfd_arm_merge_machines (ibfd, obfd)) + return FALSE; + /* Identical flags must be compatible. */ if (in_flags == out_flags) return TRUE; @@ -3660,6 +3673,30 @@ elf32_arm_reloc_type_class (rela) } } +static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, Elf_Internal_Shdr *)); +static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean)); + +/* Set the right machine number for an Arm ELF file. */ + +static bfd_boolean +elf32_arm_section_flags (flags, hdr) + flagword *flags; + Elf_Internal_Shdr *hdr; +{ + if (hdr->sh_type == SHT_NOTE) + *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS; + + return TRUE; +} + +void +elf32_arm_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); +} + #define ELF_ARCH bfd_arch_arm #define ELF_MACHINE_CODE EM_ARM #define ELF_MAXPAGESIZE 0x8000 @@ -3685,6 +3722,8 @@ elf32_arm_reloc_type_class (rela) #define elf_backend_post_process_headers elf32_arm_post_process_headers #define elf_backend_reloc_type_class elf32_arm_reloc_type_class #define elf_backend_object_p elf32_arm_object_p +#define elf_backend_section_flags elf32_arm_section_flags +#define elf_backend_final_write_processing elf32_arm_final_write_processing #define elf_backend_can_gc_sections 1 #define elf_backend_plt_readonly 1 diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 09604e7..c79688a 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1,5 +1,5 @@ -/* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002 +/* BFD back-end for Renesas H8/300 ELF binaries. + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index a751d98..eae3190 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -506,6 +506,12 @@ elf_i386_grok_psinfo (abfd, note) #define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" +/* 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 + /* The size in bytes of an entry in the procedure linkage table. */ #define PLT_ENTRY_SIZE 16 @@ -1106,7 +1112,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs) || h->root.type == bfd_link_hash_defweak || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared + || (ELIMINATE_COPY_RELOCS + && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak @@ -1372,8 +1379,6 @@ elf_i386_adjust_dynamic_symbol (info, h) struct elf_link_hash_entry *h; { struct elf_i386_link_hash_table *htab; - struct elf_i386_link_hash_entry * eh; - struct elf_i386_dyn_relocs *p; asection *s; unsigned int power_of_two; @@ -1418,6 +1423,10 @@ elf_i386_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -1443,20 +1452,26 @@ elf_i386_adjust_dynamic_symbol (info, h) return TRUE; } - eh = (struct elf_i386_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + if (ELIMINATE_COPY_RELOCS) { - s = p->sec->output_section; - if (s != NULL && (s->flags & SEC_READONLY) != 0) - break; - } + struct elf_i386_link_hash_entry * eh; + struct elf_i386_dyn_relocs *p; - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (p == NULL) - { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; - return TRUE; + eh = (struct elf_i386_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } } /* We must allocate the symbol in our .dynbss section, which will @@ -1676,7 +1691,7 @@ allocate_dynrelocs (h, inf) } } } - else + else if (ELIMINATE_COPY_RELOCS) { /* For the non-shared case, discard space for relocs against symbols which turn out to need copy relocs or are not @@ -2412,7 +2427,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, && (! info->symbolic || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared + || (ELIMINATE_COPY_RELOCS + && !info->shared && h != NULL && h->dynindx != -1 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 98ea6a6..26fa393 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -1,5 +1,5 @@ /* Motorola 68HC11-specific support for 32-bit ELF - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 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)) @@ -143,7 +143,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 */ @@ -204,7 +204,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 */ @@ -247,8 +247,8 @@ static reloc_howto_type elf_m68hc11_howto_table[] = { bfd_elf_generic_reloc, /* special_function */ "R_M68HC11_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 */ @@ -445,6 +445,9 @@ elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) return TRUE; } + +/* 68HC11 Linker Relaxation. */ + struct m68hc11_direct_relax { const char *name; @@ -694,6 +697,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) bfd_vma value; Elf_Internal_Sym *isym; asection *sym_sec; + int is_far = 0; /* If this isn't something that can be relaxed, then ignore this reloc. */ @@ -747,7 +751,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) prev_insn_group = 0; /* Do nothing if this reloc is the last byte in the section. */ - if (irel->r_offset == sec->_cooked_size) + if (irel->r_offset + 2 >= sec->_cooked_size) continue; /* See if the next instruction is an unconditional pc-relative @@ -793,6 +797,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { /* A local symbol. */ isym = isymbuf + ELF32_R_SYM (irel->r_info); + is_far = isym->st_other & STO_M68HC12_FAR; sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); symval = (isym->st_value + sym_sec->output_section->vma @@ -818,6 +823,7 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) continue; } + is_far = h->other & STO_M68HC12_FAR; isym = 0; sym_sec = h->root.u.def.section; symval = (h->root.u.def.value @@ -891,23 +897,25 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) { code = 0x20; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset, 1); + irel->r_offset + 1, 1); } else { code ^= 0x1; bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, - irel->r_offset - 1, 3); + irel->r_offset + 1, 3); } prev_insn_branch = 0; *again = TRUE; @@ -991,14 +999,14 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) /* That will change things, so, we should relax again. */ *again = TRUE; } - else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16) + else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16 && !is_far) { unsigned char code; bfd_vma offset; prev_insn_branch = 0; code = bfd_get_8 (abfd, contents + irel->r_offset - 1); - if (code == 0x7e) + if (code == 0x7e || code == 0xbd) { offset = value - (irel->r_offset + sec->output_section->vma @@ -1021,13 +1029,13 @@ m68hc11_elf_relax_section (abfd, sec, link_info, again) free_extsyms = NULL; /* Shrink the branch. */ - code = 0x20; + code = (code == 0x7e) ? 0x20 : 0x8d; bfd_put_8 (abfd, code, contents + irel->r_offset - 1); - bfd_put_8 (abfd, offset, + bfd_put_8 (abfd, 0xff, contents + irel->r_offset); irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - R_M68HC11_NONE); + R_M68HC11_PCREL_8); m68hc11_elf_relax_delete_bytes (abfd, sec, irel->r_offset + 1, 1); /* That will change things, so, we should relax again. */ @@ -1220,7 +1228,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) { if (isym->st_shndx == sec_shndx && isym->st_value > addr - && isym->st_value < toaddr) + && isym->st_value <= toaddr) isym->st_value -= count; } @@ -1236,7 +1244,7 @@ m68hc11_elf_relax_delete_bytes (abfd, sec, addr, count) || sym_hash->root.type == bfd_link_hash_defweak) && sym_hash->root.u.def.section == sec && sym_hash->root.u.def.value > addr - && sym_hash->root.u.def.value < toaddr) + && sym_hash->root.u.def.value <= toaddr) { sym_hash->root.u.def.value -= count; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 19a2ce8..abb0eec 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1097,6 +1097,17 @@ elf_m68k_adjust_dynamic_symbol (info, h) return TRUE; } +/* This is the condition under which elf_m68k_finish_dynamic_symbol + 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 elf_m68k_relocate_section. */ +#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \ + ((DYN) \ + && ((SHARED) \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ + && ((H)->dynindx != -1 \ + || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -1416,9 +1427,14 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_68K_GOT32) && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") != 0)) - && elf_hash_table (info)->dynamic_sections_created + && (WILL_CALL_FINISH_DYNAMIC_SYMBOL + (elf_hash_table (info)->dynamic_sections_created, + info->shared, h)) && (! info->shared - || (! info->symbolic && h->dynindx != -1) + || (! info->symbolic + && h->dynindx != -1 + && (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) == 0) || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) || (info->shared @@ -1496,13 +1512,18 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (h != NULL) { + bfd_boolean dyn; + off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); - if (!elf_hash_table (info)->dynamic_sections_created + dyn = elf_hash_table (info)->dynamic_sections_created; + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) || (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) != 0) { /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined @@ -1940,7 +1961,9 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) The entry in the global offset table will already have been initialized in the relocate_section function. */ if (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) { rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index cf705d5..adf057b 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -261,11 +261,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1403,7 +1401,7 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL }, { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, { BFD_RELOC_GPREL32, R_MIPS_GPREL32 }, { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, @@ -1442,11 +1440,12 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_CTOR: /* We need to handle BFD_RELOC_CTOR specially. Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the - size of addresses on this architecture. */ - if (bfd_arch_bits_per_address (abfd) == 32) - return &howto_table[(int) R_MIPS_32]; - else + size of addresses of the ABI. */ + if ((elf_elfheader (abfd)->e_flags & (E_MIPS_ABI_O64 + | E_MIPS_ABI_EABI64)) != 0) return &elf_mips_ctor64_howto; + else + return &howto_table[(int) R_MIPS_32]; case BFD_RELOC_MIPS16_JMP: return &elf_mips16_jump_howto; @@ -1460,7 +1459,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) return &elf_mips_gnu_rel_hi16; case BFD_RELOC_PCREL_LO16: return &elf_mips_gnu_rel_lo16; - case BFD_RELOC_MIPSEMB_16_PCREL_S2: + case BFD_RELOC_16_PCREL_S2: return &elf_mips_gnu_rel16_s2; case BFD_RELOC_64_PCREL: return &elf_mips_gnu_pcrel64; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 9947af8..186f39d 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -147,8 +147,12 @@ static bfd_boolean ppc_elf_grok_psinfo #define DTP_OFFSET 0x8000 /* Will references to this symbol always reference the symbol - in this object? */ -#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ + in this object? STV_PROTECTED is excluded from the visibility test + here so that function pointer comparisons work properly. Since + function symbols not defined in an app are set to their .plt entry, + it's necessary for shared libs to also reference the .plt even + though the symbol is really local to the shared lib. */ +#define SYMBOL_REFERENCES_LOCAL(INFO, H) \ ((! INFO->shared \ || INFO->symbolic \ || H->dynindx == -1 \ @@ -2300,7 +2304,7 @@ ppc_elf_create_linker_section (abfd, info, which) switch (which) { default: - (*_bfd_error_handler) (_("%s: Unknown special linker type %d"), + (*_bfd_error_handler) (_("%s: unknown special linker type %d"), bfd_get_filename (abfd), (int) which); @@ -2525,6 +2529,10 @@ ppc_elf_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -3455,8 +3463,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) case R_PPC_REL14_BRNTAKEN: case R_PPC_REL32: if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || SYMBOL_REFERENCES_LOCAL (info, h)) + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) break; /* fall through */ @@ -3741,8 +3748,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, relocs) case R_PPC_REL14_BRNTAKEN: case R_PPC_REL32: if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || SYMBOL_REFERENCES_LOCAL (info, h)) + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) break; /* Fall thru */ @@ -4520,7 +4526,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, enum elf_ppc_reloc_type r_type2; unsigned long r_symndx2; struct elf_link_hash_entry *h2; - bfd_vma insn1, insn2, insn3; + bfd_vma insn1, insn2; bfd_vma offset; /* The next instruction should be a call to @@ -4547,8 +4553,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, offset = rel[1].r_offset; insn1 = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); - insn3 = bfd_get_32 (output_bfd, - contents + offset + 4); if ((tls_mask & tls_gd) != 0) { /* IE */ @@ -4578,16 +4582,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, R_PPC_TPREL16_LO); rel[1].r_offset += 2; } - if (insn3 == NOP - || insn3 == CROR_151515 || insn3 == CROR_313131) - { - insn3 = insn2; - insn2 = NOP; - rel[1].r_offset += 4; - } bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); bfd_put_32 (output_bfd, insn2, contents + offset); - bfd_put_32 (output_bfd, insn3, contents + offset + 4); if (tls_gd == 0) { /* We changed the symbol on an LD reloc. Start over @@ -4785,10 +4781,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_offset = (htab->got->output_section->vma + htab->got->output_offset + off); + outrel.r_addend = 0; if (tls_ty & (TLS_LD | TLS_GD)) { outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32); - outrel.r_addend = 0; if (tls_ty == (TLS_TLS | TLS_GD)) { loc = htab->relgot->contents; @@ -4796,9 +4792,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, * sizeof (Elf32_External_Rela)); bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + outrel.r_offset += 4; outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32); - outrel.r_offset += 4; } } else if (tls_ty == (TLS_TLS | TLS_DTPREL)) @@ -4809,9 +4805,12 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE); else outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT); - outrel.r_addend = 0; if (indx == 0) - outrel.r_addend += relocation; + { + outrel.r_addend += relocation; + if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) + outrel.r_addend -= htab->tls_sec->vma; + } loc = htab->relgot->contents; loc += (htab->relgot->reloc_count++ * sizeof (Elf32_External_Rela)); @@ -4824,22 +4823,21 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma value = relocation; - if ((tls_ty & (TLS_GD | TLS_TPREL | TLS_DTPREL - | TLS_TPRELGD)) != 0) + if (tls_ty == (TLS_TLS | TLS_LD)) + value = 1; + else if (tls_ty != 0) { value -= htab->tls_sec->vma + DTP_OFFSET; - if ((tls_ty & TLS_TPREL) != 0) + if (tls_ty == (TLS_TLS | TLS_TPREL)) value += DTP_OFFSET - TP_OFFSET; - } - if (tls_ty == (TLS_TLS | TLS_GD)) - { - bfd_put_32 (output_bfd, value, - htab->got->contents + off + 4); - value = 1; + if (tls_ty == (TLS_TLS | TLS_GD)) + { + bfd_put_32 (output_bfd, value, + htab->got->contents + off + 4); + value = 1; + } } - else if (tls_ty == (TLS_TLS | TLS_LD)) - value = 1; bfd_put_32 (output_bfd, value, htab->got->contents + off); } @@ -4887,10 +4885,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, got at entry m+n bears little relation to the entry m. */ if (addend != 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): non-zero addend on got reloc against `%s'"), + (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + howto->name, sym_name); } break; @@ -4899,10 +4898,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_LOCAL24PC: /* It makes no sense to point a local relocation at a symbol not in this object. */ - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && sec->output_section == NULL) + if (unresolved_reloc) { if (! (*info->callbacks->undefined_symbol) (info, h->root.root.string, @@ -4942,6 +4938,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend -= htab->tls_sec->vma + DTP_OFFSET; goto dodyn; + case R_PPC_DTPMOD32: + relocation = 1; + addend = 0; + goto dodyn; + case R_PPC_REL24: case R_PPC_REL32: case R_PPC_REL14: @@ -4968,7 +4969,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: - case R_PPC_DTPMOD32: /* r_symndx will be zero only for relocs against symbols from removed linkonce sections, or sections discarded by a linker script. */ @@ -5037,8 +5037,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (skip) memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if this symbol was marked to - become local. */ else if (h != NULL && !SYMBOL_REFERENCES_LOCAL (info, h)) { @@ -5175,7 +5173,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, || (strncmp (name, ".sbss", 5) == 0 && (name[5] == 0 || name[5] == '.')))) { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5199,7 +5197,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (! (strncmp (name, ".sdata2", 7) == 0 || strncmp (name, ".sbss2", 6) == 0)) { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5256,7 +5254,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { - (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"), + (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), bfd_archive_filename (input_bfd), sym_name, howto->name, @@ -5310,7 +5308,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_EMB_RELST_HA: case R_PPC_EMB_BIT_FLD: (*_bfd_error_handler) - (_("%s: Relocation %s is not yet supported for symbol %s."), + (_("%s: relocation %s is not yet supported for symbol %s."), bfd_archive_filename (input_bfd), howto->name, sym_name); @@ -5339,12 +5337,13 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_EMB_NADDR16_HA: case R_PPC_EMB_RELST_HA: /* It's just possible that this symbol is a weak symbol - that's not actually defined anywhere. In that case, + that's not actually defined anywhere. In that case, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; } @@ -5363,10 +5362,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + howto->name, sym_name); ret = FALSE; } @@ -5412,10 +5412,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), + (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, sym_name, (int) r); + (long) rel->r_offset, howto->name, sym_name, (int) r); ret = FALSE; } } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index c9167bc..8eb9a49 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -1,4 +1,4 @@ -/* Hitachi SH specific support for 32-bit ELF +/* Renesas 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. diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c index 107e504..f14a042 100644 --- a/bfd/elf32-sh64-com.c +++ b/bfd/elf32-sh64-com.c @@ -1,4 +1,4 @@ -/* Hitachi SH64-specific support for 32-bit ELF +/* Renesas 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 13953e6..dc21b54 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -1,4 +1,4 @@ -/* Hitachi SH64-specific support for 32-bit ELF +/* Renesas 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-xstormy16.c b/bfd/elf32-xstormy16.c index c09e9de..22ab8ef 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -845,9 +845,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, { sym = local_syms + r_symndx; sec = local_sections [r_symndx]; - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 9f564ca..bf18e205 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4514,7 +4514,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) return FALSE; - ret_val = FALSE; continue; } @@ -4580,8 +4579,20 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, value -= gp; goto default_reloc; - case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: + /* If the target section was a removed linkonce section, + r_symndx will be zero. In this case, assume that the + switch will not be used, so don't fill it in. If we + do nothing here, we'll get relocation truncated messages, + due to the placement of the application above 4GB. */ + if (r_symndx == 0) + { + r = bfd_reloc_ok; + break; + } + /* FALLTHRU */ + + case R_ALPHA_GPREL16: case R_ALPHA_GPRELLOW: if (dynamic_symbol_p) { diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 807ddf5..39f21b3 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -91,8 +91,14 @@ static void mips_elf64_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *)); +static long mips_elf64_canonicalize_reloc + PARAMS ((bfd *, asection *, arelent **, asymbol **)); +static long mips_elf64_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); +static long mips_elf64_canonicalize_dynamic_reloc + PARAMS ((bfd *, arelent **, asymbol **)); static bfd_boolean mips_elf64_slurp_one_reloc_table - PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *)); + PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, + arelent *, asymbol **, bfd_boolean)); static bfd_boolean mips_elf64_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); static void mips_elf64_write_relocs @@ -300,11 +306,9 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -797,11 +801,9 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1898,7 +1900,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_64, R_MIPS_64 }, { BFD_RELOC_CTOR, R_MIPS_64 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -2022,20 +2024,104 @@ mips_elf64_get_reloc_upper_bound (abfd, sec) return (sec->reloc_count * 3 + 1) * sizeof (arelent *); } -/* Read the relocations from one reloc section. */ +static long +mips_elf64_get_dynamic_reloc_upper_bound (abfd) + bfd *abfd; +{ + return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3; +} + +/* We must also copy more relocations than the corresponding functions + in elf.c would, so the two following functions are slightly + modified from elf.c, that multiply the external relocation count by + 3 to obtain the internal relocation count. */ + +static long +mips_elf64_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr; + unsigned int i; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE)) + return -1; + + tblptr = section->relocation; + for (i = 0; i < section->reloc_count * 3; i++) + *relptr++ = tblptr++; + + *relptr = NULL; + + return section->reloc_count * 3; +} + +static long +mips_elf64_canonicalize_dynamic_reloc (abfd, storage, syms) + bfd *abfd; + arelent **storage; + asymbol **syms; +{ + bfd_boolean (*slurp_relocs) + PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + asection *s; + long ret; + + if (elf_dynsymtab (abfd) == 0) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + + slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; + ret = 0; + for (s = abfd->sections; s != NULL; s = s->next) + { + if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + && (elf_section_data (s)->this_hdr.sh_type == SHT_REL + || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) + { + arelent *p; + long count, i; + + if (! (*slurp_relocs) (abfd, s, syms, TRUE)) + return -1; + count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3; + p = s->relocation; + for (i = 0; i < count; i++) + *storage++ = p++; + ret += count; + } + } + + *storage = NULL; + + return ret; +} + +/* Read the relocations from one reloc section. This is mostly copied + from elfcode.h, except for the changes to expand one external + relocation to 3 internal ones. We must unfortunately set + reloc_count to the number of external relocations, because a lot of + generic code seems to depend on this. */ static bfd_boolean -mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) +mips_elf64_slurp_one_reloc_table (abfd, asect, rel_hdr, reloc_count, + relents, symbols, dynamic) bfd *abfd; asection *asect; + Elf_Internal_Shdr *rel_hdr; + bfd_size_type reloc_count; + arelent *relents; asymbol **symbols; - const Elf_Internal_Shdr *rel_hdr; + bfd_boolean dynamic; { PTR allocated = NULL; bfd_byte *native_relocs; - arelent *relents; arelent *relent; - bfd_vma count; bfd_vma i; int entsize; reloc_howto_type *howto_table; @@ -2045,26 +2131,24 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) return FALSE; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 - || (bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) + || (bfd_bread (allocated, rel_hdr->sh_size, abfd) + != rel_hdr->sh_size)) goto error_return; native_relocs = (bfd_byte *) allocated; - relents = asect->relocation + asect->reloc_count; - entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel) || entsize == sizeof (Elf64_Mips_External_Rela)); - count = rel_hdr->sh_size / entsize; - if (entsize == sizeof (Elf64_Mips_External_Rel)) howto_table = mips_elf64_howto_table_rel; else howto_table = mips_elf64_howto_table_rela; - relent = relents; - for (i = 0; i < count; i++, native_relocs += entsize) + for (i = 0, relent = relents; + i < reloc_count; + i++, native_relocs += entsize) { Elf64_Mips_Internal_Rela rela; bfd_boolean used_sym, used_ssym; @@ -2166,7 +2250,7 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) object file, and absolute for an executable file or shared library. The address of a BFD reloc is always section relative. */ - if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic) relent->address = rela.r_offset; else relent->address = rela.r_offset - asect->vma; @@ -2193,7 +2277,10 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr) } /* Read the relocations. On Irix 6, there can be two reloc sections - associated with a single data section. */ + associated with a single data section. This is copied from + elfcode.h as well, with changes as small as accounting for 3 + internal relocs per external reloc and resetting reloc_count to + zero before processing the relocs of a section. */ static bfd_boolean mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) @@ -2202,39 +2289,72 @@ mips_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic) asymbol **symbols; bfd_boolean dynamic; { - bfd_size_type amt; struct bfd_elf_section_data * const d = elf_section_data (asect); + Elf_Internal_Shdr *rel_hdr; + Elf_Internal_Shdr *rel_hdr2; + bfd_size_type reloc_count; + bfd_size_type reloc_count2; + arelent *relents; + bfd_size_type amt; + + if (asect->relocation != NULL) + return TRUE; - if (dynamic) + if (! dynamic) { - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } + if ((asect->flags & SEC_RELOC) == 0 + || asect->reloc_count == 0) + return TRUE; - if (asect->relocation != NULL - || (asect->flags & SEC_RELOC) == 0 - || asect->reloc_count == 0) - return TRUE; + rel_hdr = &d->rel_hdr; + reloc_count = NUM_SHDR_ENTRIES (rel_hdr); + rel_hdr2 = d->rel_hdr2; + reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0); + + BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2); + BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset + || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset)); + + } + else + { + /* Note that ASECT->RELOC_COUNT tends not to be accurate in this + case because relocations against this section may use the + dynamic symbol table, and in that case bfd_section_from_shdr + in elf.c does not update the RELOC_COUNT. */ + if (asect->_raw_size == 0) + return TRUE; + + rel_hdr = &d->this_hdr; + reloc_count = NUM_SHDR_ENTRIES (rel_hdr); + rel_hdr2 = NULL; + reloc_count2 = 0; + } /* Allocate space for 3 arelent structures for each Rel structure. */ - amt = asect->reloc_count; - amt *= 3 * sizeof (arelent); - asect->relocation = (arelent *) bfd_alloc (abfd, amt); - if (asect->relocation == NULL) + amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent); + relents = (arelent *) bfd_alloc (abfd, amt); + if (relents == NULL) return FALSE; /* The slurp_one_reloc_table routine increments reloc_count. */ asect->reloc_count = 0; - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, &d->rel_hdr)) + if (! mips_elf64_slurp_one_reloc_table (abfd, asect, + rel_hdr, reloc_count, + relents, + symbols, dynamic)) return FALSE; if (d->rel_hdr2 != NULL) { - if (! mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, - d->rel_hdr2)) + if (! mips_elf64_slurp_one_reloc_table (abfd, asect, + rel_hdr2, reloc_count2, + relents + reloc_count * 3, + symbols, dynamic)) return FALSE; } + asect->relocation = relents; return TRUE; } @@ -2764,6 +2884,10 @@ const struct elf_size_info mips_elf64_size_info = _bfd_mips_elf_print_private_bfd_data #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound +#define bfd_elf64_canonicalize_reloc mips_elf64_canonicalize_reloc +#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound +#define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc +#define bfd_elf64_bfd_relax_section _bfd_mips_relax_section /* MIPS ELF64 archive functions. */ #define bfd_elf64_archive_functions diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 23d95d5..29c90fe 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4518,6 +4518,10 @@ ppc64_elf_adjust_dynamic_symbol (info, h) || h->weakdef->root.type == bfd_link_hash_defweak); h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); return TRUE; } @@ -7634,8 +7638,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, + off); if (tls_type & (TLS_LD | TLS_GD)) { - outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); outrel.r_addend = 0; + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); if (tls_type == (TLS_TLS | TLS_GD)) { loc = htab->srelgot->contents; @@ -7643,9 +7647,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, * sizeof (Elf64_External_Rela)); bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + outrel.r_offset += 8; outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64); - outrel.r_offset += 8; } } else if (tls_type == (TLS_TLS | TLS_DTPREL)) @@ -7658,7 +7662,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT); outrel.r_addend = rel->r_addend; if (indx == 0) - outrel.r_addend += relocation; + { + outrel.r_addend += relocation; + if (tls_type & (TLS_GD | TLS_DTPREL | TLS_TPREL)) + outrel.r_addend -= htab->tls_sec->vma; + } loc = htab->srelgot->contents; loc += (htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela)); @@ -7670,21 +7678,22 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { relocation += rel->r_addend; - if (tls_type != 0) + if (tls_type == (TLS_TLS | TLS_LD)) + relocation = 1; + else if (tls_type != 0) { relocation -= htab->tls_sec->vma + DTP_OFFSET; - if ((tls_type & TLS_TPREL) != 0) + if (tls_type == (TLS_TLS | TLS_TPREL)) relocation += DTP_OFFSET - TP_OFFSET; - } - if ((tls_type & TLS_GD) != 0) - { - bfd_put_64 (output_bfd, relocation, - htab->sgot->contents + off + 8); - relocation = 1; + if (tls_type == (TLS_TLS | TLS_GD)) + { + bfd_put_64 (output_bfd, relocation, + htab->sgot->contents + off + 8); + relocation = 1; + } } - else if (tls_type == (TLS_TLS | TLS_LD)) - relocation = 1; + bfd_put_64 (output_bfd, relocation, htab->sgot->contents + off); } @@ -7793,6 +7802,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend -= htab->tls_sec->vma + DTP_OFFSET; break; + case R_PPC64_DTPMOD64: + relocation = 1; + addend = 0; + goto dodyn; + case R_PPC64_TPREL64: addend -= htab->tls_sec->vma + TP_OFFSET; goto dodyn; @@ -7803,7 +7817,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Relocations that may need to be propagated if this is a dynamic object. */ - case R_PPC64_DTPMOD64: case R_PPC64_REL30: case R_PPC64_REL32: case R_PPC64_REL64: @@ -7981,7 +7994,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* These ones haven't been implemented yet. */ (*_bfd_error_handler) - (_("%s: Relocation %s is not supported for symbol %s."), + (_("%s: relocation %s is not supported for symbol %s."), bfd_archive_filename (input_bfd), ppc64_elf_howto_table[(int) r_type]->name, sym_name); @@ -8023,8 +8036,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, 'sec' would be NULL, and we should leave the symbol alone (it will be set to zero elsewhere in the link). */ if (sec != NULL) - /* Add 0x10000 if sign bit in 0:15 is set. */ - addend += ((relocation + addend) & 0x8000) << 1; + /* Add 0x10000 if sign bit in 0:15 is set. + Bits 0:15 are not used. */ + addend += 0x8000; break; case R_PPC64_ADDR16_DS: @@ -8095,10 +8109,11 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), (long) rel->r_offset, + ppc64_elf_howto_table[(int) r_type]->name, h->root.root.string); ret = FALSE; } @@ -8140,10 +8155,13 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), + (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), bfd_archive_filename (input_bfd), bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, sym_name, (int) r); + (long) rel->r_offset, + ppc64_elf_howto_table[(int) r_type]->name, + sym_name, + (int) r); ret = FALSE; } } diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 8f6490b..5a2f89a 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1,5 +1,5 @@ -/* Hitachi SH64-specific support for 64-bit ELF - Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +/* Renesas 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/elf64-sparc.c b/bfd/elf64-sparc.c index e4f04b5..bca09b7 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -96,6 +96,8 @@ static bfd_boolean sparc64_elf_slurp_one_reloc_table PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, bfd_boolean)); static bfd_boolean sparc64_elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); +static long sparc64_elf_canonicalize_reloc + PARAMS ((bfd *, asection *, arelent **, asymbol **)); static long sparc64_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **)); static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR)); @@ -311,6 +313,17 @@ sparc64_elf_info_to_howto (abfd, cache_ptr, dst) cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)]; } +struct sparc64_elf_section_data +{ + struct bfd_elf_section_data elf; + unsigned int do_relax, reloc_count; +}; + +#define sec_do_relax(sec) \ + ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax +#define canon_reloc_count(sec) \ + ((struct sparc64_elf_section_data *) elf_section_data (sec))->reloc_count + /* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA section can represent up to two relocs, we must tell the user to allocate more space. */ @@ -361,7 +374,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) native_relocs = (bfd_byte *) allocated; - relents = asect->relocation + asect->reloc_count; + relents = asect->relocation + canon_reloc_count (asect); entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_External_Rela)); @@ -416,7 +429,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)]; } - asect->reloc_count += relent - relents; + canon_reloc_count (asect) += relent - relents; if (allocated != NULL) free (allocated); @@ -478,8 +491,9 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) if (asect->relocation == NULL) return FALSE; - /* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count. */ - asect->reloc_count = 0; + /* The sparc64_elf_slurp_one_reloc_table routine increments + canon_reloc_count. */ + canon_reloc_count (asect) = 0; if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)) @@ -493,6 +507,32 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) return TRUE; } +/* Canonicalize the relocs. */ + +static long +sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr; + unsigned int i; + struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE)) + return -1; + + tblptr = section->relocation; + for (i = 0; i < canon_reloc_count (section); i++) + *relptr++ = tblptr++; + + *relptr = NULL; + + return canon_reloc_count (section); +} + + /* Canonicalize the dynamic relocation entries. Note that we return the dynamic relocations as a single block, although they are actually associated with particular sections; the interface, which @@ -528,7 +568,7 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms) if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE)) return -1; - count = s->reloc_count; + count = canon_reloc_count (s); p = s->relocation; for (i = 0; i < count; i++) *storage++ = p++; @@ -1918,15 +1958,6 @@ sparc64_elf_size_dynamic_sections (output_bfd, info) return TRUE; } -struct sparc64_elf_section_data -{ - struct bfd_elf_section_data elf; - unsigned int do_relax; -}; - -#define sec_do_relax(sec) \ - ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax - static bfd_boolean sparc64_elf_new_section_hook (abfd, sec) bfd *abfd; @@ -3177,6 +3208,8 @@ const struct elf_size_info sparc64_elf_size_info = sparc64_elf_get_reloc_upper_bound #define bfd_elf64_get_dynamic_reloc_upper_bound \ sparc64_elf_get_dynamic_reloc_upper_bound +#define bfd_elf64_canonicalize_reloc \ + sparc64_elf_canonicalize_reloc #define bfd_elf64_canonicalize_dynamic_reloc \ sparc64_elf_canonicalize_dynamic_reloc #define bfd_elf64_bfd_reloc_type_lookup \ diff --git a/bfd/elflink.h b/bfd/elflink.h index 7d2d2e2..12f91ef 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -1609,10 +1609,12 @@ elf_link_add_object_symbols (abfd, info) const char *name; struct elf_link_hash_entry *h; bfd_boolean definition; - bfd_boolean size_change_ok, type_change_ok; + bfd_boolean size_change_ok; + bfd_boolean type_change_ok; bfd_boolean new_weakdef; - unsigned int old_alignment; bfd_boolean override; + unsigned int old_alignment; + bfd *old_bfd; override = FALSE; @@ -1717,6 +1719,8 @@ elf_link_add_object_symbols (abfd, info) size_change_ok = FALSE; type_change_ok = get_elf_backend_data (abfd)->type_change_ok; old_alignment = 0; + old_bfd = NULL; + if (info->hash->creator->flavour == bfd_target_elf_flavour) { Elf_Internal_Versym iver; @@ -1834,9 +1838,23 @@ elf_link_add_object_symbols (abfd, info) that we don't reduce the alignment later on. We can't check later, because _bfd_generic_link_add_one_symbol will set a default for the alignment which we want to - override. */ - if (h->root.type == bfd_link_hash_common) - old_alignment = h->root.u.c.p->alignment_power; + override. We also remember the old bfd where the existing + definition comes from. */ + switch (h->root.type) + { + default: + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + old_bfd = h->root.u.def.section->owner; + break; + + case bfd_link_hash_common: + old_bfd = h->root.u.c.p->section->owner; + old_alignment = h->root.u.c.p->alignment_power; + break; + } if (elf_tdata (abfd)->verdef != NULL && ! override @@ -1893,6 +1911,8 @@ elf_link_add_object_symbols (abfd, info) is specified and no other alignments have been specified. */ || (isym->st_value == 1 && old_alignment == 0)) h->root.u.c.p->alignment_power = align; + else + h->root.u.c.p->alignment_power = old_alignment; } if (info->hash->creator->flavour == bfd_target_elf_flavour) @@ -1901,15 +1921,64 @@ elf_link_add_object_symbols (abfd, info) bfd_boolean dynsym; int new_flag; + /* Check the alignment when a common symbol is involved. This + can change when a common symbol is overriden by a normal + definition or a common symbol is ignored due to the old + normal definition. We need to make sure the maximum + alignment is maintained. */ + if ((old_alignment || isym->st_shndx == SHN_COMMON) + && h->root.type != bfd_link_hash_common) + { + unsigned int common_align; + unsigned int normal_align; + unsigned int symbol_align; + bfd *normal_bfd; + bfd *common_bfd; + + symbol_align = ffs (h->root.u.def.value) - 1; + if ((h->root.u.def.section->owner->flags & DYNAMIC) == 0) + { + normal_align = h->root.u.def.section->alignment_power; + if (normal_align > symbol_align) + normal_align = symbol_align; + } + else + normal_align = symbol_align; + + if (old_alignment) + { + common_align = old_alignment; + common_bfd = old_bfd; + normal_bfd = abfd; + } + else + { + common_align = bfd_log2 (isym->st_value); + common_bfd = abfd; + normal_bfd = old_bfd; + } + + if (normal_align < common_align) + (*_bfd_error_handler) + (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"), + 1 << normal_align, + name, + bfd_archive_filename (normal_bfd), + 1 << common_align, + bfd_archive_filename (common_bfd)); + } + /* Remember the symbol size and type. */ if (isym->st_size != 0 && (definition || h->size == 0)) { if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"), + (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"), name, (unsigned long) h->size, - (unsigned long) isym->st_size, bfd_archive_filename (abfd)); + bfd_archive_filename (old_bfd), + (unsigned long) isym->st_size, + bfd_archive_filename (abfd)); h->size = isym->st_size; } @@ -1940,7 +2009,7 @@ elf_link_add_object_symbols (abfd, info) might be needed here. */ if (isym->st_other != 0) { - unsigned char hvis, symvis, other; + unsigned char hvis, symvis, other, nvis; /* Take the balance of OTHER from the definition. */ other = (definition ? isym->st_other : h->other); @@ -1949,8 +2018,14 @@ elf_link_add_object_symbols (abfd, info) /* Combine visibilities, using the most constraining one. */ hvis = ELF_ST_VISIBILITY (h->other); symvis = ELF_ST_VISIBILITY (isym->st_other); + if (! hvis) + nvis = symvis; + else if (! symvis) + nvis = hvis; + else + nvis = hvis < symvis ? hvis : symvis; - h->other = other | (hvis > symvis ? hvis : symvis); + h->other = other | nvis; } /* Set a flag in the hash table entry indicating the type of @@ -4849,6 +4924,7 @@ elf_link_sort_relocs (abfd, info, psec) } } + free (sort); *psec = reldyn; return ret; } @@ -8329,9 +8405,10 @@ elf_bfd_discard_info (output_bfd, info) continue; eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (eh != NULL - && (eh->_raw_size == 0 - || bfd_is_abs_section (eh->output_section))) + if (info->relocateable + || (eh != NULL + && (eh->_raw_size == 0 + || bfd_is_abs_section (eh->output_section)))) eh = NULL; stab = bfd_get_section_by_name (abfd, ".stab"); @@ -8432,6 +8509,7 @@ elf_bfd_discard_info (output_bfd, info) } if (info->eh_frame_hdr + && !info->relocateable && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info)) ret = TRUE; diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index b2d745b..ab255fa 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -275,11 +275,9 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -774,11 +772,9 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. Note that the ABI document has a typo - and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. - We do the right thing here. */ + /* 16 bit PC relative reference. */ HOWTO (R_MIPS_PC16, /* type */ - 2, /* rightshift */ + 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1841,7 +1837,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_CTOR, R_MIPS_32 }, { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -2028,7 +2024,7 @@ elf32_mips_grok_prstatus (abfd, note) default: return FALSE; - case 256: /* Linux/MIPS */ + case 440: /* Linux/MIPS N32 */ /* pr_cursig */ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); @@ -2037,7 +2033,7 @@ elf32_mips_grok_prstatus (abfd, note) /* pr_reg */ offset = 72; - raw_size = 180; + raw_size = 360; break; } @@ -2215,6 +2211,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define bfd_elf32_bfd_set_private_flags _bfd_mips_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data \ _bfd_mips_elf_print_private_bfd_data +#define bfd_elf32_bfd_relax_section _bfd_mips_relax_section /* Support for SGI-ish mips targets using n32 ABI. */ diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index d1a78ab..bff78c8 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -357,6 +357,10 @@ elfNN_ia64_reloc (abfd, reloc, sym, data, input_section, reloc->address += input_section->output_offset; return bfd_reloc_ok; } + + if (input_section->flags & SEC_DEBUGGING) + return bfd_reloc_continue; + *error_message = "Unsupported call to elfNN_ia64_reloc"; return bfd_reloc_notsupported; } @@ -696,6 +700,10 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) one pass. */ *again = FALSE; + /* Don't even try to relax for non-ELF outputs. */ + if (link_info->hash->creator->flavour != bfd_target_elf_flavour) + return FALSE; + /* Nothing to do if there are no relocations. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) @@ -819,6 +827,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) tsec = ia64_info->plt_sec; toff = dyn_i->plt2_offset; + BFD_ASSERT (irel->r_addend == 0); } /* Can't do anything else with dynamic symbols. */ @@ -837,10 +846,15 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } } - symaddr = (tsec->output_section->vma - + tsec->output_offset - + toff - + irel->r_addend); + if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) + toff = _bfd_merged_section_offset (abfd, &tsec, + elf_section_data (tsec)->sec_info, + toff + irel->r_addend, + (bfd_vma) 0); + else + toff += irel->r_addend; + + symaddr = tsec->output_section->vma + tsec->output_offset + toff; roff = irel->r_offset; @@ -1022,6 +1036,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) struct elfNN_ia64_allocate_data data; data.info = link_info; data.ofs = 0; + ia64_info->self_dtpmod_offset = (bfd_vma) -1; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); @@ -1777,19 +1792,24 @@ elfNN_ia64_hash_table_create (abfd) { struct elfNN_ia64_link_hash_table *ret; - ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret)); + ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret)); if (!ret) return 0; + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, elfNN_ia64_new_elf_hash_entry)) { - bfd_release (abfd, ret); + free (ret); return 0; } if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd, elfNN_ia64_new_loc_hash_entry)) - return 0; + { + free (ret); + return 0; + } + return &ret->root.root; } @@ -1965,7 +1985,11 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) struct elfNN_ia64_local_hash_entry *loc_h; loc_h = get_local_sym_hash (ia64_info, abfd, rel, create); - BFD_ASSERT (loc_h); + if (!loc_h) + { + BFD_ASSERT (!create); + return NULL; + } pp = &loc_h->info; } @@ -3939,7 +3963,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; - ret_val = FALSE; continue; } } diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 6ca4f06..0c3a5d9 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -408,6 +408,7 @@ static asection * mips_elf_rel_dyn_section PARAMS ((bfd *, bfd_boolean)); static asection * mips_elf_got_section PARAMS ((bfd *, bfd_boolean)); static struct mips_got_info *mips_elf_got_info PARAMS ((bfd *, asection **)); +static long mips_elf_get_global_gotsym_index PARAMS ((bfd *abfd)); static bfd_vma mips_elf_local_got_index PARAMS ((bfd *, bfd *, struct bfd_link_info *, bfd_vma)); static bfd_vma mips_elf_global_got_index @@ -496,6 +497,7 @@ static struct mips_got_info *mips_elf_got_for_ibfd static bfd *reldyn_sorting_bfd; /* Nonzero if ABFD is using the N32 ABI. */ + #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) @@ -1706,6 +1708,29 @@ mips_elf_got_info (abfd, sgotp) return g; } +/* Obtain the lowest dynamic index of a symbol that was assigned a + global GOT entry. */ +static long +mips_elf_get_global_gotsym_index (abfd) + bfd *abfd; +{ + asection *sgot; + struct mips_got_info *g; + + if (abfd == NULL) + return 0; + + sgot = mips_elf_got_section (abfd, TRUE); + if (sgot == NULL || mips_elf_section_data (sgot) == NULL) + return 0; + + g = mips_elf_section_data (sgot)->u.got_info; + if (g == NULL || g->global_gotsym == NULL) + return 0; + + return g->global_gotsym->dynindx; +} + /* Returns the GOT offset at which the indicated address can be found. If there is not yet a GOT entry for this value, create one. Returns -1 if no satisfactory GOT offset can be found. */ @@ -2129,7 +2154,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2) return e1->bfd == e2->bfd; } -/* In a multi-got link, determine the GOT to be used for IBFD. G must +/* In a multi-got link, determine the GOT to be used for IBDF. G must be the master GOT data. */ static struct mips_got_info * @@ -3195,6 +3220,18 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, and we're going to need it, get it now. */ switch (r_type) { + case R_MIPS_GOT_PAGE: + case R_MIPS_GOT_OFST: + /* If this symbol got a global GOT entry, we have to decay + GOT_PAGE/GOT_OFST to GOT_DISP/addend. */ + local_p = local_p || ! h + || (h->root.dynindx + < mips_elf_get_global_gotsym_index (elf_hash_table (info) + ->dynobj)); + if (local_p || r_type == R_MIPS_GOT_OFST) + break; + /* Fall through. */ + case R_MIPS_CALL16: case R_MIPS_GOT16: case R_MIPS_GOT_DISP: @@ -3205,7 +3242,11 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Find the index into the GOT where this value is located. */ if (!local_p) { - BFD_ASSERT (addend == 0); + /* GOT_PAGE may take a non-zero addend, that is ignored in a + GOT_PAGE relocation that decays to GOT_DISP because the + symbol turns out to be global. The addend is then added + as GOT_OFST. */ + BFD_ASSERT (addend == 0 || r_type == R_MIPS_GOT_PAGE); g = mips_elf_global_got_index (elf_hash_table (info)->dynobj, input_bfd, (struct elf_link_hash_entry *) h); @@ -3219,7 +3260,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, We must initialize this entry in the GOT. */ bfd *tmpbfd = elf_hash_table (info)->dynobj; asection *sgot = mips_elf_got_section (tmpbfd, FALSE); - MIPS_ELF_PUT_WORD (tmpbfd, symbol + addend, sgot->contents + g); + MIPS_ELF_PUT_WORD (tmpbfd, symbol, sgot->contents + g); } } else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16) @@ -3315,6 +3356,12 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, value &= howto->dst_mask; break; + case R_MIPS_GNU_REL16_S2: + value = symbol + mips_elf_sign_extend (addend << 2, 18) - p; + overflowed_p = mips_elf_overflow_p (value, 18); + value = (value >> 2) & howto->dst_mask; + break; + case R_MIPS_GNU_REL_HI16: /* Instead of subtracting 'p' here, we should be subtracting the equivalent value for the LO part of the reloc, since the value @@ -3432,6 +3479,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, /* Fall through. */ case R_MIPS_GOT_DISP: + got_disp: value = g; overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3443,10 +3491,8 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_PC16: - case R_MIPS_GNU_REL16_S2: - value = mips_elf_sign_extend (addend << 2, 18) + symbol - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; + value = mips_elf_sign_extend (addend, 16) + symbol - p; + overflowed_p = mips_elf_overflow_p (value, 16); break; case R_MIPS_GOT_HI16: @@ -3465,6 +3511,11 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_GOT_PAGE: + /* GOT_PAGE relocations that reference non-local symbols decay + to GOT_DISP. The corresponding GOT_OFST relocation decays to + 0. */ + if (! local_p) + goto got_disp; value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL); if (value == MINUS_ONE) return bfd_reloc_outofrange; @@ -3474,7 +3525,10 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, break; case R_MIPS_GOT_OFST: - mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); + if (local_p) + mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); + else + value = addend; overflowed_p = mips_elf_overflow_p (value, 16); break; @@ -3832,7 +3886,6 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, else { long indx; - bfd_vma section_offset; /* We must now calculate the dynamic symbol table index to use in the relocation. */ @@ -3862,15 +3915,18 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, abort (); } - /* Figure out how far the target of the relocation is from - the beginning of its section. */ - section_offset = symbol - sec->output_section->vma; - /* The relocation we're building is section-relative. - Therefore, the original addend must be adjusted by the - section offset. */ - *addendp += section_offset; - /* Now, the relocation is just against the section. */ - symbol = sec->output_section->vma; + /* Instead of generating a relocation using the section + symbol, we may as well make it a fully relative + relocation. We want to avoid generating relocations to + local symbols because we used to generate them + incorrectly, without adding the original symbol value, + which is mandated by the ABI for section symbols. In + order to give dynamic loaders and applications time to + phase out the incorrect use, we refrain from emitting + section-relative relocations. It's not like they're + useful, after all. This should be a bit more efficient + as well. */ + indx = 0; } /* If the relocation was previously an absolute relocation and @@ -3884,6 +3940,18 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, know where the shared library will wind up at load-time. */ outrel[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx, R_MIPS_REL32); + /* For strict adherence to the ABI specification, we should + generate a R_MIPS_64 relocation record by itself before the + _REL32/_64 record as well, such that the addend is read in as + a 64-bit value (REL32 is a 32-bit relocation, after all). + However, since none of the existing ELF64 MIPS dynamic + loaders seems to care, we don't waste space with these + artificial relocations. If this turns out to not be true, + mips_elf_allocate_dynamic_relocation() should be tweaked so + as to make room for a pair of dynamic relocations per + invocation if ABI_64_P, and here we should generate an + additional relocation record with R_MIPS_64 by itself for a + NULL symbol before this relocation record. */ outrel[1].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, ABI_64_P (output_bfd) ? R_MIPS_64 @@ -5293,6 +5361,44 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) } break; + case R_MIPS_GOT_PAGE: + /* If this is a global, overridable symbol, GOT_PAGE will + decay to GOT_DISP, so we'll need a GOT entry for it. */ + if (h == NULL) + break; + else + { + struct mips_elf_link_hash_entry *hmips = + (struct mips_elf_link_hash_entry *) h; + + while (hmips->root.root.type == bfd_link_hash_indirect + || hmips->root.root.type == bfd_link_hash_warning) + hmips = (struct mips_elf_link_hash_entry *) + hmips->root.root.u.i.link; + + if ((hmips->root.root.type == bfd_link_hash_defined + || hmips->root.root.type == bfd_link_hash_defweak) + && hmips->root.root.u.def.section + && ! (info->shared && ! info->symbolic + && ! (hmips->root.elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL)) + /* If we've encountered any other relocation + referencing the symbol, we'll have marked it as + dynamic, and, even though we might be able to get + rid of the GOT entry should we know for sure all + previous relocations were GOT_PAGE ones, at this + point we can't tell, so just keep using the + symbol as dynamic. This is very important in the + multi-got case, since we don't decide whether to + decay GOT_PAGE to GOT_DISP on a per-GOT basis: if + the symbol is dynamic, we'll need a GOT entry for + every GOT in which the symbol is referenced with + a GOT_PAGE relocation. */ + && hmips->root.dynindx == -1) + break; + } + /* Fall through. */ + case R_MIPS_GOT16: case R_MIPS_GOT_HI16: case R_MIPS_GOT_LO16: @@ -5432,6 +5538,185 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs) return TRUE; } +bfd_boolean +_bfd_mips_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Shdr *symtab_hdr; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + size_t extsymoff; + bfd_boolean changed_contents = FALSE; + bfd_vma sec_start = sec->output_section->vma + sec->output_offset; + Elf_Internal_Sym *isymbuf = NULL; + + /* We are not currently changing any sizes, so only one pass. */ + *again = FALSE; + + if (link_info->relocateable) + return TRUE; + + internal_relocs = (MNAME(abfd,_bfd_elf,link_read_relocs) + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + return TRUE; + + irelend = internal_relocs + sec->reloc_count + * get_elf_backend_data (abfd)->s->int_rels_per_ext_rel; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info; + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + bfd_signed_vma sym_offset; + unsigned int r_type; + unsigned long r_symndx; + asection *sym_sec; + unsigned long instruction; + + /* Turn jalr into bgezal, and jr into beq, if they're marked + with a JALR relocation, that indicate where they jump to. + This saves some pipeline bubbles. */ + r_type = ELF_R_TYPE (abfd, irel->r_info); + if (r_type != R_MIPS_JALR) + continue; + + r_symndx = ELF_R_SYM (abfd, irel->r_info); + /* Compute the address of the jump target. */ + if (r_symndx >= extsymoff) + { + struct mips_elf_link_hash_entry *h + = ((struct mips_elf_link_hash_entry *) + elf_sym_hashes (abfd) [r_symndx - extsymoff]); + + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + + /* If a symbol is undefined, or if it may be overridden, + skip it. */ + if (! ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) + && h->root.root.u.def.section) + || (link_info->shared && ! link_info->symbolic + && ! (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))) + continue; + + sym_sec = h->root.root.u.def.section; + if (sym_sec->output_section) + symval = (h->root.root.u.def.value + + sym_sec->output_section->vma + + sym_sec->output_offset); + else + symval = h->root.root.u.def.value; + } + else + { + Elf_Internal_Sym *isym; + + /* Read this BFD's symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto relax_return; + } + + isym = isymbuf + r_symndx; + if (isym->st_shndx == SHN_UNDEF) + continue; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec + = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset; + } + + /* Compute branch offset, from delay slot of the jump to the + branch target. */ + sym_offset = (symval + irel->r_addend) + - (sec_start + irel->r_offset + 4); + + /* Branch offset must be properly aligned. */ + if ((sym_offset & 3) != 0) + continue; + + sym_offset >>= 2; + + /* Check that it's in range. */ + if (sym_offset < -0x8000 || sym_offset >= 0x8000) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto relax_return; + + free_contents = contents; + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto relax_return; + } + } + + instruction = bfd_get_32 (abfd, contents + irel->r_offset); + + /* If it was jalr <reg>, turn it into bgezal $zero, <target>. */ + if ((instruction & 0xfc1fffff) == 0x0000f809) + instruction = 0x04110000; + /* If it was jr <reg>, turn it into b <target>. */ + else if ((instruction & 0xfc1fffff) == 0x00000008) + instruction = 0x10000000; + else + continue; + + instruction |= (sym_offset & 0xffff); + bfd_put_32 (abfd, instruction, contents + irel->r_offset); + changed_contents = TRUE; + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (!changed_contents && !link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + return TRUE; + + relax_return: + if (free_contents != NULL) + free (free_contents); + return FALSE; +} + /* 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 @@ -7518,55 +7803,58 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) h->forced_local = TRUE; dynobj = elf_hash_table (info)->dynobj; - got = mips_elf_got_section (dynobj, FALSE); - g = mips_elf_section_data (got)->u.got_info; - - if (g->next) + if (dynobj != NULL) { - struct mips_got_entry e; - struct mips_got_info *gg = g; + got = mips_elf_got_section (dynobj, FALSE); + g = mips_elf_section_data (got)->u.got_info; - /* Since we're turning what used to be a global symbol into a - local one, bump up the number of local entries of each GOT - that had an entry for it. This will automatically decrease - the number of global entries, since global_gotno is actually - the upper limit of global entries. */ - e.abfd = dynobj; - e.symndx = -1; - e.d.h = h; + if (g->next) + { + struct mips_got_entry e; + struct mips_got_info *gg = g; + + /* Since we're turning what used to be a global symbol into a + local one, bump up the number of local entries of each GOT + that had an entry for it. This will automatically decrease + the number of global entries, since global_gotno is actually + the upper limit of global entries. */ + e.abfd = dynobj; + e.symndx = -1; + e.d.h = h; - for (g = g->next; g != gg; g = g->next) - if (htab_find (g->got_entries, &e)) - { - BFD_ASSERT (g->global_gotno > 0); - g->local_gotno++; - g->global_gotno--; - } + for (g = g->next; g != gg; g = g->next) + if (htab_find (g->got_entries, &e)) + { + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; + } - /* If this was a global symbol forced into the primary GOT, we - no longer need an entry for it. We can't release the entry - at this point, but we must at least stop counting it as one - of the symbols that required a forced got entry. */ - if (h->root.got.offset == 2) + /* If this was a global symbol forced into the primary GOT, we + no longer need an entry for it. We can't release the entry + at this point, but we must at least stop counting it as one + of the symbols that required a forced got entry. */ + if (h->root.got.offset == 2) + { + BFD_ASSERT (gg->assigned_gotno > 0); + gg->assigned_gotno--; + } + } + else if (g->global_gotno == 0 && g->global_gotsym == NULL) + /* If we haven't got through GOT allocation yet, just bump up the + number of local entries, as this symbol won't be counted as + global. */ + g->local_gotno++; + else if (h->root.got.offset == 1) { - BFD_ASSERT (gg->assigned_gotno > 0); - gg->assigned_gotno--; + /* If we're past non-multi-GOT allocation and this symbol had + been marked for a global got entry, give it a local entry + instead. */ + BFD_ASSERT (g->global_gotno > 0); + g->local_gotno++; + g->global_gotno--; } } - else if (g->global_gotno == 0 && g->global_gotsym == NULL) - /* If we haven't got through GOT allocation yet, just bump up the - number of local entries, as this symbol won't be counted as - global. */ - g->local_gotno++; - else if (h->root.got.offset == 1) - { - /* If we're past non-multi-GOT allocation and this symbol had - been marked for a global got entry, give it a local entry - instead. */ - BFD_ASSERT (g->global_gotno > 0); - g->local_gotno++; - g->global_gotno--; - } _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local); } diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 3f77943..3064c39 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -108,3 +108,6 @@ extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); extern unsigned long _bfd_elf_mips_mach PARAMS ((flagword)); +extern bfd_boolean _bfd_mips_relax_section (bfd *, asection *, + struct bfd_link_info *, + bfd_boolean *); diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 69e3782..734d78b 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -33,7 +33,9 @@ #endif #define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab +#ifndef bfd_elfNN_canonicalize_reloc #define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc +#endif #ifndef bfd_elfNN_find_nearest_line #define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line #endif diff --git a/bfd/format.c b/bfd/format.c index 9af6efc..655ccd9 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -163,7 +163,11 @@ bfd_check_format_matches (abfd, format, matching) if (!abfd->target_defaulted) { if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ - return FALSE; + { + if (matching) + free ((PTR) matching_vector); + return FALSE; + } right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd)); @@ -214,7 +218,11 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = *target; /* Change BFD's target temporarily. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return FALSE; + { + if (matching) + free ((PTR) matching_vector); + return FALSE; + } /* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format. We didn't used to even pay any diff --git a/bfd/hp300bsd.c b/bfd/hp300bsd.c index c0e3f95..4d005ce 100644 --- a/bfd/hp300bsd.c +++ b/bfd/hp300bsd.c @@ -1,5 +1,5 @@ /* BFD back-end for HP 9000/300 (68000-based) machines running BSD Unix. - Copyright 1992, 1994, 1995, 2001 Free Software Foundation, Inc. + Copyright 1992, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_BIG_ENDIAN_P #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define ENTRY_CAN_BE_ZERO #define N_SHARED_LIB(x) 0 /* Avoids warning */ #define TEXT_START_ADDR 0 diff --git a/bfd/i386aout.c b/bfd/i386aout.c index b2d106f..6b2948e 100644 --- a/bfd/i386aout.c +++ b/bfd/i386aout.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002 + Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ system, and I'll stick it in for the next release. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define N_TXTOFF(x) 0x20 #define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) diff --git a/bfd/i386dynix.c b/bfd/i386dynix.c index 51f0844..1787196 100644 --- a/bfd/i386dynix.c +++ b/bfd/i386dynix.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under dynix. - Copyright 1994, 1995, 2001 Free Software Foundation, Inc. + Copyright 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This BFD is currently only tested with gdb, writing object files may not work. */ -#define BYTES_IN_WORD 4 - #define TEXT_START_ADDR 4096 #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 5a2d382..6403e1c 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index 6bf6e72..32274ea 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c index 0e4c4e7..215f814 100644 --- a/bfd/i386mach3.c +++ b/bfd/i386mach3.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002 + Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE 0x1000 #define TEXT_START_ADDR 0x10000 #define ARCH 32 -#define BYTES_IN_WORD 4 /* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ #define N_HEADER_IN_TEXT(x) 1 @@ -225,8 +225,8 @@ ieee_write_int (abfd, value) { unsigned int length; - /* How many significant bytes ? */ - /* FIXME FOR LONGER INTS */ + /* How many significant bytes ? */ + /* FIXME FOR LONGER INTS. */ if (value & 0xff000000) length = 4; else if (value & 0x00ff0000) @@ -301,10 +301,8 @@ ieee_write_id (abfd, id) return TRUE; } -/*************************************************************************** -Functions for reading from ieee files in the strange way that the -standard requires: -*/ +/* Functions for reading from ieee files in the strange way that the + standard requires. */ #define this_byte(ieee) *((ieee)->input_p) #define next_byte(ieee) ((ieee)->input_p++) @@ -316,6 +314,7 @@ read_2bytes (ieee) { unsigned char c1 = this_byte_and_next (ieee); unsigned char c2 = this_byte_and_next (ieee); + return (c1 << 8) | c2; } @@ -326,10 +325,9 @@ bfd_get_string (ieee, string, length) size_t length; { size_t i; + for (i = 0; i < length; i++) - { - string[i] = this_byte_and_next (ieee); - } + string[i] = this_byte_and_next (ieee); } static char * @@ -338,23 +336,25 @@ read_id (ieee) { size_t length; char *string; + length = this_byte_and_next (ieee); if (length <= 0x7f) { - /* Simple string of length 0 to 127 */ + /* Simple string of length 0 to 127. */ } else if (length == 0xde) { - /* Length is next byte, allowing 0..255 */ + /* Length is next byte, allowing 0..255. */ length = this_byte_and_next (ieee); } else if (length == 0xdf) { - /* Length is next two bytes, allowing 0..65535 */ + /* Length is next two bytes, allowing 0..65535. */ length = this_byte_and_next (ieee); length = (length * 256) + this_byte_and_next (ieee); } - /* Buy memory and read string */ + + /* Buy memory and read string. */ string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1); if (!string) return NULL; @@ -380,57 +380,63 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) term_count++; } - if (bfd_is_com_section (symbol->section) - || bfd_is_und_section (symbol->section)) - { - /* Def of a common symbol */ - if (! ieee_write_byte (abfd, ieee_variable_X_enum) - || ! ieee_write_int (abfd, symbol->value)) - return FALSE; - term_count++; - } - else if (! bfd_is_abs_section (symbol->section)) + /* Badly formatted binaries can have a missing symbol, + so test here to prevent a seg fault. */ + if (symbol != NULL) { - /* Ref to defined symbol - */ - - if (symbol->flags & BSF_GLOBAL) + if (bfd_is_com_section (symbol->section) + || bfd_is_und_section (symbol->section)) { - if (! ieee_write_byte (abfd, ieee_variable_I_enum) + /* Def of a common symbol. */ + if (! ieee_write_byte (abfd, ieee_variable_X_enum) || ! ieee_write_int (abfd, symbol->value)) return FALSE; - term_count++; + term_count ++; } - else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM)) + else if (! bfd_is_abs_section (symbol->section)) { - /* This is a reference to a defined local symbol. We can - easily do a local as a section+offset. */ - if (! ieee_write_byte (abfd, ieee_variable_R_enum) - || ! ieee_write_byte (abfd, - (bfd_byte) (symbol->section->index - + IEEE_SECTION_NUMBER_BASE))) - return FALSE; - term_count++; - if (symbol->value != 0) + /* Ref to defined symbol - */ + + if (symbol->flags & BSF_GLOBAL) { - if (! ieee_write_int (abfd, symbol->value)) + if (! ieee_write_byte (abfd, ieee_variable_I_enum) + || ! ieee_write_int (abfd, symbol->value)) return FALSE; term_count++; } - } - else - { - (*_bfd_error_handler) - (_("%s: unrecognized symbol `%s' flags 0x%x"), - bfd_get_filename (abfd), bfd_asymbol_name (symbol), - symbol->flags); - bfd_set_error (bfd_error_invalid_operation); - return FALSE; + else if (symbol->flags & (BSF_LOCAL | BSF_SECTION_SYM)) + { + /* This is a reference to a defined local symbol. We can + easily do a local as a section+offset. */ + if (! ieee_write_byte (abfd, ieee_variable_R_enum) + || ! ieee_write_byte (abfd, + (bfd_byte) (symbol->section->index + + IEEE_SECTION_NUMBER_BASE))) + return FALSE; + + term_count++; + if (symbol->value != 0) + { + if (! ieee_write_int (abfd, symbol->value)) + return FALSE; + term_count++; + } + } + else + { + (*_bfd_error_handler) + (_("%s: unrecognized symbol `%s' flags 0x%x"), + bfd_get_filename (abfd), bfd_asymbol_name (symbol), + symbol->flags); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } } } if (pcrel) { - /* subtract the pc from here by asking for PC of this section*/ + /* Subtract the pc from here by asking for PC of this section. */ if (! ieee_write_byte (abfd, ieee_variable_P_enum) || ! ieee_write_byte (abfd, (bfd_byte) (index + IEEE_SECTION_NUMBER_BASE)) @@ -440,10 +446,8 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) /* Handle the degenerate case of a 0 address. */ if (term_count == 0) - { - if (! ieee_write_int (abfd, (bfd_vma) 0)) - return FALSE; - } + if (! ieee_write_int (abfd, (bfd_vma) 0)) + return FALSE; while (term_count > 1) { @@ -455,11 +459,8 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) return TRUE; } -/*****************************************************************************/ +/* Writes any integer into the buffer supplied and always takes 5 bytes. */ -/* -writes any integer into the buffer supplied and always takes 5 bytes -*/ static void ieee_write_int5 (buffer, value) bfd_byte *buffer; @@ -492,6 +493,7 @@ parse_int (ieee, value_ptr) { int value = this_byte (ieee); int result; + if (value >= 0 && value <= 127) { *value_ptr = value; @@ -501,6 +503,7 @@ parse_int (ieee, value_ptr) else if (value >= 0x80 && value <= 0x88) { unsigned int count = value & 0xf; + result = 0; next_byte (ieee); while (count) @@ -664,7 +667,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) bfd_boolean loop = TRUE; ieee_value_type stack[10]; - /* The stack pointer always points to the next unused location */ + /* The stack pointer always points to the next unused location. */ #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC; #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value; ieee_value_type *sp = stack; @@ -675,9 +678,10 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) switch (this_byte (&(ieee->h))) { case ieee_variable_P_enum: - /* P variable, current program counter for section n */ + /* P variable, current program counter for section n. */ { int section_n; + next_byte (&(ieee->h)); *pcrel = TRUE; section_n = must_parse_int (&(ieee->h)); @@ -685,25 +689,25 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) break; } case ieee_variable_L_enum: - /* L variable address of section N */ + /* L variable address of section N. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); break; case ieee_variable_R_enum: - /* R variable, logical address of section module */ - /* FIXME, this should be different to L */ + /* R variable, logical address of section module. */ + /* FIXME, this should be different to L. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, ieee->section_table[must_parse_int (&(ieee->h))], 0); break; case ieee_variable_S_enum: - /* S variable, size in MAUS of section module */ + /* S variable, size in MAUS of section module. */ next_byte (&(ieee->h)); PUSH (NOSYMBOL, 0, ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size); break; case ieee_variable_I_enum: - /* Push the address of variable n */ + /* Push the address of variable n. */ { ieee_symbol_index_type sy; next_byte (&(ieee->h)); @@ -714,7 +718,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) } break; case ieee_variable_X_enum: - /* Push the address of external variable n */ + /* Push the address of external variable n. */ { ieee_symbol_index_type sy; next_byte (&(ieee->h)); @@ -776,7 +780,6 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) terms. We can tell if that's the case by ensuring that sp == stack here. If not, then we've pushed something too far, so we keep adding. */ - while (sp != stack + 1) { asection *section1; @@ -822,7 +825,7 @@ ieee_part_after (ieee, here) } static unsigned int last_index; -static char last_type; /* is the index for an X or a D */ +static char last_type; /* Is the index for an X or a D. */ static ieee_symbol_type * get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) @@ -834,8 +837,9 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) unsigned int *max_index; int this_type; { - /* Need a new symbol */ + /* Need a new symbol. */ unsigned int new_index = must_parse_int (&(ieee->h)); + if (new_index != last_index || this_type != last_type) { ieee_symbol_type *new_symbol; @@ -851,9 +855,8 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) **pptr = new_symbol; *pptr = &new_symbol->next; if (new_index > *max_index) - { - *max_index = new_index; - } + *max_index = new_index; + last_type = this_type; new_symbol->symbol.section = bfd_abs_section_ptr; return new_symbol; @@ -941,7 +944,7 @@ ieee_slurp_external_symbols (abfd) } break; case ieee_external_reference_info_record_enum: - /* Skip over ATX record. */ + /* Skip over ATX record. */ parse_int (&(ieee->h), &value); parse_int (&(ieee->h), &value); parse_int (&(ieee->h), &value); @@ -950,7 +953,7 @@ ieee_slurp_external_symbols (abfd) case ieee_atn_record_enum: /* We may get call optimization information here, which we just ignore. The format is - {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */ + {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs}. */ parse_int (&ieee->h, &value); parse_int (&ieee->h, &value); parse_int (&ieee->h, &value); @@ -1036,16 +1039,16 @@ ieee_slurp_external_symbols (abfd) bfd_vma size; bfd_vma value; next_byte (&(ieee->h)); - /* Throw away the external reference index */ + /* Throw away the external reference index. */ (void) must_parse_int (&(ieee->h)); - /* Fetch the default size if not resolved */ + /* Fetch the default size if not resolved. */ size = must_parse_int (&(ieee->h)); - /* Fetch the defautlt value if available */ + /* Fetch the defautlt value if available. */ if (! parse_int (&(ieee->h), &value)) { value = 0; } - /* This turns into a common */ + /* This turns into a common. */ symbol->symbol.section = bfd_com_section_ptr; symbol->symbol.value = size; } @@ -1136,10 +1139,8 @@ ieee_get_symtab_upper_bound (abfd) (abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0; } -/* -Move from our internal lists to the canon table, and insert in -symbol index order -*/ +/* Move from our internal lists to the canon table, and insert in + symbol index order. */ extern const bfd_target ieee_vec; @@ -1172,41 +1173,35 @@ ieee_get_symtab (abfd, location) if (! ieee->symbol_table_full) { - /* Arrgh - there are gaps in the table, run through and fill them */ - /* up with pointers to a null place */ + /* Arrgh - there are gaps in the table, run through and fill them + up with pointers to a null place. */ unsigned int i; + for (i = 0; i < abfd->symcount; i++) - { - location[i] = &empty_symbol; - } + location[i] = &empty_symbol; } ieee->external_symbol_base_offset = -ieee->external_symbol_min_index; for (symp = IEEE_DATA (abfd)->external_symbols; symp != (ieee_symbol_type *) NULL; symp = symp->next) - { - /* Place into table at correct index locations */ - location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol; - } + /* Place into table at correct index locations. */ + location[symp->index + ieee->external_symbol_base_offset] = &symp->symbol; - /* The external refs are indexed in a bit */ + /* The external refs are indexed in a bit. */ ieee->external_reference_base_offset = -ieee->external_reference_min_index + ieee->external_symbol_count; for (symp = IEEE_DATA (abfd)->external_reference; symp != (ieee_symbol_type *) NULL; symp = symp->next) - { - location[symp->index + ieee->external_reference_base_offset] = - &symp->symbol; - - } + location[symp->index + ieee->external_reference_base_offset] = + &symp->symbol; } + if (abfd->symcount) - { - location[abfd->symcount] = (asymbol *) NULL; - } + location[abfd->symcount] = (asymbol *) NULL; + return abfd->symcount; } @@ -1286,34 +1281,33 @@ ieee_slurp_sections (abfd) section_type[0] = this_byte_and_next (&(ieee->h)); /* Set minimal section attributes. Attributes are - extended later, based on section contents. */ - + extended later, based on section contents. */ switch (section_type[0]) { case 0xC1: - /* Normal attributes for absolute sections */ + /* Normal attributes for absolute sections. */ section_type[1] = this_byte (&(ieee->h)); section->flags = SEC_ALLOC; switch (section_type[1]) { - case 0xD3: /* AS Absolute section attributes */ + case 0xD3: /* AS Absolute section attributes. */ next_byte (&(ieee->h)); section_type[2] = this_byte (&(ieee->h)); switch (section_type[2]) { case 0xD0: - /* Normal code */ + /* Normal code. */ next_byte (&(ieee->h)); section->flags |= SEC_CODE; break; case 0xC4: - /* Normal data */ + /* Normal data. */ next_byte (&(ieee->h)); section->flags |= SEC_DATA; break; case 0xD2: next_byte (&(ieee->h)); - /* Normal rom data */ + /* Normal rom data. */ section->flags |= SEC_ROM | SEC_DATA; break; default: @@ -1321,20 +1315,20 @@ ieee_slurp_sections (abfd) } } break; - case 0xC3: /* Named relocatable sections (type C) */ + case 0xC3: /* Named relocatable sections (type C). */ section_type[1] = this_byte (&(ieee->h)); section->flags = SEC_ALLOC; switch (section_type[1]) { - case 0xD0: /* Normal code (CP) */ + case 0xD0: /* Normal code (CP). */ next_byte (&(ieee->h)); section->flags |= SEC_CODE; break; - case 0xC4: /* Normal data (CD) */ + case 0xC4: /* Normal data (CD). */ next_byte (&(ieee->h)); section->flags |= SEC_DATA; break; - case 0xD2: /* Normal rom data (CR) */ + case 0xD2: /* Normal rom data (CR). */ next_byte (&(ieee->h)); section->flags |= SEC_ROM | SEC_DATA; break; @@ -1343,12 +1337,12 @@ ieee_slurp_sections (abfd) } } - /* Read section name, use it if non empty. */ + /* Read section name, use it if non empty. */ name = read_id (&ieee->h); if (name[0]) section->name = name; - /* Skip these fields, which we don't care about */ + /* Skip these fields, which we don't care about. */ { bfd_vma parent, brother, context; parse_int (&(ieee->h), &parent); @@ -1452,9 +1446,7 @@ ieee_slurp_debug (abfd) return TRUE; } -/*********************************************************************** -* archive stuff -*/ +/* Archive stuff. */ const bfd_target * ieee_archive_p (abfd) @@ -1640,11 +1632,9 @@ ieee_object_p (abfd) goto got_wrong_format; ieee->mb.module_name = read_id (&(ieee->h)); if (abfd->filename == (const char *) NULL) - { - abfd->filename = ieee->mb.module_name; - } - /* Determine the architecture and machine type of the object file. - */ + abfd->filename = ieee->mb.module_name; + + /* Determine the architecture and machine type of the object file. */ { const bfd_arch_info_type *arch; char family[10]; @@ -1685,7 +1675,7 @@ ieee_object_p (abfd) } else if (TOUPPER (processor[3]) == 'F') /* 68F333 */ strcpy (family, "68332"); /* CPU32 */ - else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */ + else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */ && ((TOUPPER (processor[2]) == 'E') || (TOUPPER (processor[2]) == 'H') || (TOUPPER (processor[2]) == 'L'))) @@ -1694,7 +1684,7 @@ ieee_object_p (abfd) strncat (family, processor + 4, 7); family[9] = '\0'; } - else /* "Regular" processors */ + else /* "Regular" processors. */ { strncpy (family, processor, 9); family[9] = '\0'; @@ -1716,43 +1706,34 @@ ieee_object_p (abfd) } if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum) - { - goto fail; - } + goto fail; + next_byte (&(ieee->h)); if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau)) - { - goto fail; - } + goto fail; + if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address)) - { - goto fail; - } + goto fail; - /* If there is a byte order info, take it */ - if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum || - this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) + /* If there is a byte order info, take it. */ + if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum + || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) next_byte (&(ieee->h)); for (part = 0; part < N_W_VARIABLES; part++) { bfd_boolean ok; + if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum) - { - goto fail; - } + goto fail; + if (this_byte_and_next (&(ieee->h)) != part) - { - goto fail; - } + goto fail; ieee->w.offset[part] = parse_i (&(ieee->h), &ok); if (! ok) - { - goto fail; - } - + goto fail; } if (ieee->w.r.external_part != 0) @@ -1761,7 +1742,7 @@ ieee_object_p (abfd) /* By now we know that this is a real IEEE file, we're going to read the whole thing into memory so that we can run up and down it quickly. We can work out how big the file is from the trailer - record */ + record. */ amt = ieee->w.r.me_record + 1; IEEE_DATA (abfd)->h.first_byte = @@ -1782,7 +1763,6 @@ ieee_object_p (abfd) /* Parse section data to activate file and section flags implied by section contents. */ - if (! ieee_slurp_section_data (abfd)) goto fail; @@ -1835,6 +1815,7 @@ ieee_print_symbol (abfd, afile, symbol, how) (symbol->section == (asection *) NULL ? "*abs" : symbol->section->name); + if (symbol->name[0] == ' ') { fprintf (file, "* empty table entry "); @@ -1868,6 +1849,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) { unsigned int number_of_maus; unsigned int i; + next_byte (&(ieee->h)); number_of_maus = must_parse_int (&(ieee->h)); @@ -1882,6 +1864,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) case ieee_load_with_relocation_enum: { bfd_boolean loop = TRUE; + next_byte (&(ieee->h)); while (loop) { @@ -1923,7 +1906,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) if (this_byte (&(ieee->h)) == (int) ieee_comma) { next_byte (&(ieee->h)); - /* Fetch number of bytes to pad */ + /* Fetch number of bytes to pad. */ extra = must_parse_int (&(ieee->h)); }; @@ -1941,7 +1924,7 @@ do_one (ieee, current_map, location_ptr, s, iterations) default: break; } - /* Build a relocation entry for this type */ + /* Build a relocation entry for this type. */ /* If pc rel then stick -ve pc into instruction and take out of reloc .. @@ -2053,7 +2036,8 @@ do_one (ieee, current_map, location_ptr, s, iterations) return TRUE; } -/* Read in all the section data and relocation stuff too */ +/* Read in all the section data and relocation stuff too. */ + static bfd_boolean ieee_slurp_section_data (abfd) bfd *abfd; @@ -2064,14 +2048,13 @@ ieee_slurp_section_data (abfd) ieee_per_section_type *current_map = (ieee_per_section_type *) NULL; asection *s; - /* Seek to the start of the data area */ + /* Seek to the start of the data area. */ if (ieee->read_data) return TRUE; ieee->read_data = TRUE; ieee_seek (ieee, ieee->w.r.data_part); - /* Allocate enough space for all the section contents */ - + /* Allocate enough space for all the section contents. */ for (s = abfd->sections; s != (asection *) NULL; s = s->next) { ieee_per_section_type *per = ieee_per_section (s); @@ -2080,7 +2063,6 @@ ieee_slurp_section_data (abfd) per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size); if (!per->data) return FALSE; - /*SUPPRESS 68*/ per->reloc_tail_ptr = (ieee_reloc_type **) & (s->relocation); } @@ -2089,7 +2071,7 @@ ieee_slurp_section_data (abfd) { switch (this_byte (&(ieee->h))) { - /* IF we see anything strange then quit */ + /* IF we see anything strange then quit. */ default: return TRUE; @@ -2100,9 +2082,9 @@ ieee_slurp_section_data (abfd) s->flags |= SEC_LOAD | SEC_HAS_CONTENTS; current_map = ieee_per_section (s); location_ptr = current_map->data - s->vma; - /* The document I have says that Microtec's compilers reset */ - /* this after a sec section, even though the standard says not */ - /* to. SO .. */ + /* The document I have says that Microtec's compilers reset + this after a sec section, even though the standard says not + to, SO... */ current_map->pc = s->vma; break; @@ -2116,8 +2098,9 @@ ieee_slurp_section_data (abfd) ieee_symbol_index_type symbol; unsigned int extra; bfd_boolean pcrel; + next_byte (&(ieee->h)); - must_parse_int (&(ieee->h)); /* Throw away section #*/ + must_parse_int (&(ieee->h)); /* Throw away section #. */ parse_expression (ieee, &value, &symbol, &pcrel, &extra, @@ -2132,7 +2115,7 @@ ieee_slurp_section_data (abfd) if (this_byte (&(ieee->h)) == ieee_function_either_open_b_enum) next_byte (&(ieee->h)); abfd->start_address = must_parse_int (&(ieee->h)); - /* We've got to the end of the data now - */ + /* We've got to the end of the data now - */ return TRUE; default: BFD_FAIL (); @@ -2142,18 +2125,17 @@ ieee_slurp_section_data (abfd) case ieee_repeat_data_enum: { /* Repeat the following LD or LR n times - we do this by - remembering the stream pointer before running it and - resetting it and running it n times. We special case - the repetition of a repeat_data/load_constant - */ - + remembering the stream pointer before running it and + resetting it and running it n times. We special case + the repetition of a repeat_data/load_constant. */ unsigned int iterations; unsigned char *start; + next_byte (&(ieee->h)); iterations = must_parse_int (&(ieee->h)); start = ieee->h.input_p; - if (start[0] == (int) ieee_load_constant_bytes_enum && - start[1] == 1) + if (start[0] == (int) ieee_load_constant_bytes_enum + && start[1] == 1) { while (iterations != 0) { @@ -2179,10 +2161,8 @@ ieee_slurp_section_data (abfd) break; case ieee_load_constant_bytes_enum: case ieee_load_with_relocation_enum: - { - if (!do_one (ieee, current_map, location_ptr, s, 1)) - return FALSE; - } + if (!do_one (ieee, current_map, location_ptr, s, 1)) + return FALSE; } } } @@ -2245,7 +2225,7 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols) while (src != (ieee_reloc_type *) NULL) { - /* Work out which symbol to attach it this reloc to */ + /* Work out which symbol to attach it this reloc to. */ switch (src->symbol.letter) { case 'I': @@ -2304,7 +2284,7 @@ ieee_write_section_part (abfd) if (abfd->flags & EXEC_P) { - /* This image is executable, so output absolute sections */ + /* This image is executable, so output absolute sections. */ if (! ieee_write_byte (abfd, ieee_variable_A_enum) || ! ieee_write_byte (abfd, ieee_variable_S_enum)) return FALSE; @@ -2343,7 +2323,7 @@ ieee_write_section_part (abfd) ieee_write_int (abfd, 0); /* Brother */ ieee_write_int (abfd, 0); /* Context */ #endif - /* Alignment */ + /* Alignment. */ if (! ieee_write_byte (abfd, ieee_section_alignment_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index @@ -2351,7 +2331,7 @@ ieee_write_section_part (abfd) || ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power)) return FALSE; - /* Size */ + /* Size. */ if (! ieee_write_2bytes (abfd, ieee_section_size_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index @@ -2360,8 +2340,8 @@ ieee_write_section_part (abfd) return FALSE; if (abfd->flags & EXEC_P) { - /* Relocateable sections don't have asl records */ - /* Vma */ + /* Relocateable sections don't have asl records. */ + /* Vma. */ if (! ieee_write_2bytes (abfd, ieee_section_base_address_enum) || ! ieee_write_byte (abfd, ((bfd_byte) @@ -2394,7 +2374,7 @@ do_with_relocs (abfd, s) sizeof (arelent **), comp); - /* Output the section preheader */ + /* Output the section preheader. */ if (! ieee_write_byte (abfd, ieee_set_current_section_enum) || ! ieee_write_byte (abfd, (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)) @@ -2417,23 +2397,21 @@ do_with_relocs (abfd, s) if (relocs_to_go == 0) { /* If there aren't any relocations then output the load constant - byte opcode rather than the load with relocation opcode */ - + byte opcode rather than the load with relocation opcode. */ while (current_byte_index < s->_raw_size) { bfd_size_type run; unsigned int MAXRUN = 127; + run = MAXRUN; if (run > s->_raw_size - current_byte_index) - { - run = s->_raw_size - current_byte_index; - } + run = s->_raw_size - current_byte_index; if (run != 0) { if (! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)) return FALSE; - /* Output a stream of bytes */ + /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) @@ -2454,7 +2432,7 @@ do_with_relocs (abfd, s) if ((PTR) stream == (PTR) NULL) { - /* Outputting a section without data, fill it up */ + /* Outputting a section without data, fill it up. */ stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size); if (!stream) return FALSE; @@ -2463,6 +2441,7 @@ do_with_relocs (abfd, s) { bfd_size_type run; unsigned int MAXRUN = 127; + if (relocs_to_go) { run = (*p)->address - current_byte_index; @@ -2470,17 +2449,14 @@ do_with_relocs (abfd, s) run = MAXRUN; } else - { - run = MAXRUN; - } + run = MAXRUN; + if (run > s->_raw_size - current_byte_index) - { - run = s->_raw_size - current_byte_index; - } + run = s->_raw_size - current_byte_index; if (run != 0) { - /* Output a stream of bytes */ + /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) @@ -2488,7 +2464,8 @@ do_with_relocs (abfd, s) return FALSE; current_byte_index += run; } - /* Output any relocations here */ + + /* Output any relocations here. */ if (relocs_to_go && (*p) && (*p)->address == current_byte_index) { while (relocs_to_go @@ -2496,14 +2473,10 @@ do_with_relocs (abfd, s) { arelent *r = *p; bfd_signed_vma ov; - #if 0 if (r->howto->pc_relative) - { - r->addend += current_byte_index; - } + r->addend += current_byte_index; #endif - switch (r->howto->size) { case 2: @@ -2638,6 +2611,7 @@ do_without_relocs (abfd, s) else { unsigned int i; + for (i = 0; i < s->_raw_size; i++) { if (stream[i] != 0) @@ -2699,6 +2673,7 @@ static void flush () { bfd_size_type amt = output_ptr - output_ptr_start; + if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt) abort (); output_ptr = output_ptr_start; @@ -2720,20 +2695,14 @@ write_int (value) else { unsigned int length; - /* How many significant bytes ? */ - /* FIXME FOR LONGER INTS */ + /* How many significant bytes ? */ + /* FIXME FOR LONGER INTS. */ if (value & 0xff000000) - { - length = 4; - } + length = 4; else if (value & 0x00ff0000) - { - length = 3; - } + length = 3; else if (value & 0x0000ff00) - { - length = 2; - } + length = 2; else length = 1; @@ -2749,7 +2718,6 @@ write_int (value) case 1: OUT (value); } - } } @@ -2758,6 +2726,7 @@ copy_id () { int length = THIS (); char ch; + OUT (length); NEXT (); while (length--) @@ -2775,6 +2744,7 @@ copy_expression () int stack[10]; int *tos = stack; int value; + while (1) { switch (THIS ()) @@ -2822,7 +2792,7 @@ copy_expression () default: if (THIS () > 0x84) { - /* Not a number, just bug out with the answer */ + /* Not a number, just bug out with the answer. */ write_int (*(--tos)); return; } @@ -2830,7 +2800,7 @@ copy_expression () NEXT (); break; case 0xa5: - /* PLUS anything */ + /* PLUS anything. */ value = *(--tos); value += *(--tos); *tos++ = value; @@ -2841,6 +2811,7 @@ copy_expression () int section_number; ieee_data_type *ieee; asection *s; + NEXT (); section_number = THIS (); @@ -2874,7 +2845,7 @@ fill_int (buf) { if (buf->buffer == output_buffer) { - /* Still a chance to output the size */ + /* Still a chance to output the size. */ int value = output_ptr - buf->ptrp + 3; buf->ptrp[0] = value >> 24; buf->ptrp[1] = value >> 16; @@ -2889,6 +2860,7 @@ drop_int (buf) { int type = THIS (); int ch; + if (type <= 0x84) { NEXT (); @@ -2962,7 +2934,8 @@ static void f1_record () { int ch; - /* ATN record */ + + /* ATN record. */ NEXT (); ch = THIS (); switch (ch) @@ -3002,7 +2975,7 @@ f1_record () } break; case 0xd8: - /* EXternal ref */ + /* EXternal ref. */ NEXT (); OUT (0xf1); OUT (0xd8); @@ -3056,13 +3029,12 @@ f1_record () break; } } - } static void f0_record () { - /* Attribute record */ + /* Attribute record. */ NEXT (); OUT (0xf0); INTn (Symbol name); @@ -3073,6 +3045,7 @@ static void copy_till_end () { int ch = THIS (); + while (1) { while (ch <= 0x80) @@ -3131,11 +3104,12 @@ f8_record () case 0x01: case 0x02: case 0x03: - /* Unique typedefs for module */ - /* GLobal typedefs */ - /* High level module scope beginning */ + /* Unique typedefs for module. */ + /* GLobal typedefs. */ + /* High level module scope beginning. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (ch); @@ -3150,9 +3124,10 @@ f8_record () } break; case 0x04: - /* Global function */ + /* Global function. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x04); @@ -3172,9 +3147,10 @@ f8_record () break; case 0x05: - /* File name for source line numbers */ + /* File name for source line numbers. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x05); @@ -3194,9 +3170,10 @@ f8_record () break; case 0x06: - /* Local function */ + /* Local function. */ { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x06); @@ -3214,7 +3191,7 @@ f8_record () break; case 0x0a: - /* Assembler module scope beginning -*/ + /* Assembler module scope beginning - */ { struct output_buffer_struct ob; @@ -3243,6 +3220,7 @@ f8_record () case 0x0b: { struct output_buffer_struct ob; + NEXT (); OUT (0xf8); OUT (0x0b); @@ -3279,6 +3257,7 @@ static void block () { int ch; + while (1) { ch = THIS (); @@ -3310,11 +3289,8 @@ block () } - -/* relocate_debug, - moves all the debug information from the source bfd to the output - bfd, and relocates any expressions it finds -*/ +/* Moves all the debug information from the source bfd to the output + bfd, and relocates any expressions it finds. */ static void relocate_debug (output, input) @@ -3375,6 +3351,7 @@ ieee_write_debug_part (abfd) { bfd *entry = chain->this; ieee_data_type *entry_ieee = IEEE_DATA (entry); + if (entry_ieee->w.r.debug_information_part) { if (bfd_seek (entry, entry_ieee->w.r.debug_information_part, @@ -3385,14 +3362,11 @@ ieee_write_debug_part (abfd) chain = chain->next; } + if (some_debug) - { - ieee->w.r.debug_information_part = here; - } + ieee->w.r.debug_information_part = here; else - { - ieee->w.r.debug_information_part = 0; - } + ieee->w.r.debug_information_part = 0; flush (); } @@ -3407,8 +3381,10 @@ ieee_write_data_part (abfd) bfd *abfd; { asection *s; + ieee_data_type *ieee = IEEE_DATA (abfd); ieee->w.r.data_part = bfd_tell (abfd); + for (s = abfd->sections; s != (asection *) NULL; s = s->next) { /* Skip sections that have no loadable contents (.bss, @@ -3439,6 +3415,7 @@ init_for_output (abfd) bfd *abfd; { asection *s; + for (s = abfd->sections; s != (asection *) NULL; s = s->next) { if ((s->flags & SEC_DEBUGGING) != 0) @@ -3454,11 +3431,11 @@ init_for_output (abfd) return TRUE; } -/** exec and core file sections */ +/* Exec and core file sections. */ + +/* Set section contents is complicated with IEEE since the format is + not a byte image, but a record stream. */ -/* set section contents is complicated with IEEE since the format is -* not a byte image, but a record stream. -*/ static bfd_boolean ieee_set_section_contents (abfd, section, location, offset, count) bfd *abfd; @@ -3504,20 +3481,21 @@ ieee_write_external_part (abfd) { asymbol **q; ieee_data_type *ieee = IEEE_DATA (abfd); - unsigned int reference_index = IEEE_REFERENCE_BASE; unsigned int public_index = IEEE_PUBLIC_BASE + 2; file_ptr here = bfd_tell (abfd); bfd_boolean hadone = FALSE; + if (abfd->outsymbols != (asymbol **) NULL) { for (q = abfd->outsymbols; *q != (asymbol *) NULL; q++) { asymbol *p = *q; + if (bfd_is_und_section (p->section)) { - /* This must be a symbol reference .. */ + /* This must be a symbol reference. */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name)) @@ -3528,7 +3506,7 @@ ieee_write_external_part (abfd) } else if (bfd_is_com_section (p->section)) { - /* This is a weak reference */ + /* This is a weak reference. */ if (! ieee_write_byte (abfd, ieee_external_reference_enum) || ! ieee_write_int (abfd, (bfd_vma) reference_index) || ! ieee_write_id (abfd, p->name) @@ -3543,8 +3521,7 @@ ieee_write_external_part (abfd) } else if (p->flags & BSF_GLOBAL) { - /* This must be a symbol definition */ - + /* This must be a symbol definition. */ if (! ieee_write_byte (abfd, ieee_external_symbol_enum) || ! ieee_write_int (abfd, (bfd_vma) public_index) || ! ieee_write_id (abfd, p->name) @@ -3555,7 +3532,7 @@ ieee_write_external_part (abfd) || ! ieee_write_byte (abfd, 1)) /* one of them */ return FALSE; - /* Write out the value */ + /* Write out the value. */ if (! ieee_write_2bytes (abfd, ieee_value_record_enum) || ! ieee_write_int (abfd, (bfd_vma) public_index)) return FALSE; @@ -3564,7 +3541,7 @@ ieee_write_external_part (abfd) if (abfd->flags & EXEC_P) { /* If fully linked, then output all symbols - relocated */ + relocated. */ if (! (ieee_write_int (abfd, (p->value @@ -3596,8 +3573,8 @@ ieee_write_external_part (abfd) } else { - /* This can happen - when there are gaps in the symbols read */ - /* from an input ieee file */ + /* This can happen - when there are gaps in the symbols read + from an input ieee file. */ } } } @@ -3611,9 +3588,9 @@ ieee_write_external_part (abfd) static const unsigned char exten[] = { 0xf0, 0x20, 0x00, - 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */ - 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */ - 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */ + 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */ + 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */ + 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocateable to x. */ }; static const unsigned char envi[] = @@ -3746,7 +3723,7 @@ ieee_write_object_contents (abfd) unsigned int i; file_ptr old; - /* Fast forward over the header area */ + /* Fast forward over the header area. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return FALSE; @@ -3755,14 +3732,14 @@ ieee_write_object_contents (abfd) || ! ieee_write_id (abfd, abfd->filename)) return FALSE; - /* Fast forward over the variable bits */ + /* Fast forward over the variable bits. */ if (! ieee_write_byte (abfd, ieee_address_descriptor_enum)) return FALSE; - /* Bits per MAU */ + /* Bits per MAU. */ if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_byte (abfd)))) return FALSE; - /* MAU's per address */ + /* MAU's per address. */ if (! ieee_write_byte (abfd, (bfd_byte) (bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd)))) @@ -3823,11 +3800,6 @@ ieee_write_object_contents (abfd) if (! ieee_write_external_part (abfd)) return FALSE; - /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/ - - /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/ - - /* Write any debugs we have been told about. */ if (! ieee_write_debug_part (abfd)) return FALSE; @@ -3842,7 +3814,7 @@ ieee_write_object_contents (abfd) if (! ieee_write_me_part (abfd)) return FALSE; - /* Generate the header */ + /* Generate the header. */ if (bfd_seek (abfd, old, SEEK_SET) != 0) return FALSE; @@ -3861,7 +3833,7 @@ ieee_write_object_contents (abfd) /* We read the symbols into a buffer, which is discarded when this function exits. We read the strings into a buffer large enough to - hold them all plus all the cached symbol entries. */ + hold them all plus all the cached symbol entries. */ static asymbol * ieee_make_empty_symbol (abfd) @@ -3869,6 +3841,7 @@ ieee_make_empty_symbol (abfd) { bfd_size_type amt = sizeof (ieee_symbol_type); ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt); + if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -3881,15 +3854,16 @@ ieee_openr_next_archived_file (arch, prev) bfd *prev; { ieee_ar_data_type *ar = IEEE_AR_DATA (arch); - /* take the next one from the arch state, or reset */ + + /* Take the next one from the arch state, or reset. */ if (prev == (bfd *) NULL) - { - /* Reset the index - the first two entries are bogus*/ - ar->element_index = 2; - } + /* Reset the index - the first two entries are bogus. */ + ar->element_index = 2; + while (TRUE) { ieee_ar_obstack_type *p = ar->elements + ar->element_index; + ar->element_index++; if (ar->element_index <= ar->element_count) { @@ -3908,7 +3882,6 @@ ieee_openr_next_archived_file (arch, prev) bfd_set_error (bfd_error_no_more_archived_files); return (bfd *) NULL; } - } } @@ -3986,8 +3959,7 @@ ieee_bfd_debug_info_end (abfd) /* Add this section to the list of sections we have debug info for, to - be ready to output it at close time - */ + be ready to output it at close time. */ static void ieee_bfd_debug_info_accumulate (abfd, section) bfd *abfd; @@ -3995,37 +3967,34 @@ ieee_bfd_debug_info_accumulate (abfd, section) { ieee_data_type *ieee = IEEE_DATA (section->owner); ieee_data_type *output_ieee = IEEE_DATA (abfd); - /* can only accumulate data from other ieee bfds */ + + /* Can only accumulate data from other ieee bfds. */ if (section->owner->xvec != abfd->xvec) return; - /* Only bother once per bfd */ + /* Only bother once per bfd. */ if (ieee->done_debug) return; ieee->done_debug = TRUE; - /* Don't bother if there is no debug info */ + /* Don't bother if there is no debug info. */ if (ieee->w.r.debug_information_part == 0) return; - - /* Add to chain */ + /* Add to chain. */ { bfd_size_type amt = sizeof (bfd_chain_type); bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt); + if (!n) abort (); /* FIXME */ n->this = section->owner; n->next = (bfd_chain_type *) NULL; if (output_ieee->chain_head) - { - output_ieee->chain_head->next = n; - } + output_ieee->chain_head->next = n; else - { - output_ieee->chain_root = n; + output_ieee->chain_root = n; - } output_ieee->chain_head = n; } } @@ -4075,7 +4044,6 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_final_link _bfd_generic_final_link #define ieee_bfd_link_split_section _bfd_generic_link_split_section -/*SUPPRESS 460 */ const bfd_target ieee_vec = { "ieee", /* name */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 14978ba..9bbdebd 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -850,7 +850,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_LO16", "BFD_RELOC_PCREL_HI16_S", "BFD_RELOC_PCREL_LO16", - "BFD_RELOC_MIPSEMB_16_PCREL_S2", "BFD_RELOC_MIPS_LITERAL", "BFD_RELOC_MIPS_GOT16", "BFD_RELOC_MIPS_CALL16", @@ -1044,6 +1043,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_SWI", "BFD_RELOC_ARM_MULTI", "BFD_RELOC_ARM_CP_OFF_IMM", + "BFD_RELOC_ARM_CP_OFF_IMM_S2", "BFD_RELOC_ARM_ADR_IMM", "BFD_RELOC_ARM_LDR_IMM", "BFD_RELOC_ARM_LITERAL", @@ -1475,6 +1475,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_IQ2000_OFFSET_16", "BFD_RELOC_IQ2000_OFFSET_21", "BFD_RELOC_IQ2000_UHI16", + "BFD_RELOC_XTENSA_RTLD", + "BFD_RELOC_XTENSA_GLOB_DAT", + "BFD_RELOC_XTENSA_JMP_SLOT", + "BFD_RELOC_XTENSA_RELATIVE", + "BFD_RELOC_XTENSA_PLT", + "BFD_RELOC_XTENSA_OP0", + "BFD_RELOC_XTENSA_OP1", + "BFD_RELOC_XTENSA_OP2", + "BFD_RELOC_XTENSA_ASM_EXPAND", + "BFD_RELOC_XTENSA_ASM_SIMPLIFY", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif diff --git a/bfd/libpei.h b/bfd/libpei.h index 7a5f9fe..72fa7b5 100644 --- a/bfd/libpei.h +++ b/bfd/libpei.h @@ -1,31 +1,29 @@ /* Support for the generic parts of PE/PEI; common header information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* -Most of this hacked by Steve Chamberlain, +/* Most of this hacked by Steve Chamberlain, sac@cygnus.com -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ + PE/PEI rearrangement (and code added): Donn Terry + Softway Systems, Inc. */ /* Hey look, some documentation [and in a place you expect to find it]! @@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry FIXME: Please add more docs here so the next poor fool that has to hack on this code has a chance of getting something accomplished without - wasting too much time. -*/ + wasting too much time. */ #ifndef GET_FCN_LNNOPTR #define GET_FCN_LNNOPTR(abfd, ext) \ @@ -333,3 +330,6 @@ unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); bfd_boolean _bfd_XX_bfd_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); + +/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */ +#define bfd_pe_executable_p(abfd) (strncmp ((abfd)->xvec->name, "pei-", 4) == 0) diff --git a/bfd/linker.c b/bfd/linker.c index 918f4f8..c0e3236 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1,23 +1,23 @@ /* linker.c -- BFD linker routines - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -2081,12 +2081,12 @@ _bfd_generic_final_link (abfd, info) input_section, relocs, symbols); + free (relocs); if (reloc_count < 0) return FALSE; BFD_ASSERT ((unsigned long) reloc_count == input_section->reloc_count); o->reloc_count += reloc_count; - free (relocs); } } if (o->reloc_count > 0) diff --git a/bfd/m68k4knetbsd.c b/bfd/m68k4knetbsd.c index 13e0a6d..1ca4a62 100644 --- a/bfd/m68k4knetbsd.c +++ b/bfd/m68k4knetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1995, 1998, 2001 + Copyright 1990, 1991, 1992, 1995, 1998, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P #define TARGET_PAGE_SIZE 0x1000 diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index a526998..1a82980 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored m68k a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN) diff --git a/bfd/m68klynx.c b/bfd/m68klynx.c index 00571ca..46fa076 100644 --- a/bfd/m68klynx.c +++ b/bfd/m68klynx.c @@ -1,5 +1,5 @@ /* BFD back-end for m68k binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/m68knetbsd.c b/bfd/m68knetbsd.c index 521d646..2a74889 100644 --- a/bfd/m68knetbsd.c +++ b/bfd/m68knetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/m68k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P /* Our m68k ports use either 4K or 8K pages, but object files always diff --git a/bfd/m88kmach3.c b/bfd/m88kmach3.c index 8305401..79e3bb8 100644 --- a/bfd/m88kmach3.c +++ b/bfd/m88kmach3.c @@ -1,5 +1,5 @@ /* BFD back-end for Motorola m88k a.out (Mach 3) binaries. - Copyright 1990, 1991, 1993, 1994, 1995, 2001 + Copyright 1990, 1991, 1993, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE (4096*2) #define SEGMENT_SIZE 0x20000 #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 #define N_HEADER_IN_TEXT(x) 1 /* (N_MAGIG(x) == ZMAGIC) */ #define N_SHARED_LIB(x) 0 diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c index 581ace2..af1ba55 100644 --- a/bfd/mipsbsd.c +++ b/bfd/mipsbsd.c @@ -1,5 +1,5 @@ /* BFD backend for MIPS BSD (a.out) binaries. - Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ralph Campbell. @@ -19,7 +19,6 @@ 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. */ -#define BYTES_IN_WORD 4 /* #define ENTRY_CAN_BE_ZERO */ #define N_HEADER_IN_TEXT(x) 1 #define N_SHARED_LIB(x) 0 diff --git a/bfd/newsos3.c b/bfd/newsos3.c index 34c4216..d0a5c54 100644 --- a/bfd/newsos3.c +++ b/bfd/newsos3.c @@ -1,5 +1,5 @@ /* BFD back-end for NewsOS3 (Sony, 68k) binaries. - Copyright 1990, 1991, 1994, 1995, 2000, 2001 + Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_PAGE_SIZE 4096 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0 -#define BYTES_IN_WORD 4 /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate diff --git a/bfd/opncls.c b/bfd/opncls.c index 81bd2c8..4771979 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -931,8 +931,13 @@ find_separate_debug_file (abfd, debug_file_directory) basename = get_debug_link_info (abfd, & crc32); - if (basename == NULL || strlen (basename) < 1) + if (basename == NULL) return NULL; + if (strlen (basename) < 1) + { + free (basename); + return NULL; + } dir = xstrdup (abfd->filename); BFD_ASSERT (strlen (dir) != 0); diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 7023678..ba1c219 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -1,5 +1,5 @@ /* Support for the generic parts of PE/PEI; the common executable parts. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. @@ -570,7 +570,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out; bfd_vma sa, fa, ib; + IMAGE_DATA_DIRECTORY idata2, idata5; + if (pe->force_minimum_alignment) { if (!extra->FileAlignment) @@ -586,6 +588,9 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) fa = extra->FileAlignment; ib = extra->ImageBase; + idata2 = pe->pe_opthdr.DataDirectory[1]; + idata5 = pe->pe_opthdr.DataDirectory[12]; + if (aouthdr_in->tsize) { aouthdr_in->text_start -= ib; @@ -614,28 +619,34 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) #define SA(x) (((x) + sa -1 ) & (- sa)) /* We like to have the sizes aligned. */ - aouthdr_in->bsize = FA (aouthdr_in->bsize); extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES; - /* first null out all data directory entries .. */ + /* First null out all data directory entries. */ memset (extra->DataDirectory, 0, sizeof (extra->DataDirectory)); add_data_entry (abfd, extra, 0, ".edata", ib); - - /* Don't call add_data_entry for .idata$2 or .idata$5. It's done in - bfd_coff_final_link where all the required information is - available. */ - - /* However, until other .idata fixes are made (pending patch), the - entry for .idata is needed for backwards compatability. FIXME. */ - add_data_entry (abfd, extra, 1, ".idata", ib); - add_data_entry (abfd, extra, 2, ".rsrc", ib); - add_data_entry (abfd, extra, 3, ".pdata", ib); + /* In theory we do not need to call add_data_entry for .idata$2 or + .idata$5. It will be done in bfd_coff_final_link where all the + required information is available. If however, we are not going + to perform a final link, eg because we have been invoked by objcopy + or strip, then we need to make sure that these Data Directory + entries are initialised properly. + + So - we copy the input values into the output values, and then, if + a final link is going to be performed, it can overwrite them. */ + extra->DataDirectory[1] = idata2; + extra->DataDirectory[12] = idata5; + + if (extra->DataDirectory[1].VirtualAddress == 0) + /* Until other .idata fixes are made (pending patch), the entry for + .idata is needed for backwards compatability. FIXME. */ + add_data_entry (abfd, extra, 1, ".idata", ib); + /* For some reason, the virtual size (which is what's set by add_data_entry) for .reloc is not the same as the size recorded in this slot by MSVC; it doesn't seem to cause problems (so far), @@ -689,7 +700,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) aouthdr_out->standard.text_start); #ifndef COFF_WITH_pep - /* PE32+ does not have data_start member! */ + /* PE32+ does not have data_start member! */ PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, aouthdr_out->standard.data_start); #endif @@ -895,12 +906,24 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) sometimes). */ if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0) { - ps = scnhdr_int->s_size; - ss = 0; + if (bfd_pe_executable_p (abfd)) + { + ps = scnhdr_int->s_size; + ss = 0; + } + else + { + ps = 0; + ss = scnhdr_int->s_size; + } } else { - ps = scnhdr_int->s_paddr; + if (bfd_pe_executable_p (abfd)) + ps = scnhdr_int->s_paddr; + else + ps = 0; + ss = scnhdr_int->s_size; } @@ -1994,9 +2017,9 @@ _bfd_XXi_final_link_postscript (abfd, pfinfo) ((h1->root.u.def.value + h1->root.u.def.section->output_section->vma + h1->root.u.def.section->output_offset) - - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); + - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress); } - + /* If we couldn't find idata$2, we either have an excessively trivial program or are in DEEP trouble; we have to assume trivial program.... */ diff --git a/bfd/peicode.h b/bfd/peicode.h index 2dff0ac..b3c1f29 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1,31 +1,29 @@ /* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Solutions. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* -Most of this hacked by Steve Chamberlain, +/* Most of this hacked by Steve Chamberlain, sac@cygnus.com -PE/PEI rearrangement (and code added): Donn Terry - Softway Systems, Inc. -*/ + PE/PEI rearrangement (and code added): Donn Terry + Softway Systems, Inc. */ /* Hey look, some documentation [and in a place you expect to find it]! @@ -53,8 +51,7 @@ PE/PEI rearrangement (and code added): Donn Terry FIXME: Please add more docs here so the next poor fool that has to hack on this code has a chance of getting something accomplished without - wasting too much time. -*/ + wasting too much time. */ #include "libpei.h" @@ -259,12 +256,17 @@ coff_swap_scnhdr_in (abfd, ext, in) } #ifndef COFF_NO_HACK_SCNHDR_SIZE - /* If this section holds uninitialized data, use the virtual size - (stored in s_paddr) instead of the physical size. */ - if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 - && (scnhdr_int->s_paddr > 0)) + /* If this section holds uninitialized data and is from an object file + or from an executable image that has not initialized the field, + or if the physical size is padded, use the virtual size (stored in + s_paddr) instead. */ + if (scnhdr_int->s_paddr > 0 + && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 + && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0)) + || scnhdr_int->s_size > scnhdr_int->s_paddr)) { scnhdr_int->s_size = scnhdr_int->s_paddr; + /* This code used to set scnhdr_int->s_paddr to 0. However, coff_set_alignment_hook stores s_paddr in virt_size, which only works if it correctly holds the virtual size of the diff --git a/bfd/reloc.c b/bfd/reloc.c index 45660c8..f3f6428 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2080,10 +2080,7 @@ ENUM BFD_RELOC_PCREL_LO16 ENUMDOC Like BFD_RELOC_LO16, but PC relative. -ENUM - BFD_RELOC_MIPSEMB_16_PCREL_S2 -ENUMDOC - Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC. + ENUM BFD_RELOC_MIPS_LITERAL ENUMDOC @@ -2153,6 +2150,7 @@ ENUMX ENUMDOC Fujitsu Frv Relocations. COMMENT +COMMENT ENUMDOC MIPS ELF relocations. @@ -2521,6 +2519,8 @@ ENUMX ENUMX BFD_RELOC_ARM_CP_OFF_IMM ENUMX + BFD_RELOC_ARM_CP_OFF_IMM_S2 +ENUMX BFD_RELOC_ARM_ADR_IMM ENUMX BFD_RELOC_ARM_LDR_IMM @@ -2727,7 +2727,7 @@ ENUMX ENUMX BFD_RELOC_SH_TLS_TPOFF32 ENUMDOC - Hitachi SH relocs. Not all of these appear in object files. + Renesas SH relocs. Not all of these appear in object files. ENUM BFD_RELOC_THUMB_PCREL_BRANCH9 @@ -3850,6 +3850,49 @@ ENUMX ENUMDOC IQ2000 Relocations. +ENUM + BFD_RELOC_XTENSA_RTLD +ENUMDOC + Special Xtensa relocation used only by PLT entries in ELF shared + objects to indicate that the runtime linker should set the value + to one of its own internal functions or data structures. +ENUM + BFD_RELOC_XTENSA_GLOB_DAT +ENUMX + BFD_RELOC_XTENSA_JMP_SLOT +ENUMX + BFD_RELOC_XTENSA_RELATIVE +ENUMDOC + Xtensa relocations for ELF shared objects. +ENUM + BFD_RELOC_XTENSA_PLT +ENUMDOC + Xtensa relocation used in ELF object files for symbols that may require + PLT entries. Otherwise, this is just a generic 32-bit relocation. +ENUM + BFD_RELOC_XTENSA_OP0 +ENUMX + BFD_RELOC_XTENSA_OP1 +ENUMX + BFD_RELOC_XTENSA_OP2 +ENUMDOC + Generic Xtensa relocations. Only the operand number is encoded + in the relocation. The details are determined by extracting the + instruction opcode. +ENUM + BFD_RELOC_XTENSA_ASM_EXPAND +ENUMDOC + Xtensa relocation to mark that the assembler expanded the + instructions from an original target. The expansion size is + encoded in the reloc size. +ENUM + BFD_RELOC_XTENSA_ASM_SIMPLIFY +ENUMDOC + Xtensa relocation to mark that the linker should simplify + assembler-expanded instructions. This is commonly used + internally by the linker after analysis of a + BFD_RELOC_XTENSA_ASM_EXPAND. + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT diff --git a/bfd/simple.c b/bfd/simple.c index 88f1337..a247f11 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -1,5 +1,5 @@ /* simple.c -- BFD simple client routines - Copyright 2002 + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by MontaVista Software, Inc. @@ -42,8 +42,14 @@ static bfd_boolean simple_dummy_reloc_dangerous static bfd_boolean simple_dummy_unattached_reloc PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); +static void simple_save_output_info + PARAMS ((bfd *, asection *, PTR)); + +static void simple_restore_output_info + PARAMS ((bfd *, asection *, PTR)); + bfd_byte * bfd_simple_get_relocated_section_contents - PARAMS ((bfd *, asection *, bfd_byte *)); + PARAMS ((bfd *, asection *, bfd_byte *, asymbol **)); static bfd_boolean simple_dummy_warning (link_info, warning, symbol, abfd, section, address) @@ -105,17 +111,48 @@ simple_dummy_unattached_reloc (link_info, name, abfd, section, address) return TRUE; } +struct saved_output_info +{ + bfd_vma offset; + asection *section; +}; + +static void +simple_save_output_info (abfd, section, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section; + PTR ptr; +{ + struct saved_output_info *output_info = (struct saved_output_info *) ptr; + output_info[section->index].offset = section->output_offset; + output_info[section->index].section = section->output_section; + section->output_offset = 0; + section->output_section = section; +} + +static void +simple_restore_output_info (abfd, section, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section; + PTR ptr; +{ + struct saved_output_info *output_info = (struct saved_output_info *) ptr; + section->output_offset = output_info[section->index].offset; + section->output_section = output_info[section->index].section; +} + /* FUNCTION bfd_simple_relocate_secton SYNOPSIS - bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf); + bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); DESCRIPTION - Returns the relocated contents of section @var{sec}. Only symbols - from @var{abfd} and the output offsets assigned to sections in - @var{abfd} are used. The result will be stored at @var{outbuf} + Returns the relocated contents of section @var{sec}. The symbols in + @var{symbol_table} will be used, or the symbols from @var{abfd} if + @var{symbol_table} is NULL. The output offsets for all sections will + be temporarily reset to 0. The result will be stored at @var{outbuf} or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}. Generally all sections in @var{abfd} should have their @@ -126,17 +163,18 @@ DESCRIPTION */ bfd_byte * -bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) +bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table) bfd *abfd; asection *sec; bfd_byte *outbuf; + asymbol **symbol_table; { struct bfd_link_info link_info; struct bfd_link_order link_order; struct bfd_link_callbacks callbacks; bfd_byte *contents, *data; - int storage_needed, number_of_symbols; - asymbol **symbol_table; + int storage_needed; + PTR saved_offsets; if (! (sec->flags & SEC_RELOC)) { @@ -183,11 +221,36 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) return NULL; outbuf = data; } - bfd_link_add_symbols (abfd, &link_info); - storage_needed = bfd_get_symtab_upper_bound (abfd); - symbol_table = (asymbol **) bfd_malloc (storage_needed); - number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); + /* The sections in ABFD may already have output sections and offsets set. + Because this function is primarily for debug sections, and GCC uses the + knowledge that debug sections will generally have VMA 0 when emiting + relocations between DWARF-2 sections (which are supposed to be + section-relative offsets anyway), we need to reset the output offsets + to zero. We also need to arrange for section->output_section->vma plus + section->output_offset to equal section->vma, which we do by setting + section->output_section to point back to section. Save the original + output offset and output section to restore later. */ + saved_offsets = malloc (sizeof (struct saved_output_info) + * abfd->section_count); + if (saved_offsets == NULL) + { + if (data) + free (data); + return NULL; + } + bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets); + + if (symbol_table == NULL) + { + bfd_link_add_symbols (abfd, &link_info); + + storage_needed = bfd_get_symtab_upper_bound (abfd); + symbol_table = (asymbol **) bfd_malloc (storage_needed); + bfd_canonicalize_symtab (abfd, symbol_table); + } + else + storage_needed = 0; contents = bfd_get_relocated_section_contents (abfd, &link_info, @@ -198,6 +261,23 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf) if (contents == NULL && data != NULL) free (data); +#if 0 + /* NOTE: cagney/2003-04-05: This free, which was introduced on + 2003-03-31 to stop a memory leak, caused a memory corruption + between GDB and BFD. The problem, which is stabs specific, can + be identified by a bunch of failures in relocate.exp vis: + + gdb.base/relocate.exp: get address of static_bar + + Details of the problem can be found on the binutils@ mailing + list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */ + if (storage_needed != 0) + free (symbol_table); +#endif + + bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); + free (saved_offsets); + /* Foul hack to prevent bfd_section_size aborts. This flag only controls that macro (and the related size macros), selecting between _raw_size and _cooked_size. Debug sections won't change size while we're only @@ -1,6 +1,6 @@ /* bfd back-end for HP PA-RISC SOM objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by the Center for Software Science at the @@ -38,7 +38,7 @@ #include <machine/reg.h> #include <sys/file.h> -/* Magic not defined in standard HP-UX header files until 8.0 */ +/* Magic not defined in standard HP-UX header files until 8.0. */ #ifndef CPU_PA_RISC1_0 #define CPU_PA_RISC1_0 0x20B @@ -148,7 +148,7 @@ struct som_misc_symbol_info { unsigned int secondary_def; }; -/* Forward declarations */ +/* Forward declarations. */ static bfd_boolean som_mkobject PARAMS ((bfd *)); @@ -220,7 +220,6 @@ static int som_reloc_queue_find PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); static unsigned char * try_prev_fixup PARAMS ((bfd *, int *, unsigned char *, unsigned int, struct reloc_queue *)); - static unsigned char * som_reloc_skip PARAMS ((bfd *, unsigned int, unsigned char *, unsigned int *, struct reloc_queue *)); @@ -267,9 +266,8 @@ static int som_decode_symclass PARAMS ((asymbol *)); static bfd_boolean som_bfd_count_ar_symbols PARAMS ((bfd *, struct lst_header *, symindex *)); - static bfd_boolean som_bfd_fill_in_ar_symbols - PARAMS ((bfd *, struct lst_header *, carsym **syms)); + PARAMS ((bfd *, struct lst_header *, carsym **)); static bfd_boolean som_slurp_armap PARAMS ((bfd *)); static bfd_boolean som_write_armap @@ -659,7 +657,7 @@ static const struct fixup_format som_fixup_formats[256] = { /* R_TRANSLATED */ { 0, "" }, /* 0xce */ /* R_AUX_UNWIND */ - { 0,"Sd=Vf=Ef=" }, /* 0xcf */ + { 0,"Sd=Ve=Ee=" }, /* 0xcf */ /* R_COMP1 */ { 0, "Ob=" }, /* 0xd0 */ /* R_COMP2 */ @@ -684,7 +682,7 @@ static const struct fixup_format som_fixup_formats[256] = { /* R_LTP_OVERRIDE */ { 0, "" }, /* 0xdc */ /* R_COMMENT */ - { 0, "Ob=Ve=" }, /* 0xdd */ + { 0, "Ob=Vf=" }, /* 0xdd */ /* R_RESERVED */ { 0, "" }, /* 0xde */ { 0, "" }, /* 0xdf */ @@ -2328,7 +2326,6 @@ som_prep_headers (abfd) if (abfd->flags & (EXEC_P | DYNAMIC)) { - /* Make and attach an exec header to the BFD. */ amt = sizeof (struct som_exec_auxhdr); obj_som_exec_hdr (abfd) = @@ -5353,7 +5350,7 @@ som_get_section_contents (abfd, section, location, offset, count) if ((bfd_size_type) (offset+count) > section->_raw_size || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 || bfd_bread (location, count, abfd) != count) - return FALSE; /* on error */ + return FALSE; /* On error. */ return TRUE; } @@ -6369,7 +6366,7 @@ const bfd_target som_vec = { | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ /* leading_symbol_char: is the first char of a user symbol - predictable, and if so what is it */ + predictable, and if so what is it. */ 0, '/', /* ar_pad_char */ 14, /* ar_max_namelen */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 4352727..40e49c8 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -1,5 +1,5 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -24,7 +24,6 @@ USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define TEXT_START_ADDR 0x0 #define N_SHARED_LIB(x) 0 -#define BYTES_IN_WORD 4 #define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_UNKNOWN) diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c index 84d9d4a..6be9a44 100644 --- a/bfd/sparclynx.c +++ b/bfd/sparclynx.c @@ -1,6 +1,6 @@ /* BFD support for Sparc binaries under LynxOS. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if 0 -#define BYTES_IN_WORD 4 #define N_SHARED_LIB(x) 0 #define TEXT_START_ADDR 0 diff --git a/bfd/sparcnetbsd.c b/bfd/sparcnetbsd.c index 64d0eb1..be8e536 100644 --- a/bfd/sparcnetbsd.c +++ b/bfd/sparcnetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/sparc a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ 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. */ -#define BYTES_IN_WORD 4 #define TARGET_IS_BIG_ENDIAN_P /* SPARC chips use either 4K or 8K pages, but object files always diff --git a/bfd/targets.c b/bfd/targets.c index 2211e12..5ccae2a 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -579,6 +579,8 @@ extern const bfd_target bfd_elf32_us_cris_vec; extern const bfd_target bfd_elf32_v850_vec; extern const bfd_target bfd_elf32_vax_vec; extern const bfd_target bfd_elf32_xstormy16_vec; +extern const bfd_target bfd_elf32_xtensa_be_vec; +extern const bfd_target bfd_elf32_xtensa_le_vec; extern const bfd_target bfd_elf64_alpha_freebsd_vec; extern const bfd_target bfd_elf64_alpha_vec; extern const bfd_target bfd_elf64_big_generic_vec; @@ -871,6 +873,8 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_v850_vec, &bfd_elf32_vax_vec, &bfd_elf32_xstormy16_vec, + &bfd_elf32_xtensa_be_vec, + &bfd_elf32_xtensa_le_vec, #ifdef BFD64 &bfd_elf64_alpha_freebsd_vec, &bfd_elf64_alpha_vec, diff --git a/bfd/vaxbsd.c b/bfd/vaxbsd.c index 5faedbe..a97408f 100644 --- a/bfd/vaxbsd.c +++ b/bfd/vaxbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for BSD and Ultrix/VAX (1K page size) a.out-ish binaries. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define N_HEADER_IN_TEXT(x) 0 -#define BYTES_IN_WORD 4 #define ENTRY_CAN_BE_ZERO #define N_SHARED_LIB(x) 0 /* Avoids warning */ #define TEXT_START_ADDR 0 @@ -26,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_vax -/* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate the tokens. */ +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate the + tokens. */ #define MY(OP) CONCAT2 (vaxbsd_,OP) #define TARGETNAME "a.out-vax-bsd" diff --git a/bfd/version.h b/bfd/version.h index d251770..4c25ee8 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030305 +#define BFD_VERSION_DATE 20030416 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002 + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1131,7 +1131,7 @@ bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) BFD_ASSERT (bfd_sym_valid (abfd)); sdata = abfd->tdata.sym_data; - if (index == 0) + if (offset == 0) return -1; if (bfd_seek (abfd, offset, SEEK_SET) < 0) @@ -2201,12 +2201,6 @@ EOF esac fi -# record if we want runtime library stuff installed in libsubdir. -# Blank means no. -if test -z "${enable_version_specific_runtime_libs}"; then - enable_version_specific_runtime_libs=no -fi - # Make sure that the compiler is able to generate an executable. If it # can't, we are probably in trouble. We don't care whether we can run the # executable--we might be using a cross compiler--we only care whether it @@ -2477,30 +2471,19 @@ target_configargs="--cache-file=../config.cache --host=${target_alias} --build=$ # Note, if you change the default, make sure to fix both here and in # the gcc and libstdc++-v3 subdirectories. # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -gxx_include_dir= -if test -n "${with_gxx_include_dir}"; then - case "${with_gxx_include_dir}" in - yes ) - echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2 - exit 1 - ;; - no ) - ;; - * ) - gxx_include_dir=${with_gxx_include_dir} - ;; - esac -fi -if test x${gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gxx_include_dir='${libsubdir}/include/c++' - else - . ${srcdir}/config.if - gxx_include_dir='${prefix}/include/${libstdcxx_incdir}' - fi -else - gxx_include_dir=${gxx_include_dir} -fi +case "${with_gxx_include_dir}" in + yes) + { echo "configure: error: --with-gxx-include-dir=[dir] requires a directory" 1>&2; exit 1; } + ;; + no | "") + case "${enable_version_specific_runtime_libs}" in + yes) gxx_include_dir='${libsubdir}/include/c++' ;; + *) + . ${srcdir}/config.if + gxx_include_dir='${prefix}/include/'${libstdcxx_incdir} ;; + esac ;; + *) gxx_include_dir=${with_gxx_include_dir} ;; +esac FLAGS_FOR_TARGET= case " $target_configdirs " in @@ -2658,7 +2641,6 @@ ospace_frag=${srcdir}/${ospace_frag} - # Build module lists & subconfigure args. @@ -2701,7 +2683,7 @@ test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2705: checking for $ac_word" >&5 +echo "configure:2687: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2734,7 +2716,7 @@ if test -z "$ac_cv_prog_AR" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2738: checking for $ac_word" >&5 +echo "configure:2720: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2773,7 +2755,7 @@ fi # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2777: checking for $ac_word" >&5 +echo "configure:2759: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2806,7 +2788,7 @@ if test -z "$ac_cv_prog_AS" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2810: checking for $ac_word" >&5 +echo "configure:2792: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2845,7 +2827,7 @@ fi # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2849: checking for $ac_word" >&5 +echo "configure:2831: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2878,7 +2860,7 @@ if test -z "$ac_cv_prog_DLLTOOL" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2882: checking for $ac_word" >&5 +echo "configure:2864: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2917,7 +2899,7 @@ fi # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2921: checking for $ac_word" >&5 +echo "configure:2903: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2950,7 +2932,7 @@ if test -z "$ac_cv_prog_LD" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2954: checking for $ac_word" >&5 +echo "configure:2936: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2989,7 +2971,7 @@ fi # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2993: checking for $ac_word" >&5 +echo "configure:2975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3022,7 +3004,7 @@ if test -z "$ac_cv_prog_NM" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3026: checking for $ac_word" >&5 +echo "configure:3008: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3061,7 +3043,7 @@ fi # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3065: checking for $ac_word" >&5 +echo "configure:3047: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3094,7 +3076,7 @@ if test -z "$ac_cv_prog_RANLIB" ; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3098: checking for $ac_word" >&5 +echo "configure:3080: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3133,7 +3115,7 @@ fi # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3137: checking for $ac_word" >&5 +echo "configure:3119: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3166,7 +3148,7 @@ if test -z "$ac_cv_prog_WINDRES" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3170: checking for $ac_word" >&5 +echo "configure:3152: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3205,7 +3187,7 @@ fi # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ncn_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3209: checking for $ac_word" >&5 +echo "configure:3191: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3238,7 +3220,7 @@ if test -z "$ac_cv_prog_OBJCOPY" ; then # Extract the first word of "objcopy", so it can be a program name with args. set dummy objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3242: checking for $ac_word" >&5 +echo "configure:3224: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3277,7 +3259,7 @@ fi # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args. set dummy ${ncn_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3281: checking for $ac_word" >&5 +echo "configure:3263: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3310,7 +3292,7 @@ if test -z "$ac_cv_prog_OBJDUMP" ; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3314: checking for $ac_word" >&5 +echo "configure:3296: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3358,7 +3340,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3362: checking for $ac_word" >&5 +echo "configure:3344: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3391,7 +3373,7 @@ if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3395: checking for $ac_word" >&5 +echo "configure:3377: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3430,7 +3412,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3434: checking for $ac_word" >&5 +echo "configure:3416: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3463,7 +3445,7 @@ if test -z "$ac_cv_prog_AS_FOR_TARGET" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3467: checking for $ac_word" >&5 +echo "configure:3449: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3502,7 +3484,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3506: checking for $ac_word" >&5 +echo "configure:3488: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3535,7 +3517,7 @@ if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3539: checking for $ac_word" >&5 +echo "configure:3521: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3574,7 +3556,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3578: checking for $ac_word" >&5 +echo "configure:3560: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3607,7 +3589,7 @@ if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3611: checking for $ac_word" >&5 +echo "configure:3593: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3646,7 +3628,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3650: checking for $ac_word" >&5 +echo "configure:3632: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3679,7 +3661,7 @@ if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3683: checking for $ac_word" >&5 +echo "configure:3665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3718,7 +3700,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3722: checking for $ac_word" >&5 +echo "configure:3704: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3751,7 +3733,7 @@ if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3755: checking for $ac_word" >&5 +echo "configure:3737: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3790,7 +3772,7 @@ fi # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3794: checking for $ac_word" >&5 +echo "configure:3776: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3823,7 +3805,7 @@ if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3827: checking for $ac_word" >&5 +echo "configure:3809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3890,7 +3872,7 @@ RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target} NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target} echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:3894: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:3876: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -4088,7 +4070,6 @@ s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g s%@BUILD_PREFIX@%$BUILD_PREFIX%g s%@BUILD_PREFIX_1@%$BUILD_PREFIX_1%g s%@configlinks@%$configlinks%g -s%@enable_version_specific_runtime_libs@%$enable_version_specific_runtime_libs%g s%@gcc_version_trigger@%$gcc_version_trigger%g s%@gcc_version@%$gcc_version%g s%@tooldir@%$tooldir%g diff --git a/configure.in b/configure.in index eb473b8..45239e2 100644 --- a/configure.in +++ b/configure.in @@ -1541,12 +1541,6 @@ EOF esac fi -# record if we want runtime library stuff installed in libsubdir. -# Blank means no. -if test -z "${enable_version_specific_runtime_libs}"; then - enable_version_specific_runtime_libs=no -fi - # Make sure that the compiler is able to generate an executable. If it # can't, we are probably in trouble. We don't care whether we can run the # executable--we might be using a cross compiler--we only care whether it @@ -1816,30 +1810,19 @@ target_configargs="--cache-file=../config.cache --host=${target_alias} --build=$ # Note, if you change the default, make sure to fix both here and in # the gcc and libstdc++-v3 subdirectories. # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -gxx_include_dir= -if test -n "${with_gxx_include_dir}"; then - case "${with_gxx_include_dir}" in - yes ) - echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2 - exit 1 - ;; - no ) - ;; - * ) - gxx_include_dir=${with_gxx_include_dir} - ;; - esac -fi -if test x${gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gxx_include_dir='${libsubdir}/include/c++' - else - . ${srcdir}/config.if - gxx_include_dir='${prefix}/include/${libstdcxx_incdir}' - fi -else - gxx_include_dir=${gxx_include_dir} -fi +case "${with_gxx_include_dir}" in + yes) + AC_MSG_ERROR([--with-gxx-include-dir=[[dir]] requires a directory]) + ;; + no | "") + case "${enable_version_specific_runtime_libs}" in + yes) gxx_include_dir='${libsubdir}/include/c++' ;; + *) + . ${srcdir}/config.if + gxx_include_dir='${prefix}/include/'${libstdcxx_incdir} ;; + esac ;; + *) gxx_include_dir=${with_gxx_include_dir} ;; +esac FLAGS_FOR_TARGET= case " $target_configdirs " in @@ -1989,7 +1972,6 @@ AC_SUBST(RPATH_ENVVAR) AC_SUBST(BUILD_PREFIX) AC_SUBST(BUILD_PREFIX_1) AC_SUBST(configlinks) -AC_SUBST(enable_version_specific_runtime_libs) AC_SUBST(gcc_version_trigger) AC_SUBST(gcc_version) AC_SUBST(tooldir) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 605f7be..b9aeef5e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,2123 @@ +2003-04-16 David Carlton <carlton@bactrian.org> + + * Merge with mainline; tag is carlton_dictionary-20030416-merge. + +2003-04-16 Mark Kettenis <kettenis@gnu.org> + + * i386-linux-nat.c: Add some whitespace to make things more + readable. + (fetch_register, store_register, fetch_inferior_registers, + store_inferior_registers): Get rid of assignment in if-statement. + (store_register): Fix typo in error message. + +2003-04-16 Andrew Cagney <cagney@redhat.com> + + * utils.c (xmmalloc): Always allocate something, matches + libiberty/xmalloc's semantics. + (xmrealloc, xmcalloc): Ditto. + +2003-04-16 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Do not initialize "unwind" or "type", + update comments. + (get_frame_type): Initialize unwind and type when needed. + (get_frame_id, frame_register_unwind): Ditto. + +2003-04-16 Andrew Cagney <cagney@redhat.com> + + * NEWS: Mention that sparclet-*-* and sparclite-*-* have been made + obsolete. + * sparc-tdep.c: Obsolete SPARCLET and SPARCLITE code. + * sparcl-stub.c: Obsolete file. + * config/sparc/tm-sparclet.h: Obsolete file. + * sparclet-stub.c: Obsolete file. + * sparclet-rom.c: Obsolete file. + * sparcl-tdep.c: Obsolete file. + * config/sparc/tm-sparclite.h: Obsolete file. + * config/sparc/sparclite.mt: Obsolete file. + * config/sparc/sparclet.mt: Obsolete file. + * configure.tgt: Make sparclet-*-*, sparclite-*-*, and + sparc86x-*-* obsolete. + +2003-04-15 David Carlton <carlton@math.stanford.edu> + + * Makefile.in (SFILES): Add cp-namespace.c. + (COMMON_OBS): Add cp-namespace.o. + (block.o): Depend on gdb_obstack_h and cp_support_h. + (buildsym.o): Depend on cp_support_h. + (cp-namespace.o): New. + (cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h, + gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h. + (dwarf2read.o): Depend on cp_support_h. + * jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE. + * dwarf2read.c (process_die): Set processing_has_namespace_info, + processing_current_namespace. + (read_namespace): Update processing_current_namespace; check for + anonymous namespaces. + (dwarf2_name): New function. + (dwarf2_extension): Ditto. + * cp-support.h: Update copyright, contributors. + Add inclusion guards. + Add opaque declaration for structs obstack, block, symbol. + (struct using_direct): New struct. + Add declarations for cp_find_first_component, + cp_entire_prefix_len, processing_has_namespace_info, + processing_current_namespace, cp_is_anonymous, + cp_add_using_directive, cp_initialize_namespace, + cp_finalize_namespace, cp_set_block_scope, + cp_scan_for_anonymous_namespaces. + * cp-namespace.c: New file. + * cp-support.c: Update copyright. + Include ctype.h, gdb_assert.h, gdbcmd.h. + New variable maint_cplus_cmd_list. + (cp_find_first_component): New function. + (cp_entire_prefix_len, maint_cplus_command) + (first_component_command, _initialize_cp_support): Ditto. + * buildsym.c: Include cp-support.h. + New variable using_list. + (add_symbol_to_list): Check for anonymous namespaces. + (finish_block): Set block's scope. + (start_symtab): Initialize C++ namespace support. + (end_symtab): Finalize C++ namespace support. + * block.h: Add opaque declarations for structs + block_namespace_info, using_direct, and obstack. + Add declarations for block_set_scope and block_set_using. + (struct block): Add 'language_specific' member. + (BLOCK_NAMESPACE): New macro. + * block.c: Include gdb_obstack.h and cp-support.h. + (struct block_namespace_info): New struct. + (block_set_scope): New function. + (block_set_using, block_initialize_namespace): Ditto. + +2003-04-14 Kevin Buettner <kevinb@redhat.com> + + * solib-svr4.c (svr4_have_link_map_offsets): New function. + (locate_base): Return early if there aren't any link map offsets. + (svr4_solib_create_inferior_hook): Warn if shared library support + is unavailable. + +2003-04-14 David Carlton <carlton@math.stanford.edu> + + * symtab.c (symbol_set_names): Add prefix when storing Java names + in hash table. Fix for PR java/1039. + +2003-04-14 David Carlton <carlton@math.stanford.edu> + + * symtab.c (symbol_set_names): Rename 'name' arg to + 'linkage_name', and 'tmpname' variable to 'linkage_name_copy'. + * symtab.h: Change 'name' argument in declaration of + symbol_set_names to 'linkage_name'. + (SYMBOL_SET_NAMES): Change 'name' argument to 'linkage_name'. + +2003-04-14 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_read_sp): Do not apply ADDR_BITS_REMOVE, + return the fully sign-extended register value. + (get_frame_pointer): Ditto. + (mips_pop_frame): Initialize "proc_desc" after checking for a + dummy frame. + +2003-04-14 Andrew Cagney <cagney@redhat.com> + + * mips-tdep.c (mips_push_dummy_frame): Delete function. + (MASK, PUSH_FP_REGNUM, GEN_REG_SAVE_MASK): Delete macros. + (FLOAT_REG_SAVE_MASK, FLOAT_SINGLE_REG_SAVE_MASK): Delete macro. + (mips_push_register): Delete function. + (mips_dump_tdep): Delete references to GEN_REG_SAVE_MASK and + PUSH_FP_REGNUM. + +2003-04-14 Jim Blandy <jimb@redhat.com> + + * symmisc.c: #include "gdb_regex.h". + (maintenance_list_symtabs, maintenance_list_psymtabs): New + functions. + * maint.c (maintenance_list_command): New function. + (_initialize_maint_cmds): Register the above as commands. + * symtab.h (maintenance_list_symtabs, + maintenance_list_psymtabs): New declarations. + * cli/cli-cmds.c (maintenancelistlist): New variable. + (init_cmd_lists): Initialize it. + * cli/cli-cmds.h (maintenancelistlist): New declaration. + * gdbcmd.h (maintenancelistlist): New declaration. + * Makefile.in (symmisc.o): Update dependencies. + +2003-04-14 Elena Zannoni <ezannoni@redhat.com> + + * s390-nat.c: Include asm/types.h for addr_t. + +2003-04-14 Corinna Vinschen <vinschen@redhat.com> + + * cp-valprint.c (cp_print_class_method): Call unpack_pointer() with + actually incoming type. + +2003-04-13 Andrew Cagney <cagney@redhat.com> + + * ppc-linux-tdep.c: Use get_frame_base, get_frame_pc, + get_next_frame and get_frame_saved_regs. + +2003-04-13 Andrew Cagney <cagney@redhat.com> + + * reggroups.c (default_register_reggroup_p): Use NUM_REGS instead + of gdbarch_num_regs. + +2003-04-13 Andrew Cagney <cagney@redhat.com> + + * frame.h: Mention what replaced what in "struct frame_info". + * hppa-hpux-tdep.c: Use get_frame_base, get_frame_pc and + deprecated_update_frame_base_hack and + deprecated_update_frame_pc_hack. + * hppa-tdep.c: Ditto. + +2003-04-13 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2expr.h (struct dwarf_expr_context): Remove extra arguments + to read_reg and update its comment. Remove regnum member. + * dwarf2expr.c (execute_stack_op): Remove memaddr and expr_lval. + Don't call read_reg when setting in_reg. Call read_reg to get + the frame base if it's in a register. Return the register number + on the stack instead of in the context. Remove extra arguments + to read_reg. + * dwarf2loc.c (dwarf_expr_read_reg): Remove extra arguments. + (dwarf2_evaluate_loc_desc): Call value_from_register. Expect + the register number on the expression stack. + (needs_frame_read_reg): Remove extra arguments. + +2003-04-13 Daniel Jacobowitz <drow@mvista.com> + + * dwarf2expr.c (dwarf2_read_address): Renamed from read_address; + made non-static. + (execute_stack_op): All callers updated. + * dwarf2expr.h: Add prototype for dwarf2_read_address. + * dwarf2loc.c (find_location_expression): New function. + (dwarf_expr_frame_base): Call it. + (dwarf2_evaluate_loc_desc): Handle 0-length location expressions. + (dwarf2_tracepoint_var_ref): New function, broken out from + locexpr_tracepoint_var_ref. + (locexpr_tracepoint_var_ref): Call dwarf2_tracepoint_var_ref. + Make static. + (loclist_read_variable, loclist_read_needs_frame): New functions. + (loclist_describe_location, loclist_tracepoint_var_ref): New + functions. + (dwarf2_loclist_funcs): New struct location_funcs. + * dwarf2loc.h (struct dwarf2_loclist_baton): New type. + (struct dwarf2_locexpr_baton): Add comments. + (dwarf2_loclist_funcs): New extern. + * dwarf2read.c (struct comp_unit_head): Remove DIE member, add + base_address and base_known. + (dwarf_loc_buffer): New variable. + (struct dwarf2_pinfo): Add dwarf_loc_buffer and dwarf_loc_size. + (DWARF_LOC_BUFFER, DWARF_LOC_SIZE): New macros. + (dwarf2_has_info): Initialize dwarf_loc_offset. + (dwarf2_build_psymtabs): Read in .debug_loc. + (dwarf2_build_psymtabs_hard): Use DWARF_LOC_BUFFER and + DWARF_LOC_SIZE. + (psymtab_to_symtab_1): Likewise. Move base address calculation + here, from... + (dwarf2_get_pc_bounds): ... here. Use the base address from + cu_header. + (dwarf2_symbol_mark_computed): Handle location lists. + +2003-04-13 Daniel Jacobowitz <drow@mvista.com> + + * minsyms.c (install_minimal_symbols): Only switch to gnu-v3 mode + if the linkage name demangled successfully. + +2003-04-13 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c (att_flavour, intel_flavour, valid_flavours, + disassmbly_flavour): Removed. + + * x86-64-tdep.c (gdb_print_insn_x86_64): Removed. + +2003-04-13 Mark Kettenis <kettenis@gnu.org> + + * x86-64-tdep.c (x86_64_breakpoint_from_pc): Removed. + +2003-04-12 Andrew Cagney <cagney@redhat.com> + + * frame.h (struct frame_info): Move definition from here ... + * frame.c (struct frame_info): ... to here. + +2003-04-12 Andrew Cagney <cagney@redhat.com> + + * gdbthread.h (save_infrun_state): Delete parameter + "prev_func_start". + (struct thread_info): Delete field "prev_func_start". + (load_infrun_state): Ditto. + * thread.c (load_infrun_state, save_infrun_state): Update. + * infrun.c (prev_func_start): Delete variable. + (context_switch, init_wait_for_inferior): Update. + (stop_stepping, keep_going): Update. + +2003-04-12 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh: Add missing opaque declarations. + * gdbarch.h: Regnerate. + * symtab.h: Add missing opaque declarations. + * value.h, target.h, symfile.h, stabsread.h: Ditto. + * x86-64-tdep.h, xmodem.h, monitor.h, typeprint.h: Ditto. + * srec.h, solib-svr4.h, source.h, inferior.h: Ditto. + * ser-unix.h, serial.h, remote-utils.h, gdbcore.h: Ditto. + * ppc-tdep.h, ocd.h, mips-tdep.h, gdbtypes.h: Ditto. + * buildsym.h, builtin-regs.h, linespec.h, language.h: Ditto. + * i387-tdep.h, gdbthread.h, event-top.h, gdb.h: Ditto. + * dwarf2cfi.h, doublest.h, disasm.h, cp-abi.h: Ditto. + * cli-out.h, c-lang.h, ax-gdb.h, arch-utils.h: Ditto. + * ada-lang.h, config/nm-lynx.h, config/nm-linux.h: Ditto. + * config/sparc/tm-sp64.h, config/rs6000/tm-rs6000.h: Ditto. + * config/pa/tm-hppah.h, config/m68k/tm-delta68.h: Ditto. + * cli/cli-setshow.h, cli/cli-script.h: Ditto. + +2003-04-11 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_frame_id): Return this frame's "id". + (legacy_get_prev_frame): Set prev's frame ID code_addr to the + function start. + (legacy_saved_regs_this_id): Replace function body with + internal-error. + (deprecated_frame_xmalloc): Mark the frame ID as valid, use + FRAME_OBSTACK_ZALLOC. + (create_new_frame): Mark the frame ID as valid. + +2003-04-11 Alexandre Oliva <aoliva@redhat.com> + + * Makefile.in (libbfd_h): Added missing setting. + * mips-tdep.c (mips_gdbarch_init): Set disassembler_options + according to the selected ABI. + +2003-04-11 Jeff Johnston <jjohnstn@redhat.com> + + * gdb_indent.sh: Recognize pid_t and sigset_t as types. + +2003-04-11 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_SAVED_PC_AFTER_CALL): Deprecate + SAVED_PC_AFTER_CALL. + * gdbarch.h, gdbarch.c: Regenerate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + (ia64_saved_pc_after_call): Update declaration. + * i386ly-tdep.c (i386lynx_init_abi): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * ns32knbsd-nat.c (frame_num_args): Update. + * ns32k-tdep.c (umax_frame_num_args): Update. + * mips-tdep.c (mips_init_frame_pc_first): Update. + * infrun.c (step_over_function): Update. + * i386-linux-tdep.c (skip_hurd_resolver): Update. + * i386-interix-tdep.c (i386_interix_back_one_frame): Update. + * config/sparc/tm-sparc.h (DEPRECATED_SAVED_PC_AFTER_CALL): Update. + (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/pa/tm-hppa.h (DEPRECATED_SAVED_PC_AFTER_CALL): Update. + * arm-linux-tdep.c (skip_hurd_resolver): Update. + * arch-utils.c (init_frame_pc_default): Update. + * alpha-tdep.c (alpha_init_frame_pc_first): Update. + * x86-64-tdep.h (x86_64_linux_saved_pc_after_call): Update + declaration. + +2003-04-11 Andrew Cagney <cagney@redhat.com> + + * i387-tdep.c: Update copyright. + (i387_to_double): Delete function. + (double_to_i387): Delete function. + +2003-04-10 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_frame_this_id): Set the code addr to the + frame's function's address. Simplify. + (d10v_frame_unwind_cache): Check that the frame's function is + non-zero. + +2003-04-10 Jim Blandy <jimb@redhat.com> + + * s390-tdep.c (s390_gdbarch_init): Put back accidentally deleted + call to set_gdbarch_deprecated_push_arguments. + +2003-04-10 Andrew Cagney <cagney@redhat.com> + + * frame.c (fprint_frame_id): New function. + (fprint_frame_type, fprint_frame): New function. + (frame_pc_unwind, frame_func_unwind): Add/update trace code. + (create_sentinel_frame, get_frame_id): Ditto. + (frame_id_p, frame_id_eq): Ditto. + (frame_id_inner, create_new_frame): Ditto. + (legacy_get_prev_frame, get_prev_frame): Ditto. + (deprecated_update_frame_pc_hack): Ditto. + (frame_register_unwind): Ditto. + (deprecated_update_frame_base_hack): Ditto. + +2003-04-10 Corinna Vinschen <vinschen@redhat.com> + + * i386-cygwin-tdep.c (i386_cygwin_frame_chain): New function. + (i386_cygwin_init_abi): Set i386_cygwin_frame_chain as new + frame_chain function. + * Makefile.in: Add dependencies due to above change. + +2003-04-10 Corinna Vinschen <vinschen@redhat.com> + + * blockframe.c (legacy_frame_chain_valid): Move call to + DEPRECATED_FRAME_CHAIN_VALID before calls to inside_entry_func and + inside_entry_file. + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * frame.h (struct frame_id): Replace "pc" and "base" with + "stack_addr" and "code_addr". Update comments. + (frame_id_build): Update parameter names and comment. + (struct frame_info): Replace "id_p" and "id" with "this_id". + * dummy-frame.c (dummy_frame_this_id): Update. + * breakpoint.c (print_one_breakpoint): Update. + * frame.c (get_frame_id): Update. + (get_frame_base, frame_id_build): Update. + (create_sentinel_frame, legacy_get_prev_frame): Update. + (deprecated_update_frame_base_hack): Update. + (frame_id_p, frame_id_eq): Rework, return 0 when an invalid ID. + (frame_id_inner): Ditto. + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * defs.h (gdb_print_host_address): Make "addr" parameter a + pointer constant. + * utils.c (gdb_print_host_address): Update. + +2003-04-09 Kevin Buettner <kevinb@redhat.com> + + * rs6000-tdep.c (frame_get_saved_regs): Don't assume that the + register number for R0 is 0. + +2003-04-09 J. Brobecker <brobecker@gnat.com> + + * frame.h (struct gdbarch): Add opaque structure definition + to avoid a compilation warning on LynxOS 4.0. + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * frame.h (struct frame_info): Delete field "pc". Replace + "pc_unwind_cache" and "pc_unwind_cache_p" with "prev_pc" + structure. + * frame.c (frame_pc_unwind): Update. + (create_sentinel_frame): Do not set "pc". + (get_prev_frame): Do not set "pc". Use frame_pc_unwind. + (get_frame_pc): Call frame_pc_unwind. + (deprecated_update_frame_pc_hack): Update. + (create_new_frame): Use "pc" not "->pc". + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_frame_id): Eliminate code updating "frame". + (legacy_get_prev_frame): Ditto. + (get_frame_base): Return id.base directly. + (deprecated_update_frame_base_hack): Update "id.base". + * frame.h (struct frame_info): Delete field "frame". + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * NEWS: Mention that the "Sequent family" is obsolete. + * configure.tgt: Obsolete i[3456]86-sequent-bsd*, + i[3456]86-sequent-sysv4*, and i[3456]86-sequent-sysv*. + * configure.host: Obsolete i[3456]86-sequent-bsd*, + i[3456]86-sequent-sysv4*, and i[3456]86-sequent-sysv*. + * config/i386/tm-ptx4.h: Obsolete file. + * config/i386/tm-ptx.h: Obsolete file. + * symm-tdep.c: Obsolete file. + * config/i386/symmetry.mt: Obsolete file. + * config/i386/tm-symmetry.h: Obsolete file. + * symm-nat.c: Obsolete file. + * config/i386/nm-symmetry.h: Obsolete file. + * config/i386/xm-symmetry.h: Obsolete file. + * config/i386/symmetry.mh: Obsolete file. + * config/i386/nm-ptx4.h: Obsolete file. + * config/i386/ptx4.mh: Obsolete file. + * config/i386/ptx.mt: Obsolete file. + * config/i386/ptx.mh: Obsolete file. + * config/i386/xm-ptx4.h: Obsolete file. + * config/i386/xm-ptx.h: Obsolete file. + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + Obsolete mips*-*-mach3*. + * NEWS: Mention that mips*-*-mach3* is obsolete. + * m3-nat.c: Obsolete file. + * config/nm-m3.h: Obsolete file. + * config/mips/tm-mipsm3.h: Obsolete file. + * config/mips/mipsm3.mt: Obsolete file. + * config/mips/mipsm3.mh: Obsolete file. + * config/mips/xm-mipsm3.h: Obsolete file. + * mipsm3-nat.c: Obsolete file. + * configure.host: Obsolete mips-dec-mach3*. + * configure.tgt: Obsolete mips*-*-mach3*. + +2003-04-09 Andrew Cagney <cagney@redhat.com> + + * doublest.h: Update copyright. + (deprecated_store_floating, deprecated_extract_floating): Rename + store_floating and extract_floating. Update comments. + * doublest.c: Update copyright. + (extract_floating_by_length): Replace extract_floating. + (store_floating_by_length): Replace store_floating. + (deprecated_extract_floating): New function. + (deprecated_store_floating): New function. + (extract_typed_floating): Call extract_floating_by_length. + (store_typed_floating): Call store_floating_by_length. + * x86-64-tdep.c (x86_64_store_return_value): Update. + * sh-tdep.c (sh3e_sh4_extract_return_value): Update. + (sh64_extract_return_value): Update. + (sh_sh4_register_convert_to_virtual): Update. + (sh_sh64_register_convert_to_virtual): Update. + (sh_sh4_register_convert_to_raw): Update. + (sh_sh64_register_convert_to_raw): Update. + * rs6000-tdep.c (rs6000_register_convert_to_virtual): Update. + (rs6000_register_convert_to_raw): Update. + * ia64-tdep.c (ia64_register_convert_to_virtual): Update. + (ia64_register_convert_to_raw): Update. + * config/i386/tm-symmetry.h (REGISTER_CONVERT_TO_RAW): Update. + (REGISTER_CONVERT_TO_VIRTUAL): Update. + * arm-linux-tdep.c (arm_linux_push_arguments): Update. + * alpha-tdep.c (alpha_register_convert_to_virtual): Update. + (alpha_register_convert_to_raw): Update. + +2003-04-08 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (SAVED_PC_AFTER_CALL): Add a predicate. + * gdbarch.h, gdbarch.c: Re-generate. + * d10v-tdep.c (d10v_saved_pc_after_call): Delete function. + (d10v_gdbarch_init): Do not set saved_pc_after_call. + * infrun.c (step_over_function): Call SAVED_PC_AFTER_CALL_P + conditionally, use frame_pc_unwind as an alternative. Add + comments. + * arch-utils.c (init_frame_pc_default): Only call + SAVED_PC_AFTER_CALL when available. + +2003-04-08 Elena Zannoni <ezannoni@redhat.com> + + * infrun.c (stop_soon): Rename from stop_soon_quietly. + (struct inferior_status): Rename stop_soon_quietly field to stop_soon. + (clear_proceed_status): Rename stop_soon_quietly to stop_soon. + (start_remote): Ditto. + (handle_inferior_event): Ditto. + (save_inferior_status): Ditto. + (restore_inferior_status): Ditto. + * infcmd.c (attach_command): Ditto. + * fork-child.c (startup_inferior): Ditto. + * inferior.h (stop_soon): Rename from stop_soon_quietly. + * alpha-tdep.c (heuristic_proc_start): Ditto. + * mips-tdep.c (heuristic_proc_start): Ditto. + * solib-svr4.c (svr4_solib_create_inferior_hook): Ditto. + * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. + * solib-osf.c (osf_solib_create_inferior_hook): Ditto. + * solib-irix.c (irix_solib_create_inferior_hook): Ditto. + * remote-vx.c (vx_create_inferior): Ditto. + +2003-04-08 Elena Zannoni <ezannoni@redhat.com> + + * infrun.c (stop_soon_quietly): Make it an enum, to better + override the default behavior of handle_inferior_event. + (clear_proceed_status): Update uses of stop_soon_quietly to + reflect that it is now an enum. + (start_remote): Ditto. + (handle_inferior_event): Change logic a bit if stop_soon_quietly + is set to handle the new GNU/Linux kernel behavior for + attach/sigstop. Update uses of stop_soon_quietly. + * inferior.h (enum stop_kind): New enum. + * infcmd.c (attach_command): Use STOP_QUIETLY_NO_SIGSTOP. + Reset normal handle_inferior_event behavior, afterwards. + * fork-child.c (startup_inferior): Update. + * alpha-tdep.c (heuristic_proc_start): Update. + * solib-svr4.c (svr4_solib_create_inferior_hook): Update. + * solib-sunos.c (sunos_solib_create_inferior_hook): Update. + * solib-osf.c (osf_solib_create_inferior_hook): Update. + * solib-irix.c (irix_solib_create_inferior_hook): Update. + * remote-vx.c (vx_create_inferior): Update. + * mips-tdep.c (heuristic_proc_start): Update. + +2003-04-07 Elena Zannoni <ezannoni@redhat.com> + + * disasm.c (dump_insns): Move variables inside loop, or they will + be freed more than once, causing wild memory corruptions. + (gdb_disassembly): Look for the substring "-thread", + instead of "-threads" in the target name, to make sure to find + the 'multi-thread' target. Also, make sure we do the right thing + with the "core" target. + +2003-04-07 Kevin Buettner <kevinb@redhat.com> + + * mips-tdep.c (mips_print_fp_register): New function, created from + do_fp_register_row(). Registers are now (also) printed as hex. + Only one register is printed per row. + (mips_print_register, do_fp_register_row): Print floating point + registers with mips_print_fp_register(). + +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * valprint.h (inspect_it): Add extern declaration. + * objc-lang.c (value_nsstring): Avoid assignment inside of "if". + (selectors_info, classes_info): Ditto. + (find_objc_msgcall): Fix indentation. + (objc_printstr): Delete extern declarations. + + * arm-tdep.c (arm_frameless_function_invocation): Fix typo. + +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * frame.h (legacy_frame_chain_valid): Rename frame_chain_valid. + Update comment. + * frame.c (legacy_saved_regs_this_id): Update. + (legacy_get_prev_frame): Update. + * xstormy16-tdep.c: Update comment. + * sparc-tdep.c (sparc_frame_chain): Update comment. + * blockframe.c (legacy_frame_chain_valid): Update. + +2003-04-06 Andrew Cagney <cagney@redhat.com> + + * valprint.c (val_print_type_code_int): Delete #ifdef + PRINT_TYPELESS_INTEGER code. + + * gdbarch.sh (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) + (CALL_DUMMY_LOCATION, DEPRECATED_PC_IN_CALL_DUMMY): Allow partial + multi-arch definition. + * gdbarch.h: Re-generate. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + Eliminate FRAME_FIND_SAVED_REGS. + * config/pa/tm-hppah.h (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Change FSR parameter to a pointer. + * config/pa/tm-hppa64.h (FRAME_FIND_SAVED_REGS_IN_SIGTRAMP): + Assume FSR parameter is a pointer. + * hppa-hpux-tdep.c (hppa_hpux_frame_find_saved_regs_in_sigtramp): + Make fsr a pointer. + * hppa-tdep.c (hppa_frame_find_saved_regs): New function. + (hppa_frame_saved_pc): Call hppa_frame_init_saved_regs. Make + saved_regs a pointer. + (hppa_frame_saved_pc): Ditto. + (find_dummy_frame_regs): Make frame_saved_regs a pointer + (hppa_pop_frame): Call hppa_frame_init_saved_regs. Make fsr a + pointer. + (restore_pc_queue): Make fsr a pointer. + (hppa_frame_find_saved_regs): Make frame_saved_regs a pointer. + (hppa_frame_chain): Make saved_regs a pointer, call + hppa_frame_init_saved_regs. + * sparc-tdep.c: Include "gdb_assert.h". + (sparc_frame_find_saved_regs): Replace internal_error with + gdb_assert. + * remote-vxsparc.c (vx_read_register): Delete reference to + FRAME_FIND_SAVED_REGS. + * gdbarch.sh: Delete check for FRAME_FIND_SAVED_REGS. + * gdbarch.h: Regenerate. + * frame.h (DEPRECATED_FRAME_INIT_SAVED_REGS): Delete macro. + (deprecated_get_frame_saved_regs): Delete declaration. + (struct frame_saved_regs): Delete definition. + * frame.c (deprecated_get_frame_saved_regs): Delete function. + * config/pa/tm-hppa.h (hppa_frame_init_saved_regs): Declare. + (hppa_frame_find_saved_regs): Delete declaration. + (FRAME_FIND_SAVED_REGS): Delete macro. + (DEPRECATED_FRAME_INIT_SAVED_REGS): Define. + * config/i386/tm-ptx.h (FRAME_FIND_SAVED_REGS): Delete + FRAME_FIND_SAVED_REGS in comment. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_func_unwind, get_frame_func): New functions. + * frame.h (get_frame_func, frame_func_unwind): Declare. + (struct frame_info): Add field "prev_func" for caching the + previous frame's function address. + * arm-tdep.c (arm_frameless_function_invocation): Combine + get_pc_function_start and get_frame_pc into get_frame_func. + * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto. + (sh64_nofp_frame_init_saved_regs): Ditto. + * s390-tdep.c (s390_function_start): Ditto. + * rs6000-tdep.c (rs6000_pop_frame): Ditto. + (rs6000_frameless_function_invocation): Ditto. + (rs6000_frame_saved_pc): Ditto. + * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto. + * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto. + * i386-tdep.c (i386_frameless_signal_p): Ditto. + (i386_frame_init_saved_regs): Ditto. + * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto. + * d10v-tdep.c (d10v_frame_unwind_cache): Combine + get_pc_function_start and frame_pc_unwind into frame_func_unwind. + * cris-tdep.c (cris_frame_init_saved_regs): Ditto. + * blockframe.c (frameless_look_for_prologue): Ditto. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (legacy_get_prev_frame): Link prev to next at the + function start. Update comments. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_frame_id): Update comment. + (legacy_get_prev_frame): Update comment. + * gdbarch.sh: Delete check for EXTRA_FRAME_INFO. + * gdbarch.h: Regenerate. + * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): Delete. + * frame.h: Delete #ifdef EXTRA_FRAME_INFO code. + +2003-04-05 Andrew Cagney <cagney@redhat.com> + + * stack.c (print_frame_info): Use get_frame_pc. + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Do not call frame_type_from_pc. Set + the frame's type from the unwinder. + (get_frame_type): Map UNKNOWN_FRAME onto NORMAL_FRAME. + (create_new_frame, legacy_get_prev_frame): When the unwinder's + type isn't UNKNOWN_FRAME, initalize "type" from the unwinder. + (get_frame_base_address): Use get_frame_type. + (get_frame_locals_address, get_frame_args_address): Ditto. + (legacy_saved_regs_unwinder): Set the type to UNKNOWN_TYPE. + * frame.h (enum frame_type): Add UNKNOWN_FRAME. + (struct frame_info): Add comment explaining why the frame contains + a "type" field. + * dummy-frame.c (dummy_frame_unwind): Set the type to DUMMY_FRAME. + * d10v-tdep.c (d10v_frame_unwind): Set the type to NORMAL_FRAME. + * sentinel-frame.c (sentinel_frame_unwinder): Set the type to + NORMAL_FRAME. + * frame-unwind.h: Include "frame.h". + (struct frame_unwind): Add "type" field. + * Makefile.in (frame_unwind_h): Add $(frame_h). + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * x86-64-tdep.c (x86_64_unwind_dummy_id): Use frame_id_build. + * dummy-frame.c (dummy_frame_this_id): Use frame_id_build. + * d10v-tdep.c (d10v_frame_this_id): Use get_frame_pc and + get_frame_base. + (d10v_unwind_dummy_id): Use frame_id_build. + * frame.c (find_frame_sal): Use get_frame_pc. + (create_new_frame): Use deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (create_sentinel_frame): Add comment about ->pc going away. + (get_prev_frame): Add comment about ->pc going away. + (legacy_get_prev_frame): Use get_frame_base, get_frame_pc, + frame_id_build, deprecated_update_frame_pc_hack and + deprecated_update_frame_base_hack. + (select_frame): Use get_frame_pc. + (legacy_saved_regs_this_id): Use frame_id_build. + +2003-04-04 Elena Zannoni <ezannoni@redhat.com> + + * x86-64-tdep.c (x86_64_push_arguments): Handle correctly the + signed integer case. + (classify_argument): Handle enumerations and references. + +2003-04-04 Andrew Cagney <cagney@redhat.com> + + * frame.c (create_sentinel_frame): Initialize the sentinel frame's + ID to NULL. + +2003-04-01 Adam Fedor <fedor@gnu.org> + + * gdb/objc-lang.c (selectors_info): Replace calls to + SYMBOL_DEMANGLED_NAME and DEPRECATED_SYMBOL_NAME with + SYMBOL_NATURAL_NAME. + (classes_info, find_methods): Likewise. + +2003-04-03 Kevin Buettner <kevinb@redhat.com> + + * rs6000-tdep.c (rs6000_gdbarch_init): For xcoff executables, set + ``mach'' to the value determined by bfd_default_set_arch_mach(). + +2003-04-02 Bob Rossi <bob_rossi@cox.net> + + * Makefile.in (SUBDIR_MI_OBS): Add "mi-cmd-file.o". + (SUBDIR_MI_SRCS): Add "mi-cmd-file.c". + (mi-cmd-file.o): Update dependencies. + +2003-04-01 Kevin Buettner <kevinb@redhat.com> + + * mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum) + (mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM. + +2003-04-01 Adam Fedor <fedor@gnu.org> + + * Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h). + * language.h (struct language_defn): Add la_demangle. + (language_demangle): Declare. + * language.c (language_demangle): New function. + (unk_lang_demangle): Likewise. + (unknown_language_defn, auto_language_defn, local_language_defn): + Add ukn_lang_demangle. + * ada-lang.c (ada_language_defn): Add NULL for la_demangle element. + * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise. + * c-lang.c (c_language_defn, asm_language_defn): Likewise. + (cplus_language_defn): Add cplus_demangle for la_demangle element. + * jv-lang.c (java_demangle): New function + (java_language_defn): Use it for la_demangle element. + * objc-lang.c (objc_demangle): Add options argument + (objc_language_defn): Use objc_demangle for la_demangle element. + * maint.c (maintenance_demangle): Replace switch with + call to language_demangle. + * utils.c (fprintf_symbol_filtered): Likewise. + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + * printcmd.c (print_frame_nameless_args): Delete #ifdef + NAMELESS_ARG_VALUE, PRINT_NAMELESS_INTEGER and + PRINT_TYPELESS_INTEGER. + * config/sparc/tm-sp64.h (DEPRECATED_PUSH_RETURN_ADDRESS): Rename + PUSH_RETURN_ADDRESS. + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (d10v-tdep.o): Update dependencies. + * d10v-tdep.c: Include "frame-base.h". + (d10v_frame_unwind): Make constant. + (d10v_frame_base_address): New function. + (d10v_frame_base): New variable. + (d10v_gdbarch_init): Set frame_base default. + (struct d10v_unwind_cache): Add the field "prev_sp". Update + comment for base. + (d10v_frame_unwind_cache): Set and use "prev_sp". + (d10v_frame_this_id): Use the previous frame's inner most stack + address and this frame's func address for the frame ID. Use + frame_id_build. Don't analyze beyond the current instruction. + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + * frame.h (get_frame_locals_address, get_frame_args_address): + Refer to the base address, instead of the address of the first + local or parameter. + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + Add frame debug info addresses: + * frame-base.c: New file. + * frame-base.h: New file. + * frame.h (struct frame_base): Add opaque declaration. + (get_frame_base): Update comment. + (get_frame_base_address): Declare. + (get_frame_locals_address): Declare. + (get_frame_args_address): Declare. + (struct frame_info): Add "base" and "base_cache". Update + comments on the unwinder. + * frame.c: Include "frame-base.h". + (get_frame_locals_address): New function. + (get_frame_base_address): New function. + (get_frame_args_address): New function. + * findvar.c (read_var_value): Use get_frame_locals_address and + get_frame_args_address. + * stack.c (frame_info): Use get_frame_locals_address and + get_frame_args_address. + (FRAME_ARGS_ADDRESS_CORRECT): Delete conditionally defined macro, + moved to "frame-base.c". + * printcmd.c (print_frame_nameless_args): Ditto. + * symtab.h (address_class): Update comments. + * dwarf2loc.c (dwarf_expr_frame_base): Add note about + get_frame_base_address. + * dwarf2expr.c (execute_stack_op): Ditto. + * Makefile.in (frame_base_h): Define. + (frame.o): Update dependencies. + (frame-base.o): Add dependencies. + (SFILES): Add frame-base.c. + (COMMON_OBS): Add frame-base.o. + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (CALL_DUMMY_START_OFFSET): Default to zero. + CALL_DUMMY_LENGTH): Ditto. + * gdbarch.c: Re-generate. + * inferior.h (CALL_DUMMY_START_OFFSET): Delete macro. + (CALL_DUMMY_LENGTH): Delete macro. + * alpha-tdep.c (alpha_gdbarch_init): Do not set above when zero. + * arm-tdep.c (arm_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * hppa-tdep.c (hppa_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * vax-tdep.c (vax_gdbarch_init): Ditto. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto. + +2003-04-01 Corinna Vinschen <vinschen@redhat.com> + + * frame.c (get_prev_frame): Disable call to inside_entry_file(). + +2003-04-01 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (CALL_DUMMY_BREAKPOINT_OFFSET): Default to zero. + (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete. + * gdbarch.h, gdbarch.c: Re-generate. + * config/sparc/tm-sp64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete. + (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete. + * config/pa/tm-hppa64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete. + * inferior.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete. + (CALL_DUMMY_BREAKPOINT_OFFSET): Delete. + * infcmd.c (run_stack_dummy): Simplify assuming + CALL_DUMMY_BREAKPOINT_OFFSET_P. + * infrun.c (handle_inferior_event): Ditto. + * alpha-tdep.c (alpha_gdbarch_init): Do not set + call_dummy_breakpoint_offset or call_dummy_breakpoint_offset_p. + * arm-tdep.c (arm_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * ns32k-tdep.c (ns32k_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * vax-tdep.c (vax_gdbarch_init): Ditto. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto. + +2003-04-01 Daniel Jacobowitz <drow@mvista.com> + + * symfile.c (symfile_relocate_debug_section): Update call to + bfd_simple_get_relocated_section_contents. + +2003-03-31 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (FIX_CALL_DUMMY): Change to function with predicate. + * gdbarch.h, gdbarch.c: Regenerate. + * inferior.h (FIX_CALL_DUMMY): Delete macro. + * valops.c (hand_function_call): Only call FIX_CALL_DUMMY when + available. + * frame.h (generic_fix_call_dummy): Delete declaration. + * dummy-frame.h: Update comment. + * dummy-frame.c (generic_fix_call_dummy): Delete function. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set + fix_call_dummy. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * arm-tdep.c (arm_gdbarch_init): Ditto. + +2003-03-31 J. Brobecker <brobecker@gnat.com> + + * config/pa/tm-hppa64.h (FRAME_ARGS_ADDRESS): Delete macro, not useful. + (INIT_FRAME_AP): Likewise. + (EXTRA_FRAME_INFO): Likewise. + +2003-03-31 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh: Include "symfile.h". + (CALL_DUMMY_ADDRESS): Default to entry_point_address. + * gdbarch.h, gdbarch.c: Re-generate. + * inferior.h (CALL_DUMMY_ADDRESS): Delete macro. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set + call_dummy_address, the default is at entry_point_address. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * arm-tdep.c (arm_gdbarch_init): Ditto. + +2003-03-31 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (CALL_DUMMY_P): Delete. + * gdbarch.h, gdbarch.c: Re-generate. + * inferior.h (CALL_DUMMY_P): Delete macro. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * d10v-tdep.c (d10v_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * breakpoint.c (deprecated_frame_in_dummy): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * dummy-frame.c (dummy_frame_this_id): Update comments. + * rs6000-tdep.c (rs6000_extract_struct_value_address): Ditto. + * frame.c (legacy_get_prev_frame): Ditto. + * valops.c (call_function_by_hand): Delete function. + (hand_function_call): Rename to call_function_by_hand + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + 2002-11-10 Klee Dienes <kdienes@apple.com> + * value.h (struct value): Update comment. + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c: Replace _FP_REGNUM and FP_REGNUM with + D10V_FP_REGNUM. + (d10v_gdbarch_init): Do not set fp_regnum. + + * frame.c (get_frame_base): Force ID initialization. + (get_prev_frame): Move computation of the frame ID from here ... + (get_frame_id): ... to here. + (legacy_get_prev_frame): Mark the frame ID as valid. + * frame.h (struct frame_info): Add field "id_p". + +2003-03-30 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_store_struct_return): Removed. + (i386_gdbarch_init): Don't set deprecated_store_struct_return. + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_DUMMY_WRITE_SP): Replace TARGET_WRITE_SP. + * gdbarch.h, gdbarch.c: Regenerate. + * v850-tdep.c (v850_gdbarch_init): Set deprecated_dummy_write_sp. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * vax-tdep.c (vax_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * ns32k-tdep.c (ns32k_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * alpha-tdep.c (alpha_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_push_dummy_frame, sparc_pop_frame): Update. + * config/sparc/tm-sp64.h (DEPRECATED_DUMMY_WRITE_SP): Update. + * config/pa/tm-hppa.h (DEPRECATED_DUMMY_WRITE_SP): Define. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * valops.c (hand_function_call): Replace TARGET_WRITE_SP with + DEPRECATED_DUMMY_WRITE_SP. Call when the method is available, + instead of when push_dummy_call is not available. + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + * infttrace.c: Include "gdbthread.h". + (parent_attach_all): Fix function signature. + (call_ptrace): Update call. + * Makefile.in (infttrace.o): Update dependencies. + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_PUSH_RETURN_ADDRESS): Replace + PUSH_RETURN_ADDRESS. + * gdbarch.h, gdbarch.c: Regenerate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * valops.c (hand_function_call): Update. + +2003-03-29 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_gdbarch_init): Do not set call_dummy_words or + sizeof_call_dummy_words. + * gdbarch.sh (CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS): Always + define. + * gdbarch.h: Regenerate. + +2003-03-29 Andrew Cagney <cagney@redhat.com> + + * infttrace.h: New file. + * hpread.c: Include "gdb_assert.h" and "somsolib.h". + (hpread_get_textlow): Detect an uninitialized dn_bufp. + (hpread_read_doc_function_type): Detect an initialized type1. + (hpread_quick_traverse): Initialize mod_name_string. + * somsolib.h: Add #ifdef SOMSOLIB_H wrapper. + (som_solib_get_solib_by_pc): Declare. + (so_lib_thread_start_addr): Declare. + (no_shared_libraries): Declare. + * somread.c (init_import_symbols): Make static. Add forward + declaration. + * config/pa/nm-hppah.h: Include "infttrace.h" for + parent_attach_all. + (hppa_insert_hw_watchpoint): Declare. + (hppa_can_use_hw_watchpoint, hppa_remove_hw_watchpoint): Declare. + * hppah-nat.c: Include "gdb_string.h". + (parent_attach_all): Delete extern declaration, moved to + "infttrace.h". + (hppa_can_use_hw_watchpoint): Change type of "type" parameter to + int. + (hppa_remove_hw_watchpoint, hppa_insert_hw_watchpoint): Ditto. + * Makefile.in (infttrace_h): Define. + (hpread.o): Update dependencies. + (hppah-nat.o, hppa-hpux-tdep.o, hppa-tdep.o): Ditto. + * hppa-hpux-tdep.c: Include "gdb_string.h". + * hppa-tdep.c (hppa_frame_saved_pc): Initialize "old_pc". + * infrun.c (handle_inferior_event): Always initialize + stepped_after_stopped_by_watchpoint. Add default and remove + fallthrough in switch statement. + * infttrace.c (hppa_can_use_hw_watchpoint): Change type of "type" + parameter to int. + (hppa_remove_hw_watchpoint): Ditto. + +2003-03-29 Andrew Cagney <cagney@redhat.com> + + * ns32k-tdep.c (ns32k_gdbarch_init): Set the call dummy breakpoint + offset. + +2003-03-29 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (arm_push_arguments): Delete. + (struct stack_item): New type. + (push_stack_item, pop_stack_item, arm_push_dummy_call): New functions. + (arm_store_struct_return): Delte. + (arm_gdbarch_init): Register arm_push_dummy_call. Don't register + arm_push_arguments or arm_store_struct_return. + +2003-03-28 Andrew Cagney <cagney@redhat.com> + + * Makefile.in (d10v-tdep.o): Update dependencies. + * remote.h (target_resume_hook, target_wait_loop_hook): Declare. + * d10v-tdep.c: Include "remote.h". + (target_resume_hook): Delete extern declaration. + (target_wait_loop_hook): Ditto. + (tdisassemble_command): Eliminate assignment in "if" conditional. + (d10v_ts2_register_sim_regno): Eliminate call to + legacy_register_sim_regno. + (d10v_ts3_register_sim_regno): Ditto. + +2003-03-28 Jeff Johnston <jjohnstn@redhat.com> + + * thread.c: Reindented. + * lin-lwp.c: Ditto. + * linux-proc.c: Ditto. + +2003-03-28 Bob Rossi <bob_rossi@cox.net> + + * MAINTAINERS (write after approval): Add myself. + +2003-03-27 Theodore A. Roth <troth@openavr.org> + + * objc-exp.y: Add missing semi-colons. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * regcache.c (write_sp): Delete function and references. + * inferior.h (write_sp): Delete declaration. + * valops.c (hand_function_call): Replace write_sp with + TARGET_WRITE_SP. + * sparc-tdep.c (sparc_push_dummy_frame): Ditto. + (sparc_pop_frame): Ditto. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * NEWS: Mention removal of support for hppa*-*-bsd* and + hppa*-*-osf* natives, and hppa*-*-pro* target. + * config/pa/xm-hppah.h: Do not include "pa/xm-pa.h". + * config/pa/xm-pa.h: Obsolete file. + * config/pa/xm-hppab.h: Obsolete file. + * config/pa/nm-hppab.h: Obsolete file. + * config/pa/tm-hppab.h: Obsolete file. + * config/pa/tm-hppao.h: Obsolete file. + * config/pa/nm-hppao.h: Obsolete file. + * config/pa/tm-pro.h: Obsolete file. + * config/pa/hppaosf.mt: Obsolete file. + * config/pa/hppaosf.mh: Obsolete file. + * config/pa/hppapro.mt: Obsolete file. + * config/pa/hppabsd.mt: Obsolete file. + * config/pa/hppabsd.mh: Obsolete file. + * configure.host: Disable hppa*-*-bsd* and hppa*-*-osf*. + * configure.tgt: Disable hppa*-*-bsd*, hppa*-*-pro* and + hppa*-*-osf*. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_gdbarch_init): Set push_dummy_call instead of + push_arguments. Don't set push_return_address or write_sp. + (d10v_push_dummy_call): Replace d10v_push_arguments. + (d10v_push_return_address, d10v_write_sp): Delete function, + handled by push_dummy_call. + +2003-03-26 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_PUSH_ARGUMENTS): Rename PUSH_ARGUMENTS. + (push_dummy_call): New pure multi-arch replacement with gdbarch, + regcache and dummy_addr parameters. + * gdbarch.h, gdbarch.c: Re-generate. + * valops.c (hand_function_call): Use gdbarch_push_dummy_call when + available; assume it will handle stack alignment and return + address issues. Fall back to DEPRECATED_PUSH_ARGUMENTS and + legacy_push_arguments. + (legacy_push_arguments): Rename default_push_arguments. + * value.h (legacy_push_arguments): Rename default_push_arguments. + * i386-tdep.c (i386_push_arguments): Call legacy_push_arguments. + * config/sparc/tm-sparc.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/sparc/tm-sp64.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/pa/tm-hppa.h (DEPRECATED_PUSH_ARGUMENTS): Update. + * config/i386/tm-symmetry.h: Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * d10v-tdep.c (d10v_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * arm-linux-tdep.c (arm_linux_init_abi): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + * signals/signals.c (do_target_signal_to_host): Correct realtime + signal range test. + +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + * breakpoint.c (handle_gnu_4_16_catch_command, get_catch_sals) + (struct sal_chain, map_catch_names): Remove. + (catch_exception_command_1): Don't call + handle_gnu_4_16_catch_command. + +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + From Mark Dettinger <dettinge@de.ibm.com>: + * dwarf2cfi.c (read_2u): Increment pointer by two. + +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + * signals/signals.c: Fix typos in last change. + +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + * signals/signals.c (REALTIME_LO, REALTIME_HI): Define if + not already defined. Use __SIGRTMIN if available. + (target_signal_from_host): Remove SIGRTMIN block. + (do_target_signal_to_host): Remove SIGRTMIN block; check that + the signal is within the realtime range. + +2003-03-25 Adam Fedor <fedor@gnu.org> + + * Makefile.in (infrun.o): Add $(language_h) + * infrun.c (handle_inferior_event): Use skip_language_trampoline + for language specific trampolines. + * language.h (struct language_defn): Add skip_trampoline. + (skip_language_trampoline): Declare. + * language.c (unk_lang_trampoline, skip_language_trampoline): + New functions. + (unknown_language_defn, auto_language_defn, local_language_defn): + Add ukn_lang_trampoline. + * ada-lang.c (ada_language_defn): Add NULL for language + specific skip_trampoline. + * c-lang.c, f-lang.c, jv-lang.c, m2-lang.c, p-lang.c, + scm-lang.c: Likewise. + * objc-lang.c (objc_skip_trampoline): New function. + (objc_language_defn): Add objc_skip_trampoline. + +2003-03-25 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Delay validating a frame's ID - + non-NULL, didn't go backwards - until an attempt to unwind it to + the previous frame. + +2003-03-25 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Replace + EXTRA_STACK_ALIGNMENT_NEEDED. Default to 0 not 1. + * gdbarch.h, gdbarch.c: Re-generate. + * config/sparc/tm-sparc.h + (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Define. + * sparc-tdep.c (sparc_gdbarch_init): Set + deprecated_extra_stack_alignment_needed. + * config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Delete. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not clear + extra_stack_alignment_needed. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * hppa-tdep.c (hppa_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + +2003-03-25 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_STORE_STRUCT_RETURN): Replace + STORE_STRUCT_RETURN. + * gdbarch.h, gdbarch.c: Regenerate. + * d10v-tdep.c (d10v_store_struct_return): Delete function. + (d10v_push_arguments): Set the struct return register. + (d10v_gdbarch_init): Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2003-03-25 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (CALL_DUMMY_STACK_ADJUST_P): Delete. + (DEPRECATED_CALL_DUMMY_STACK_ADJUST): Replace + CALL_DUMMY_STACK_ADJUST with a predicate variable. + * gdbarch.h, gdbarch.c: Regenerate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set + call_dummy_stack_adjust_p. + * vax-tdep.c (vax_gdbarch_init): Ditto. + * v850-tdep.c (v850_gdbarch_init): Ditto. + * sh-tdep.c (sh_gdbarch_init): Ditto. + * s390-tdep.c (s390_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * ns32k-tdep.c (ns32k_gdbarch_init): Ditto. + * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. + * mips-tdep.c (mips_gdbarch_init): Ditto. + * mcore-tdep.c (mcore_gdbarch_init): Ditto. + * m68k-tdep.c (m68k_gdbarch_init): Ditto. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * ia64-tdep.c (ia64_gdbarch_init): Ditto. + * i386-tdep.c (i386_gdbarch_init): Ditto. + * h8300-tdep.c (h8300_gdbarch_init): Ditto. + * frv-tdep.c (frv_gdbarch_init): Ditto. + * d10v-tdep.c (d10v_gdbarch_init): Ditto. + * cris-tdep.c (cris_gdbarch_init): Ditto. + * avr-tdep.c (avr_gdbarch_init): Ditto. + * arm-tdep.c (arm_gdbarch_init): Ditto. + * alpha-tdep.c (alpha_gdbarch_init): Ditto. + * config/sparc/tm-sp64.h (CALL_DUMMY_STACK_ADJUST): Update. + * config/sparc/tm-sparc.h (CALL_DUMMY_STACK_ADJUST): Update. + * config/sparc/tm-sp64.h (CALL_DUMMY_STACK_ADJUST): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. Do not set + call_dummy_stack_adjust_p. + * inferior.h (CALL_DUMMY_STACK_ADJUST_P): Delete macro. + (CALL_DUMMY_STACK_ADJUST): Delete macro. + * sparc-tdep.c (sparc32_push_arguments): Update. + * valops.c (hand_function_call): Update. + +2003-03-25 Corinna Vinschen <vinschen@redhat.com> + + * xstormy16-tdep.c (xstormy16_gdbarch_init): Add call to + set_gdbarch_char_signed. + +2003-03-25 Richard Earnshaw <rearnsha@arm.com> + + PR cli/548 + * arm-tdep.c (_initialize_arm_tdep): Command is "set arm disassembler". + +2003-03-25 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (arm_gdbarch_init): Register the disassembler function. + (_initialize_arm_tdep): Don't set tm_print_insn. + +2003-03-24 Adam Fedor <fedor@gnu.org> + + * Makefile.in (YYOBJ): Add objc-exp.tab.o + * objc-lang.h: Add multiple inclusion protection. + (start_msglist, add_msglist, end_msglist): Additional declarations. + +2003-03-24 Richard Earnshaw <rearnsha@arm.com> + + * armnbsd-tdep.c (arm_netbsd_aout_init_abi): ARM_FLOAT_SOFT enum + value was renamed to ARM_FLOAT_SOFT_FPA. + +2003-03-23 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_FRAME_CHAIN): Replace FRAME_CHAIN. + (DEPRECATED_FRAME_CHAIN_VALID): Replace FRAME_CHAIN_VALID. + * gdbarch.h, gdbarch.c: Regenerate. + * valops.c (hand_function_call): Update. + * objfiles.h (DEPRECATED_FRAME_CHAIN_VALID): Update. + * frame.c (legacy_saved_regs_this_id): Update. + (legacy_get_prev_frame, get_prev_frame, legacy_frame_p): Update. + * dummy-frame.h: Update. + * config/sparc/tm-sparc.h (DEPRECATED_FRAME_CHAIN): Update. + * config/pa/tm-hppa.h (DEPRECATED_FRAME_CHAIN_VALID): Update. + * config/m68k/tm-vx68.h (DEPRECATED_FRAME_CHAIN): Update. + * config/m68k/tm-os68k.h (DEPRECATED_FRAME_CHAIN): Update. + * config/m68k/tm-sun3.h: Update. + * blockframe.c (inside_main_func, frame_chain_valid): Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_frame_chain, sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_frame_saved_pc): Update. + (rs6000_gdbarch_init, rs6000_frame_saved_pc): Update. + (frame_get_saved_regs): Update. + * ppc-linux-tdep.c (ppc_linux_init_abi): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_frame_num_args, i386_gdbarch_init): Update. + * i386-interix-tdep.c (i386_interix_init_abi): Update. + (i386_interix_back_one_frame): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + (hppa_init_extra_frame_info): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.h (arm_float_model): Add AUTO and LAST values. + (arm_get_fp_model): Declare. + * arm-tdep.c (fp_model_strings): New string array. + (arm_fp_model, current_fp_model): New variables. + (arm_get_fp_model): New function. + (arm_set_fp): New function. + (set_fp_model_sfunc): New function. + (show_fp_model): New function. + (_initialize_arm_tdep): Add new command to set/show the FPU. + (arm_extract_return_value): Use arm_get_fp_model. + (arm_store_return_value): Likewise. + (arm_gdbarch_init): Default fpa model is softfpa. Call arm_set_fp + to initialize the floating-point data types. + * arm-linux-tdep.c (arm_linux_init_abi): The default floating point + model is FPA. + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (show_arm_command): Don't print out help. Instead, show + the current setting of each value. + (_initialize_arm_tdep): Delete variable new_cmd and add new vars + new_set and new_show. Use add_setshow_cmd_full and + add_setshow_boolean_cmd as appropriate. Deprecate "set/show apcs32" + commands and add new version as subcommands of "set/show arm". + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (setarmcmdlist, showarmcmdlist): New command lists. + (set_arm_command, show_arm_command): New functions. + (_initialize_arm_tdep): Add them. + (num_disassembly_options): Renamed from num_flavor_options. + (valid_disassembly_styles): Renamed from valid_flavors. + (disassembly_style): Renamed from disassembly_flavor. + (set_disassembly_style_sfunc): Renamed from + set_disassembly_flavor_sfunc. + (set_disassembly_style): Renamed from set_disassembly_flavor. + (arm_othernames): Updated. + (_initialize_arm_tdep): Deprecate "set/show disassembly-flavor" + command. Add "set/show arm disassembly" commands. Deprecate + "othernames" command. + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * Makefile.in (elf_reloc_macros_h, elf_arm_h): Define. + (arm-tdep.o): Depend on elf_arm_h. + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * Makefile.in (coff_internal_h): Define. + (arm-tdep.o): Update dependencies. + +2003-03-22 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (prologue_cache): Delete. + (check_prologue_cache, save_prologue_cache): Delete. + (arm_scan_prologue): Don't check or update the prologue_cache. + (arm_gdb_arch_init): Don't initialize it. + (_initialize_arm_tdep): Likewise. + +2003-03-21 Stephane Carrez <stcarrez@nerim.fr> + + * MAINTAINERS (tui): Maintainer of tui code. + +2003-03-21 Corinna Vinschen <vinschen@redhat.com> + + * Makefile.in (ALLDEPFILES): Add i386-cygwin-tdep.c. + (i386-cygwin-tdep.o): Add dependencies. + * defs.h (enum gdb_osabi): Add GDB_OSABI_CYGWIN. + * i386-cygwin-tdep.c: New file. + * osabi.c (gdb_osabi_name): Add string for GDB_OSABI_CYGWIN. + * config/i386/cygwin.mt (TDEPFILES): Add i386-cygwin-tdep.o. + +2003-03-20 Andrew Cagney <cagney@redhat.com> + + * infrun.c (DYNAMIC_TRAMPOLINE_NEXTPC): Delete macro. + (handle_inferior_event): Remove code calling + DYNAMIC_TRAMPOLINE_NEXTPC. + + * Makefile.in (init.c): Don't add $(srcdir) prefix when a file + already has a full path. + + * main.c (gdb_main): Return 1. + (captured_main): Call error to report an invalid interpreter. + + * Makefile.in (alpha-osf1-tdep.o): Update dependencies. + * alpha-osf1-tdep.c: Include "gdb_string.h". + +2003-03-19 J. Brobecker <brobecker@gnat.com> + + Continuing work to convert the hppa targets to multiarch partial. + + * hppa-tdep.c (hppa_gdbarch_init): Set the push_dummy_frame gdbarch + method, now that hppa_push_dummy_frame has a conformant prototype. + * config/pa/tm-hppa.h (DEPRECATED_PUSH_DUMMY_FRAME): Wrap macro + inside "#if !GDB_MULTI_ARCH ... #endif" conditional, in preparation + for the switch to multiarch partial. + +2003-03-19 Kevin Buettner <kevinb@redhat.com> + + * mdebugread.c (parse_symbol): For stEnd, we're done counting + when iss is issNull. + +2003-03-18 Kevin Buettner <kevinb@redhat.com> + + * mips-tdep.c (mips_register_name): Fix fencepost error involving + NUM_REGS bounds check. + +2003-03-18 Kevin Buettner <kevinb@redhat.com> + + * Makefile.in (mips-tdep.o): Add dependency on $(gdb_assert_h). + * mips-tdep.c (gdb_assert.h): Include. + (mips_generic_reg_names, mips_processor_reg_names): Make static. + (mips_register_name): Handle integer registers explicitly. Add + bounds checking. + (mips_r3041_reg_names, mips_r3051_reg_names, mips_r3081_reg_names) + (mips_lsi33k_reg_names): Don't list integer registers; they're + handled by mips_register_name() now. + * config/mips/tm-irix3.h (MIPS_REGISTER_NAMES): Likewise. + * config/mips/tm-irix6.h (MIPS_REGISTER_NAMES): Likewise. + * config/mips/tm-mips.h (MIPS_REGISTER_NAMES): Likewise. + * config/mips/tm-tx39.h (MIPS_REGISTER_NAMES): Likewise. + * config/mips/tm-tx39l.h (MIPS_REGISTER_NAMES): Likewise. + +2003-03-18 Andrew Cagney <cagney@redhat.com> + + * printcmd.c (print_scalar_formatted): Change VALADDR parameter to + a void pointer. + * gdbtypes.h (print_scalar_formatted): Update declaration. + * expression.h (enum exp_opcode): Remove non-ISO C trailing comma. + +2003-03-18 J. Brobecker <brobecker@gnat.com> + + * infrun.c (observer.h): Add #include. + (normal_stop): Add call to observer_notify_normal_stop. + * Makefile.in (infrun.o): Add dependency on observer.h. + +2003-03-18 J. Brobecker <brobecker@gnat.com> + + Continuing work to convert the hppa targets to multiarch partial. + * hppa-tdep.c (hppa_push_dummy_frame): Remove unused function + parameter. Reformat comment. + * config/pa/tm-hppa.h (hppa_push_dummy_frame): Update profile. + (DEPRECATED_PUSH_DUMMY_FRAME): Update call to hppa_push_dummy_frame() + to match new profile. + +2003-03-18 J. Brobecker <brobecker@gnat.com> + + * hppa-tdep.c (hppa_push_dummy_frame): Remove hack which does not + appear to be working in any case. + +2003-03-18 J. Brobecker <brobecker@gnat.com> + + * observer.c (observer_test_first_observer): New static variable. + (observer_test_second_observer): Likewise. + (observer_test_third_observer): Likewise. + (observer_test_first_notification_function): New static function. + (observer_test_second_notification_function): Likewise. + (observer_test_third_notification_function): Likewise. + +2003-03-17 J. Brobecker <brobecker@gnat.com> + + * hppa-tdep.c (gdb_assert.h): Add missing #include. + * somsolib.c (gdb_assert.h): Likewise. + * Makefile.in (hppa-tdep.o): Add dependency on gdb_assert.h. + (somsolib.o): Likewise. + +2003-03-17 Andrew Cagney <cagney@redhat.com> + + * disasm.c (gdb_disassembly): Set di.mach using the architecture's + BFD. Simplify setting of di.endian. + +2003-03-17 Andrew Cagney <cagney@redhat.com> + + * rs6000-tdep.c (ppc_floating_point_unit_p): New function. + * ppc-tdep.h (ppc_floating_point_unit_p): Declare. + + From Elena Zannoni <ezannoni@redhat.com> + * ppc-sysv-tdep.c (ppc_sysv_abi_push_arguments): Handle e500 + vector and floating-point parameters. + (ppc_sysv_abi_use_struct_convention): Handle e500 struct return + convention. + (ppc_sysv_abi_broken_use_struct_convention): Ditto. + +2003-03-17 Fernando Nasser <fnasser@redhat.com> + + * MAINTAINERS: Remove my name from several maintainership roles. + +2003-03-17 Andrew Cagney <cagney@redhat.com> + + Fix frame off-by-one bug. + * frame-unwind.h (frame_this_id_ftype): Replace + frame_unwind_id_ftype. + (frame_prev_register_ftype): Replace frame_unwind_reg_ftype. + (struct frame_unwind): Replace "id" with "this_id". Replace "reg" + with "prev_register". + * frame-unwind.c (frame_unwind_find_by_pc): Return + legacy_saved_regs_unwind instead of trad_frame_unwind. Update + comment. + * dummy-frame.c (cached_find_dummy_frame): Delete function. + (dummy_frame_this_id): Replace dummy_frame_id_unwind. + (dummy_frame_prev_register): Replace dummy_frame_register_unwind. + (dummy_frame_unwind): Update. + * sentinel-frame.c (sentinel_frame_prev_register): Replace + sentinel_frame_register_unwind. + (sentinel_frame_this_id): Replace sentinel_frame_id_unwind. + (sentinel_frame_unwinder): Update. + * frame.h (legacy_saved_regs_unwind): Replace trad_frame_unwind. + (struct frame_info): Rename "unwind_cache" to "prologue_cache". + * frame.c (create_sentinel_frame): Update. Initialize + "prologue_cache" instead of "unwind_cache". + (frame_register_unwind): Call this frame's prev_register with the + next frame and this frame's prologue cache. + (get_prev_frame): Simplify. Always call prev frame's this_id with + this frame and prev frame's prologue cache. Document that this + call is shifted one to the left when compared to the + frame_register_unwind call. + (legacy_saved_regs_prev_register): Replace + frame_saved_regs_register_unwind. + (legacy_saved_regs_this_id): Replace frame_saved_regs_id_unwind. + (legacy_saved_regs_unwinder): Replace trad_frame_unwinder. + (legacy_saved_regs_unwind): Replace trad_frame_unwind. + * d10v-tdep.c (d10v_frame_this_id): Replace d10v_frame_id_unwind. + (d10v_frame_unwind): Update. + (d10v_frame_prev_register): Replace d10v_frame_register_unwind. + (d10v_frame_unwind_cache): Replace this "fi" with "next_frame". + (saved_regs_unwinder): Replace this "frame" with "next_frame", and + "saved_regs" with "this_saved_regs". + +2003-03-16 Andrew Cagney <cagney@redhat.com> + + * frame.c (frame_pop): Don't call target_store_registers. Fix + problem reported by Mark Kettenis. + +2003-03-16 Mark Kettenis <kettenis@gnu.org> + + * i386-tdep.c (i386_register_type): Renamed from + i386_register_virtual_type. Adjust function signature. + (i386_gdbarch_init): Set register_type instead of + deprecated_max_register_raw_size, + deprecated_max_register_virtual_size and register_virtual_type. + +2003-03-14 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): When a legacy frame, always call + legacy_get_prev_frame. Simplify unwind code using assumption that + the unwinder is new. + (legacy_get_prev_frame): Handle legacy sentinel frame unwind here. + (legacy_frame_p): When no gdbarch_unwind_dummy_id, or + SAVED_DUMMY_FRAME_TOS, assume a legacy frame. + +2003-03-14 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_saved_register): Delete function. + * frame.h (get_saved_register): Delete declaration. + * xstormy16-tdep.c: Update comment. + * regcache.h: Update comments. + * sparc-tdep.c (sparc_init_extra_frame_info): Instead of + get_saved_register and extract_address, use + frame_read_unsigned_register. + (sparc_frame_saved_pc): Ditto. + (sparc_get_saved_register): Instead of get_saved_register, use + frame_register. + (sparc_pop_frame): Ditto. + * findvar.c: Update comments. + (value_of_register): Call frame_register instead of + get_saved_register. + (value_from_register): Ditto. + * config/sparc/tm-sparc.h: Update comment. + * breakpoint.c: Update comment. + +2003-03-14 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_GET_SAVED_REGISTER): Replace + GET_SAVED_REGISTER. + * gdbarch.h, gdbarch.c: Re-generate. + * frame.h: Update comments. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * frame.c (frame_register): Update. + (get_saved_register): Update. + * config/sparc/tm-sparc.h (DEPRECATED_GET_SAVED_REGISTER): Update. + +2003-03-13 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_POP_FRAME): Replace POP_FRAME. + * gdbarch.h, gdbarch.c: Regenerate. + * valops.c (hand_function_call): Update comment. + * stack.c (return_command): Update comment. + * config/sparc/tm-sparc.h (DEPRECATED_POP_FRAME): Update. + * config/pa/tm-hppa.h (DEPRECATED_POP_FRAME): Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2003-03-13 Andrew Cagney <cagney@redhat.com> + + * frame.c (legacy_frame_p): New function. + (get_prev_frame): Use legacy_frame_p. + * frame.h (legacy_frame_p): Declare. + +2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com> + + * MAINTAINERS (write after approval): Alphabetically + listing corrected. + +2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com> + + * MAINTAINERS (write after approval): Add myself. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_prev_frame): Rename the frame parameter to + "this_frame". + (get_next_frame, legacy_get_prev_frame): Ditto. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * frame.c (get_current_frame): Check target_has_registers before + checking target_has_stack. + * eval.c (evaluate_subexp_standard): Use get_selected_frame, + instead of deprecated_selected_frame. + * findvar.c (value_of_register): Pass "frame", not + deprecated_selected_frame, to value_of_builtin_reg. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * regcache.c (regcache_cooked_write_signed): New function. + (regcache_cooked_write_unsigned): New function. + (regcache_cooked_read_unsigned): Fix regnum in range assertion. + (regcache_cooked_read_signed): Fix regnum in range assertion. + * regcache.h (regcache_cooked_write_signed): Declare. + (regcache_cooked_write_unsigned): Declare. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.h: Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ppc-linux-tdep.c (ppc_linux_init_abi): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * i386-interix-tdep.c (i386_interix_init_abi): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * sh-tdep.c (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * ns32knbsd-nat.c (frame_num_args): Update. + * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update. + * xstormy16-tdep.c (xstormy16_pop_frame): Update. + (xstormy16_frame_chain_valid): Update. + * vax-tdep.c (vax_saved_pc_after_call): Update. + * v850-tdep.c (v850_frame_chain): Update. + (v850_pop_frame): Update. + (v850_init_extra_frame_info): Update. + * sparc-tdep.c (setup_arbitrary_frame): Update. + * ns32k-tdep.c (umax_frame_num_args): Update. + * s390-tdep.c (s390_pop_frame_regular): Update. + * mn10300-tdep.c (mn10300_frame_chain): Update. + (mn10300_pop_frame_regular): Update. + (mn10300_init_extra_frame_info): Update. + * mips-tdep.c (mips_init_frame_pc_first): Update. + (mips_frame_chain): Update. + (mips_pop_frame): Update. + * mcore-tdep.c (mcore_frame_chain): Update. + (mcore_pop_frame): Update. + (mcore_init_extra_frame_info): Update. + * arch-utils.c (init_frame_pc_default): Update. + * m68k-tdep.c (isi_frame_num_args): Update. + (delta68_frame_num_args): Update. + (news_frame_num_args): Update. + * ia64-tdep.c (ia64_pop_frame_regular): Update. + * alpha-tdep.c (alpha_init_frame_pc_first): Update. + (alpha_frame_chain): Update. + (alpha_pop_frame): Update. + * hppa-tdep.c (hppa_saved_pc_after_call): Update. + (hppa_init_extra_frame_info): Update. + (hppa_frame_chain): Update. + (hppa_frame_chain_valid): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_init_extra_frame_info): Update. + * arm-tdep.c (arm_frame_chain_valid): Update. + (arm_init_extra_frame_info): Update. + (arm_pop_frame): Update. + * frame.c (frame_pc_unwind): Update. + * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update. + (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + Eliminate the need for POP_FRAME. + * frame.c (do_frame_unwind_register): New function. + (frame_pop): When no POP_FRAME, pop the frame using register + unwind and a scratch regcache. + (frame_saved_regs_pop): Delete function. + (trad_frame_unwinder): Update. + * d10v-tdep.c (d10v_frame_pop): Delete function. + (d10v_frame_unwind): Update. + * sentinel-frame.c (sentinel_frame_pop): Delete function. + (sentinel_frame_unwinder): Update. + * dummy-frame.c (dummy_frame_pop): Delete function. + (dummy_frame_unwind): Update. + * frame-unwind.h (frame_unwind_pop_ftype): Delete definition. + (struct frame_unwind): Update. + +2003-03-11 Kevin Buettner <kevinb@redhat.com> + + * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to + mips_dwarf_dwarf2_ecoff_reg_to_regnum(). + (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum): + Do range checks on register number obtained from debugging info. + (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and + set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of + set_gdbarch_ecoff_reg_to_regnum() to account for new name of + mapping function. + (do_fp_register_row): Fix typo which caused double type to be + used when attempting to unpack a float. + +2003-03-11 J. Brobecker <brobecker@gnat.com> + + * breakpoint.c (bpstat_stop_status): Fix a small memory leak. + +2003-03-11 Andrew Cagney <cagney@redhat.com> + + * frame.c (deprecated_update_frame_pc_hack): Don't assume a next + frame. Problem found by Corinna Vinschen. + +2003-03-11 Pierre Muller <muller@ics.u-strasbg.fr> + + * doublest.c (floatformat_from_length): Accept also + the real size of 'long double' type. + +2003-03-10 Daniel Jacobowitz <drow@mvista.com> + + From Klee Dienes <kdienes@apple.com>: + * breakpoint.c (bpstat_copy): Copy the command lines as well + as the old value, to match what is freed in bpstat_clear. + +2003-03-10 David Carlton <carlton@math.stanford.edu> + + * minsyms.c (add_minsym_to_hash_table): Replace + DEPRECATED_SYMBOL_NAME by SYMBOL_LINKAGE_NAME. + (compare_minimal_symbols, compact_minimal_symbols) + (install_minimal_symbols, find_solib_trampoline_target): Ditto. + (lookup_minimal_symbol_text): Use strcmp on linkage names instead + of DEPRECATED_SYMBOL_MATCHES_NAME. + (lookup_minimal_symbol_solib_trampoline): Ditto. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * regcache.h (regcache_cooked_read_ftype): Define. + (regcache_save, regcache_restore): Add a cooked_read parameter. + * regcache.c (regcache_save, regcache_restore): Update. + (do_cooked_read): New function. + (regcache_cpy): Pass do_cooked_read to regcache_save and + regcache_restore. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC. + * gdbarch.h, gdbarch.c: Re-generate. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * x86-64-tdep.h: Update. + * x86-64-tdep.c (x86_64_init_abi): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * ppc-linux-tdep.c (ppc_linux_init_abi): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * mn10300-tdep.c (mn10300_gdbarch_init): Update. + * mips-tdep.c (mips_gdbarch_init): Update. + * mcore-tdep.c (mcore_gdbarch_init): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * i386-tdep.c (i386_gdbarch_init): Update. + * i386-interix-tdep.c (i386_interix_init_abi): Update. + * hppa-tdep.c (hppa_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + * sh-tdep.c (sh_init_extra_frame_info): Update. + (sh64_init_extra_frame_info): Update. + * ns32knbsd-nat.c (frame_num_args): Update. + * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update. + * xstormy16-tdep.c (xstormy16_pop_frame): Update. + (xstormy16_frame_chain_valid): Update. + * vax-tdep.c (vax_saved_pc_after_call): Update. + * v850-tdep.c (v850_frame_chain): Update. + (v850_pop_frame): Update. + (v850_init_extra_frame_info): Update. + * sparc-tdep.c (setup_arbitrary_frame): Update. + * ns32k-tdep.c (umax_frame_num_args): Update. + * s390-tdep.c (s390_pop_frame_regular): Update. + * mn10300-tdep.c (mn10300_frame_chain): Update. + (mn10300_pop_frame_regular): Update. + (mn10300_init_extra_frame_info): Update. + * mips-tdep.c (mips_init_frame_pc_first): Update. + (mips_frame_chain): Update. + (mips_pop_frame): Update. + * mcore-tdep.c (mcore_frame_chain): Update. + (mcore_pop_frame): Update. + (mcore_init_extra_frame_info): Update. + * arch-utils.c (init_frame_pc_default): Update. + * m68k-tdep.c (isi_frame_num_args): Update. + (delta68_frame_num_args): Update. + (news_frame_num_args): Update. + * ia64-tdep.c (ia64_pop_frame_regular): Update. + * alpha-tdep.c (alpha_init_frame_pc_first): Update. + (alpha_frame_chain): Update. + (alpha_pop_frame): Update. + * hppa-tdep.c (hppa_saved_pc_after_call): Update. + (hppa_init_extra_frame_info): Update. + (hppa_frame_chain): Update. + (hppa_frame_chain_valid): Update. + * cris-tdep.c (cris_init_extra_frame_info): Update. + * avr-tdep.c (avr_init_extra_frame_info): Update. + * arm-tdep.c (arm_frame_chain_valid): Update. + (arm_init_extra_frame_info): Update. + (arm_pop_frame): Update. + * frame.c (frame_pc_unwind): Update. + * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update. + (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update. + * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update. + * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh (gdbarch_unwind_pc): New method. + * gdbarch.h, gdbarch.c: Regenerate. + * frame.c (frame_pc_unwind): Rewrite. Prefer gdbarch_unwind_pc, + but use read_pc and FRAME_SAVED_PC as fall backs. + (frame_saved_regs_pc_unwind): Delete function. + (trad_frame_unwinder): Update. + * frame-unwind.h (frame_unwind_pc_ftype): Delete declaration. + (struct frame_unwind): Update. + * dummy-frame.c (dummy_frame_pc_unwind): Delete function. + (dummy_frame_unwind): Update. + * sentinel-frame.c (sentinel_frame_pc_unwind): Delete function. + (sentinel_frame_unwinder): Update. + * d10v-tdep.c (d10v_frame_pc_unwind): Delete function. + (d10v_frame_unwind): Update. + (d10v_unwind_pc): New function. + (d10v_gdbarch_init): Set unwind_pc. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbarch.h: Re-generate. + + * d10v-tdep.c (d10v_frame_register_unwind): Correctly unwind the + PC. + (d10v_frame_pop): Unwind the PC, and not the LR, when restoring + the PC register. + +2003-03-08 Mark Kettenis <kettenis@gnu.org> + + * gdbarch.sh (save_dummy_frame_tos): Add comment. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * cli-out.c: Update copyright. + (cli_out_data): Define typedef. Use instead of ui_out_data. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * valarith.c (value_subscripted_rvalue): Copy the array's REGNO to + the result. + +2003-03-07 Andrew Cagney <cagney@redhat.com> + + * gdbarch.sh: Don't generate two macro definitions when an + undefined macro taking no arguments. + * gdbarch.h: Regenerate. + +2002-03-07 Michal Ludvig <mludvig@suse.cz> + + * x86-64-tdep.c (x86_64_save_dummy_frame_tos) + (x86_64_unwind_dummy_id): New functions. + (x86_64_init_abi): Register these two new functions. + +2003-03-07 Michal Ludvig <mludvig@suse.cz> + + * x86-64-tdep.c (x86_64_function_has_prologue): New function. + (x86_64_skip_prologue): Move prologue detection to + separate function. + * x86-64-tdep.h (x86_64_function_has_prologue): New prototype. + +2003-03-05 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (d10v_unwind_dummy_id): New function. + (d10v_gdbarch_init): Set unwind_dummy_id and save_dummy_frame_tos. + * frame.c (get_prev_frame): Restructure the frame ID unwind code + to use unwind_dummy_id when a dummy frame. + * gdbarch.sh (unwind_dummy_id): New multi-arch method with + predicate. + * gdbarch.h, gdbarch.c: Regneerate. + +2003-03-05 Andrew Cagney <cagney@redhat.com> + + * d10v-tdep.c (struct d10v_unwind_cache): Add field "base". + (d10v_frame_unwind_cache): Rewrite code computing the base and SP. + Do not use d10v_read_sp or d10v_read_fp when obtaining register + values. + 2003-03-10 David Carlton <carlton@math.stanford.edu> * buildsym.c (scan_for_anonymous_namespaces): Allow @@ -426,7 +2546,6 @@ * f-lang.c (build_fortran_types): New function. (_initialize_f_language): Gdbarch-register built-in fortran types. - * doublest.c (extract_floating): Fix warning text. 2003-02-27 Andrew Cagney <cagney@redhat.com> @@ -986,7 +3105,6 @@ * gdbtypes.c (make_qualified_type): Set length on newly created type. (replace_type): Set length on all type variants for a given type. ->>>>>>> 1.3924 2003-02-27 David Carlton <carlton@math.stanford.edu> * symtab.c (lookup_symbol_aux_namespace_scope): Rename from diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 6315888..15a0ea8 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -63,7 +63,6 @@ maintainer works with the native maintainer when resolving API issues. arc Deleted. arm --target=arm-elf ,-Werror - Fernando Nasser fnasser@redhat.com Scott Bambrough scottb@netwinder.org Richard Earnshaw rearnsha@arm.com @@ -225,7 +224,6 @@ generic symtabs Jim Blandy jimb@redhat.com xcoff reader Any maintainer can modify this; please send tricky ones to Kevin Buettner <kevinb@redhat.com> linespec Elena Zannoni ezannoni@redhat.com - Fernando Nasser fnasser@redhat.com HP/UX readers Any [past] maintainer can modify this. Please send tricky ones to the symtabs maintainers. @@ -245,12 +243,13 @@ shared libs (devolved) Kevin Buettner kevinb@redhat.com remote.c Andrew Cagney cagney@redhat.com include/remote-sim.h, remote-sim.c Andrew Cagney cagney@redhat.com -sds protocol Fernando Nasser fnasser@redhat.com -rdi/adp protocol Fernando Nasser fnasser@redhat.com +sds protocol (vacant) +rdi/adp protocol (vacant) documentation Eli Zaretskii eliz@gnu.org -testsuite Fernando Nasser fnasser@redhat.com +testsuite (Global Maintainers) config Mark Salter msalter@redhat.com - lib Mark Salter msalter@redhat.com + lib Fernando Nasser fnasser@redhat.com + Mark Salter msalter@redhat.com gdbtk (gdb.gdbtk) Keith Seitz keiths@redhat.com c++ (gdb.c++) Michael Chastain mec@shout.net David Carlton carlton@math.stanford.edu @@ -266,7 +265,7 @@ Kernel Object Display Fernando Nasser fnasser@redhat.com UI: External (user) interfaces. -command interpreter Fernando Nasser fnasser@redhat.com +command interpreter (Global Maintainers) gdbtk (c & tcl) Jim Ingham jingham@apple.com Fernando Nasser fnasser@redhat.com Keith Seitz keiths@redhat.com @@ -275,8 +274,8 @@ libgui (w/foundry, sn) Jim Ingham jingham@apple.com mi (gdb/mi) Andrew Cagney cagney@redhat.com Elena Zannoni ezannoni@redhat.com Fernando Nasser fnasser@redhat.com -tui (vacant) - Technical Contact Point wdb@cup.hp.com +tui Stephane Carrez stcarrez@nerim.fr + (Global Maintainers) Misc: @@ -368,6 +367,7 @@ Hans-Peter Nilsson hp@bitrange.com David O'Brien obrien@freebsd.org Alexandre Oliva aoliva@redhat.com Tom Rix trix@redhat.com +Bob Rossi bob_rossi@cox.net Theodore A. Roth troth@verinet.com Ian Roxborough irox@redhat.com Grace Sainsbury graces@redhat.com @@ -386,6 +386,7 @@ Petr Sorfa petrs@caldera.com Gary Thomas gthomas@redhat.com Jason Thorpe thorpej@wasabisystems.com Tom Tromey tromey@redhat.com +D Venkatasubramanian dvenkat@noida.hcltech.com Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com Kris Warkentin kewarken@qnx.com diff --git a/gdb/Makefile.in b/gdb/Makefile.in index ddc1e66..dffb8aa 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -168,14 +168,14 @@ SUBDIR_CLI_UNINSTALL= SUBDIR_MI_OBS = \ mi-out.o mi-console.o \ mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \ - mi-cmd-disas.o \ + mi-cmd-file.o mi-cmd-disas.o \ mi-interp.o \ mi-main.o mi-parse.o mi-getopt.o SUBDIR_MI_SRCS = \ mi/mi-out.c mi/mi-console.c \ mi/mi-cmds.c mi/mi-cmd-env.c \ mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \ - mi/mi-cmd-disas.c \ + mi/mi-cmd-file.c mi/mi-cmd-disas.c \ mi/mi-interp.c \ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c SUBDIR_MI_DEPS = @@ -512,11 +512,12 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ c-exp.y c-lang.c c-typeprint.c c-valprint.c \ charset.c cli-out.c coffread.c coff-pe-read.c \ complaints.c completer.c corefile.c \ - cp-abi.c cp-support.c cp-valprint.c \ + cp-abi.c cp-support.c cp-namespace.c cp-valprint.c \ dbxread.c demangle.c dictionary.c disasm.c doublest.c \ dummy-frame.c dwarfread.c dwarf2expr.c dwarf2loc.c dwarf2read.c \ elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \ f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \ + frame-base.c \ frame-unwind.c \ gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ hpacc-abi.c \ @@ -566,10 +567,14 @@ callback_h = $(INCLUDE_DIR)/gdb/callback.h coff_sym_h = $(INCLUDE_DIR)/coff/sym.h coff_symconst_h = $(INCLUDE_DIR)/coff/symconst.h coff_ecoff_h = $(INCLUDE_DIR)/coff/ecoff.h +coff_internal_h = $(INCLUDE_DIR)/coff/internal.h dis_asm_h = $(INCLUDE_DIR)/dis-asm.h +elf_reloc_macros_h = $(INCLUDE_DIR)/elf/reloc-macros.h elf_sh_h = $(INCLUDE_DIR)/elf/sh.h +elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h) elf_bfd_h = $(BFD_SRC)/elf-bfd.h libaout_h = $(BFD_SRC)/libaout.h +libbfd_h = $(BFD_SRC)/libbfd.h remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h demangle_h = $(INCLUDE_DIR)/demangle.h obstack_h = $(INCLUDE_DIR)/obstack.h @@ -638,7 +643,8 @@ event_top_h = event-top.h expression_h = expression.h $(symtab_h) $(doublest_h) f_lang_h = f-lang.h frame_h = frame.h -frame_unwind_h = frame-unwind.h +frame_unwind_h = frame-unwind.h $(frame_h) +frame_base_h = frame-base.h gdb_events_h = gdb-events.h gdb_stabs_h = gdb-stabs.h gdb_h = gdb.h @@ -720,6 +726,7 @@ symtab_h = symtab.h target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h) terminal_h = terminal.h top_h = top.h +infttrace_h = infttrace.h tracepoint_h = tracepoint.h typeprint_h = typeprint.h ui_file_h = ui-file.h @@ -856,7 +863,9 @@ COMMON_OBS = version.o block.o blockframe.o breakpoint.o findvar.o regcache.o \ nlmread.o serial.o mdebugread.o top.o utils.o \ ui-file.o \ frame.o frame-unwind.o doublest.o \ + frame-base.o \ gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o \ + cp-namespace.o \ reggroups.o OBS = $(COMMON_OBS) $(ANNOTATE_OBS) @@ -872,6 +881,7 @@ YYFILES = c-exp.tab.c \ jv-exp.tab.c \ f-exp.tab.c m2-exp.tab.c p-exp.tab.c YYOBJ = c-exp.tab.o \ + objc-exp.tab.o \ jv-exp.tab.o \ f-exp.tab.o m2-exp.tab.o p-exp.tab.o @@ -967,6 +977,13 @@ uninstall: force $(CONFIG_UNINSTALL) # everything else. The catch is that other modules still take the # address of these builtin types forcing them to be variables, sigh! +# NOTE: cagney/2003-03-18: The sed pattern ``s|^\([^ /]...'' is +# anchored on the first column and excludes the ``/'' character so +# that it doesn't add the $(srcdir) prefix to any file that already +# has an absolute path. It turns out that $(DEC)'s True64 make +# automatically adds the $(srcdir) prefixes when it encounters files +# in sub-directories such as cli/ and mi/. + INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS) init.c: $(INIT_FILES) @echo Making init.c @@ -986,7 +1003,7 @@ init.c: $(INIT_FILES) -e '/[a-z0-9A-Z_]*-exp.tab.o/d' \ -e 's/\.o/.c/' \ -e 's,signals\.c,signals/signals\.c,' \ - -e 's|\([^ ][^ ]*\)|$(srcdir)/\1|g' | \ + -e 's|^\([^ /][^ ]*\)|$(srcdir)/\1|g' | \ while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \ sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \ ( echo _initialize_gdbtypes ; grep -v '^_initialize_gdbtypes$$' ) > init.l-tmp @@ -1345,7 +1362,7 @@ ALLDEPFILES = \ hppa-tdep.c hppa-hpux-tdep.c \ hppab-nat.c hppah-nat.c hpread.c \ i386-tdep.c i386b-nat.c i386v-nat.c i386-linux-nat.c \ - i386v4-nat.c i386ly-tdep.c \ + i386v4-nat.c i386ly-tdep.c i386-cygwin-tdep.c \ i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c \ i387-tdep.c \ i386-linux-tdep.c i386-nat.c \ @@ -1492,7 +1509,7 @@ alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \ alpha-nat.o: alpha-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(regcache_h) $(alpha_tdep_h) $(gregset_h) $(gdb_string_h) alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \ - $(value_h) $(alpha_tdep_h) $(osabi_h) + $(value_h) $(osabi_h) $(gdb_string_h) $(alpha_tdep_h) alpha-tdep.o: alpha-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ $(value_h) $(gdbcmd_h) $(gdbcore_h) $(dis_asm_h) $(symfile_h) \ $(objfiles_h) $(gdb_string_h) $(linespec_h) $(regcache_h) \ @@ -1522,9 +1539,9 @@ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ $(osabi_h) arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \ $(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \ - $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) \ - $(arm_tdep_h) $(gdb_sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \ - $(elf_arm_h) $(gdb_assert_h) $(bfd_in2_h) $(libcoff_h) $(osabi_h) + $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) $(osabi_h) \ + $(arm_tdep_h) $(sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \ + $(elf_arm_h) $(gdb_assert_h) armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \ $(regcache_h) $(gdbcore_h) armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(arm_tdep_h) $(nbsd_tdep_h) \ @@ -1554,13 +1571,13 @@ buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \ $(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \ $(bcache_h) $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \ - $(stabsread_h) $(block_h) $(dictionary_h) $(cp_support_h) \ - $(stabsread_h) $(block_h) + $(stabsread_h) $(block_h) $(dictionary_h) $(cp_support_h) builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(gdb_assert_h) c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \ - $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) + $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \ + $(demangle_h) c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ @@ -1601,8 +1618,10 @@ corelow.o: corelow.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ $(gdbthread_h) $(regcache_h) $(symfile_h) $(readline_h) cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) \ $(gdbcmd_h) $(ui_out_h) $(gdb_string_h) +cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \ + $(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h) cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \ - $(demangle_h) $(gdb_obstack_h) $(gdb_assert_h) $(symtab_h) \ + $(demangle_h) $(gdb_assert_h) $(gdb_obstack_h) $(symtab_h) \ $(symfile_h) $(block_h) $(objfiles_h) $(gdbtypes_h) $(dictionary_h) \ $(gdbcmd_h) cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \ @@ -1615,10 +1634,11 @@ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \ $(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \ $(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \ $(solib_h) $(solib_svr4_h) $(gdb_string_h) -d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \ - $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) $(inferior_h) \ - $(dis_asm_h) $(symfile_h) $(objfiles_h) $(language_h) $(arch_utils_h) \ - $(regcache_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \ +d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ + $(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \ + $(gdb_string_h) $(value_h) $(inferior_h) $(dis_asm_h) $(symfile_h) \ + $(objfiles_h) $(language_h) $(arch_utils_h) $(regcache_h) \ + $(remote_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \ $(gdb_assert_h) dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(regcache_h) $(m68k_tdep_h) @@ -1658,7 +1678,7 @@ dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \ $(symfile_h) $(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) \ $(demangle_h) $(expression_h) $(filenames_h) $(macrotab_h) \ $(language_h) $(complaints_h) $(bcache_h) $(dwarf2expr_h) \ - $(dwarf2loc_h) $(gdb_string_h) $(gdb_assert_h) $(cp_support_h) + $(dwarf2loc_h) $(cp_support_h) $(gdb_string_h) $(gdb_assert_h) dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \ $(objfiles_h) $(elf_dwarf_h) $(buildsym_h) $(demangle_h) \ $(expression_h) $(language_h) $(complaints_h) $(gdb_string_h) @@ -1701,9 +1721,10 @@ fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \ $(terminal_h) $(gdbthread_h) $(command_h) frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(builtin_regs_h) \ - $(gdb_obstack_h) $(dummy_frame_h) $(gdbcore_h) $(annotate_h) \ - $(language_h) $(frame_unwind_h) $(command_h) $(gdbcmd_h) \ - $(sentinel_frame_h) + $(gdb_obstack_h) $(dummy_frame_h) $(sentinel_frame_h) $(gdbcore_h) \ + $(annotate_h) $(language_h) $(frame_unwind_h) $(frame_base_h) \ + $(command_h) $(gdbcmd_h) +frame-base.o: frame-base.c $(defs_h) $(frame_base_h) $(frame_h) frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(gdb_assert_h) $(dummy_frame_h) $(legacy_frame_h) frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ @@ -1743,11 +1764,12 @@ h8500-tdep.o: h8500-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \ hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \ $(gdbtypes_h) $(gdbcore_h) $(cp_abi_h) hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \ - $(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \ + $(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \ + $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(a_out_encap_h) \ $(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \ - $(symfile_h) $(objfiles_h) $(language_h) $(osabi_h) + $(symfile_h) $(objfiles_h) hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \ - $(osabi_h) + $(osabi_h) $(gdb_string_h) hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h) hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(gdb_wait_h) $(regcache_h) @@ -1756,7 +1778,7 @@ hppam3-nat.o: hppam3-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \ $(syms_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \ $(complaints_h) $(gdb_stabs_h) $(gdbtypes_h) $(demangle_h) \ - $(gdb_string_h) + $(somsolib_h) $(gdb_assert_h) $(gdb_string_h) hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \ $(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ @@ -1788,6 +1810,8 @@ i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(i386_tdep_h) $(osabi_h) i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h) +i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \ + $(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h) i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \ $(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \ $(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h) @@ -1827,11 +1851,12 @@ infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \ $(inferior_h) $(breakpoint_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) \ $(cli_script_h) $(target_h) $(gdbthread_h) $(annotate_h) \ - $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) + $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) \ + $(observer_h) $(language_h) inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ $(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h) infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ - $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbcore_h) + $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbthread_h) $(gdbcore_h) interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \ $(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \ $(gdb_events_h) $(gdb_assert_h) $(top_h) @@ -1842,7 +1867,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \ - $(jv_lang_h) $(gdbcore_h) $(dictionary_h) $(block_h) + $(jv_lang_h) $(gdbcore_h) $(dictionary_h) $(block_h) $(demangle_h) jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \ $(c_lang_h) $(cp_abi_h) @@ -1854,7 +1879,7 @@ kod.o: kod.c $(defs_h) $(command_h) $(gdbcmd_h) $(target_h) $(gdb_string_h) \ $(kod_h) language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \ - $(parser_defs_h) $(jv_lang_h) + $(parser_defs_h) $(jv_lang_h) $(demangle_h) lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ @@ -1939,10 +1964,11 @@ mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ $(solib_svr4_h) $(osabi_h) $(gdb_string_h) $(mips_tdep_h) \ $(gdb_assert_h) mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) -mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ - $(symtab_h) $(value_h) $(gdbcmd_h) $(language_h) $(gdbcore_h) \ - $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(target_h) $(arch_utils_h) \ - $(regcache_h) $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \ +mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \ + $(frame_h) $(inferior_h) $(symtab_h) $(value_h) $(gdbcmd_h) \ + $(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) \ + $(gdbtypes_h) $(target_h) $(arch_utils_h) $(regcache_h) \ + $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \ $(elf_mips_h) $(elf_bfd_h) $(symcat_h) mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h) mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ @@ -2110,7 +2136,7 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \ $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) $(gdb_stabs_h) \ $(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) $(gdb_assert_h) \ $(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \ - $(gdbcore_h) + $(gdbcore_h) $(solib_h) rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h) rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ @@ -2187,7 +2213,7 @@ somread.o: somread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ somsolib.o: somsolib.c $(defs_h) $(frame_h) $(bfd_h) $(som_h) $(libhppa_h) \ $(gdbcore_h) $(symtab_h) $(breakpoint_h) $(symfile_h) $(objfiles_h) \ $(inferior_h) $(gdb_stabs_h) $(gdb_stat_h) $(gdbcmd_h) $(language_h) \ - $(regcache_h) + $(regcache_h) $(gdb_assert_h) source.o: source.c $(defs_h) $(symtab_h) $(expression_h) $(language_h) \ $(command_h) $(source_h) $(gdbcmd_h) $(frame_h) $(value_h) \ $(gdb_string_h) $(gdb_stat_h) $(gdbcore_h) $(gdb_regex_h) \ @@ -2197,9 +2223,9 @@ sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h) sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(regcache_h) $(gdb_wait_h) sparc-stub.o: sparc-stub.c -sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ - $(inferior_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \ - $(regcache_h) $(osabi_h) $(gregset_h) $(gdbcore_h) $(symfile_h) +sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ + $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(regcache_h) \ + $(osabi_h) $(gregset_h) $(gdbcore_h) $(gdb_assert_h) $(symfile_h) sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(sparcnbsd_tdep_h) sparcl-stub.o: sparcl-stub.c @@ -2243,7 +2269,7 @@ symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \ symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \ $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \ $(gdb_obstack_h) $(language_h) $(bcache_h) $(gdb_string_h) \ - $(readline_h) $(block_h) $(dictionary_h) + $(readline_h) $(block_h) $(gdb_regex_h) $(dictionary_h) symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \ $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \ @@ -2536,6 +2562,10 @@ mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \ $(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \ $(mi_getopt_h) $(gdb_events_h) $(gdb_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c +mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.c $(defs_h) $(mi_cmds_h) \ + $(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \ + $(mi_getopt_h) $(gdb_events_h) $(gdb_h) + $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-file.c mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \ $(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c @@ -41,6 +41,15 @@ Mitsubishi M32R/D w/simulator m32r-*-elf* Z8000 simulator z8k-zilog-none or z8ksim Matsushita MN10200 w/simulator mn10200-*-* H8/500 simulator h8500-hitachi-hms or h8500hms +HP/PA running BSD hppa*-*-bsd* +HP/PA running OSF/1 hppa*-*-osf* +HP/PA Pro target hppa*-*-pro* +PMAX (MIPS) running Mach 3.0 mips*-*-mach3* +Sequent family i[3456]86-sequent-sysv4* + i[3456]86-sequent-sysv* + i[3456]86-sequent-bsd* +Tsqware Sparclet sparclet-*-* +Fujitsu SPARClite sparclite-fujitsu-none or sparclite * REMOVED configurations and files diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 97e8f2d..b484a5d 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -8025,6 +8025,8 @@ const struct language_defn ada_language_defn = { ada_print_type, /* Print a type using appropriate syntax */ ada_val_print, /* Print a value using appropriate syntax */ ada_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ #if 0 {"8#%lo#", "8#", "o", "#"}, /* Octal format info */ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index 45c156a..3f00b9a 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -20,6 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #if !defined (ADA_LANG_H) #define ADA_LANG_H 1 +struct partial_symbol; + #include "value.h" #include "gdbtypes.h" diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c index fa5bc5e..4eaa3c4 100644 --- a/gdb/alpha-osf1-tdep.c +++ b/gdb/alpha-osf1-tdep.c @@ -23,6 +23,7 @@ #include "gdbcore.h" #include "value.h" #include "osabi.h" +#include "gdb_string.h" #include "alpha-tdep.h" diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index b63a92f..44df63d 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -54,7 +54,6 @@ static gdbarch_register_convertible_ftype alpha_register_convertible; static gdbarch_register_convert_to_virtual_ftype alpha_register_convert_to_virtual; static gdbarch_register_convert_to_raw_ftype alpha_register_convert_to_raw; -static gdbarch_store_struct_return_ftype alpha_store_struct_return; static gdbarch_deprecated_extract_return_value_ftype alpha_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype alpha_extract_struct_value_address; @@ -66,12 +65,7 @@ static gdbarch_frame_args_address_ftype alpha_frame_args_address; static gdbarch_frame_locals_address_ftype alpha_frame_locals_address; static gdbarch_skip_prologue_ftype alpha_skip_prologue; -static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call; -static gdbarch_frame_chain_ftype alpha_frame_chain; -static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc; -static gdbarch_push_arguments_ftype alpha_push_arguments; -static gdbarch_pop_frame_ftype alpha_pop_frame; static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy; static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target; @@ -458,8 +452,10 @@ alpha_frame_init_saved_regs (struct frame_info *fi) static CORE_ADDR alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev) { - return (fromleaf ? SAVED_PC_AFTER_CALL (get_next_frame (prev)) - : get_next_frame (prev) ? FRAME_SAVED_PC (get_next_frame (prev)) + return (fromleaf + ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev)) + : get_next_frame (prev) + ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)) : read_pc ()); } @@ -559,10 +555,10 @@ heuristic_proc_start (CORE_ADDR pc) if (start_pc < fence) { /* It's not clear to me why we reach this point when - stop_soon_quietly, but with this test, at least we + stop_soon, but with this test, at least we don't print out warnings for every child forked (eg, on decstation). 22apr93 rich@cygnus.com. */ - if (!stop_soon_quietly) + if (stop_soon == NO_STOP_QUIETLY) { static int blurb_printed = 0; @@ -933,7 +929,7 @@ static CORE_ADDR alpha_frame_chain (struct frame_info *frame) { alpha_extra_func_info_t proc_desc; - CORE_ADDR saved_pc = FRAME_SAVED_PC (frame); + CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); if (saved_pc == 0 || inside_entry_file (saved_pc)) return 0; @@ -1304,7 +1300,7 @@ alpha_pop_frame (void) frame->proc_desc? If we do, who will free it? For now, we don't save a copy... */ - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); if (get_frame_saved_regs (frame) == NULL) alpha_find_saved_regs (frame); if (proc_desc) @@ -1464,8 +1460,8 @@ alpha_register_convert_to_virtual (int regnum, struct type *valtype, if (TYPE_CODE (valtype) == TYPE_CODE_FLT) { - double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum)); - store_floating (virtual_buffer, TYPE_LENGTH (valtype), d); + double d = deprecated_extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum)); + deprecated_store_floating (virtual_buffer, TYPE_LENGTH (valtype), d); } else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) { @@ -1490,8 +1486,8 @@ alpha_register_convert_to_raw (struct type *valtype, int regnum, if (TYPE_CODE (valtype) == TYPE_CODE_FLT) { - double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype)); - store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d); + double d = deprecated_extract_floating (virtual_buffer, TYPE_LENGTH (valtype)); + deprecated_store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d); } else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) { @@ -1840,32 +1836,30 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call); - set_gdbarch_frame_chain (gdbarch, alpha_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, alpha_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, alpha_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, alpha_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs); set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value); - set_gdbarch_store_struct_return (gdbarch, alpha_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, alpha_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, alpha_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, alpha_extract_struct_value_address); /* Settings for calling functions in the inferior. */ set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, alpha_push_arguments); - set_gdbarch_pop_frame (gdbarch, alpha_pop_frame); + set_gdbarch_deprecated_push_arguments (gdbarch, alpha_push_arguments); + set_gdbarch_deprecated_pop_frame (gdbarch, alpha_pop_frame); /* On the Alpha, the call dummy code is never copied to user space, stopping the user call is achieved via a bp_call_dummy breakpoint. But we need a fake CALL_DUMMY definition to enable the proper call_function_by_hand and to avoid zero length array warnings. */ - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, alpha_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); set_gdbarch_frame_args_address (gdbarch, alpha_frame_args_address); @@ -1876,12 +1870,10 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all argument handling and bp_call_dummy takes care of stopping the dummy. */ set_gdbarch_call_dummy_address (gdbarch, alpha_call_dummy_address); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_deprecated_push_dummy_frame (gdbarch, alpha_push_dummy_frame); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy); set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 1016ba1..825bd5c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -383,10 +383,10 @@ init_frame_pc_noop (int fromleaf, struct frame_info *prev) CORE_ADDR init_frame_pc_default (int fromleaf, struct frame_info *prev) { - if (fromleaf) - return SAVED_PC_AFTER_CALL (get_next_frame (prev)); + if (fromleaf && DEPRECATED_SAVED_PC_AFTER_CALL_P ()) + return DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev)); else if (get_next_frame (prev) != NULL) - return FRAME_SAVED_PC (get_next_frame (prev)); + return DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)); else return read_pc (); } diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 3452fc8..f3874a0 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -22,6 +22,12 @@ #ifndef GDBARCH_UTILS_H #define GDBARCH_UTILS_H +struct gdbarch; +struct frame_info; +struct minimal_symbol; +struct type; +struct gdbarch_info; + /* gdbarch trace variable */ extern int gdbarch_debug; diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 1ebe600..91fa88f 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -181,10 +181,10 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len) { DOUBLEST dblval; - dblval = extract_floating (val, len); + dblval = deprecated_extract_floating (val, len); len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT; val = alloca (len); - store_floating (val, len, dblval); + deprecated_store_floating (val, len, dblval); } /* If the argument is a pointer to a function, and it is a Thumb @@ -406,7 +406,7 @@ skip_hurd_resolver (CORE_ADDR pc) = lookup_minimal_symbol ("fixup", NULL, objfile); if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) - return (SAVED_PC_AFTER_CALL (get_current_frame ())); + return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ())); } return 0; @@ -525,6 +525,8 @@ arm_linux_init_abi (struct gdbarch_info info, tdep->arm_breakpoint = arm_linux_arm_le_breakpoint; tdep->arm_breakpoint_size = sizeof (arm_linux_arm_le_breakpoint); + tdep->fp_model = ARM_FLOAT_FPA; + tdep->jb_pc = ARM_LINUX_JB_PC; tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; @@ -534,7 +536,7 @@ arm_linux_init_abi (struct gdbarch_info info, /* The following two overrides shouldn't be needed. */ set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value); - set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, arm_linux_push_arguments); /* Shared library handling. */ set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 11b2350..0a029e8 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -28,7 +28,7 @@ #include "gdbcore.h" #include "symfile.h" #include "gdb_string.h" -#include "dis-asm.h" /* For register flavors. */ +#include "dis-asm.h" /* For register styles. */ #include "regcache.h" #include "doublest.h" #include "value.h" @@ -99,8 +99,27 @@ static int arm_debug; #define MSYMBOL_SIZE(msym) \ ((long) MSYMBOL_INFO (msym) & 0x7fffffff) +/* The list of available "set arm ..." and "show arm ..." commands. */ +static struct cmd_list_element *setarmcmdlist = NULL; +static struct cmd_list_element *showarmcmdlist = NULL; + +/* The type of floating-point to use. Keep this in sync with enum + arm_float_model, and the help string in _initialize_arm_tdep. */ +static const char *fp_model_strings[] = +{ + "auto", + "softfpa", + "fpa", + "softvfp", + "vfp" +}; + +/* A variable that can be configured by the user. */ +static enum arm_float_model arm_fp_model = ARM_FLOAT_AUTO; +static const char *current_fp_model = "auto"; + /* Number of different reg name sets (options). */ -static int num_flavor_options; +static int num_disassembly_options; /* We have more registers than the disassembler as gdb can print the value of special registers as well. @@ -118,19 +137,19 @@ static char * arm_register_name_strings[] = "fps", "cpsr" }; /* 24 25 */ static char **arm_register_names = arm_register_name_strings; -/* Valid register name flavors. */ -static const char **valid_flavors; +/* Valid register name styles. */ +static const char **valid_disassembly_styles; -/* Disassembly flavor to use. Default to "std" register names. */ -static const char *disassembly_flavor; +/* Disassembly style to use. Default to "std" register names. */ +static const char *disassembly_style; /* Index to that option in the opcodes table. */ static int current_option; /* This is used to keep the bfd arch_info in sync with the disassembly - flavor. */ -static void set_disassembly_flavor_sfunc(char *, int, + style. */ +static void set_disassembly_style_sfunc(char *, int, struct cmd_list_element *); -static void set_disassembly_flavor (void); +static void set_disassembly_style (void); static void convert_from_extended (const struct floatformat *, const void *, void *); @@ -159,7 +178,7 @@ struct frame_extra_info static int arm_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) { - return (FRAME_SAVED_PC (thisframe) >= LOWEST_PC); + return (DEPRECATED_FRAME_SAVED_PC (thisframe) >= LOWEST_PC); } /* Set to true if the 32-bit mode is in use. */ @@ -276,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi) stmdb sp!, {} sub sp, ip, #4. */ - func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET); + func_start = (get_frame_func (fi) + FUNCTION_START_OFFSET); after_prologue = SKIP_PROLOGUE (func_start); /* There are some frameless functions whose first two instructions @@ -642,60 +661,6 @@ thumb_scan_prologue (struct frame_info *fi) } } -/* Check if prologue for this frame's PC has already been scanned. If - it has, copy the relevant information about that prologue and - return non-zero. Otherwise do not copy anything and return zero. - - The information saved in the cache includes: - * the frame register number; - * the size of the stack frame; - * the offsets of saved regs (relative to the old SP); and - * the offset from the stack pointer to the frame pointer - - The cache contains only one entry, since this is adequate for the - typical sequence of prologue scan requests we get. When performing - a backtrace, GDB will usually ask to scan the same function twice - in a row (once to get the frame chain, and once to fill in the - extra frame information). */ - -static struct frame_info *prologue_cache; - -static int -check_prologue_cache (struct frame_info *fi) -{ - int i; - - if (get_frame_pc (fi) == get_frame_pc (prologue_cache)) - { - get_frame_extra_info (fi)->framereg = get_frame_extra_info (prologue_cache)->framereg; - get_frame_extra_info (fi)->framesize = get_frame_extra_info (prologue_cache)->framesize; - get_frame_extra_info (fi)->frameoffset = get_frame_extra_info (prologue_cache)->frameoffset; - for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) - get_frame_saved_regs (fi)[i] = get_frame_saved_regs (prologue_cache)[i]; - return 1; - } - else - return 0; -} - - -/* Copy the prologue information from fi to the prologue cache. */ - -static void -save_prologue_cache (struct frame_info *fi) -{ - int i; - - deprecated_update_frame_pc_hack (prologue_cache, get_frame_pc (fi)); - get_frame_extra_info (prologue_cache)->framereg = get_frame_extra_info (fi)->framereg; - get_frame_extra_info (prologue_cache)->framesize = get_frame_extra_info (fi)->framesize; - get_frame_extra_info (prologue_cache)->frameoffset = get_frame_extra_info (fi)->frameoffset; - - for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) - get_frame_saved_regs (prologue_cache)[i] = get_frame_saved_regs (fi)[i]; -} - - /* This function decodes an ARM function prologue to determine: 1) the size of the stack frame 2) which registers are saved on it @@ -770,10 +735,6 @@ arm_scan_prologue (struct frame_info *fi) LONGEST return_value; CORE_ADDR prologue_start, prologue_end, current_pc; - /* Check if this function is already in the cache of frame information. */ - if (check_prologue_cache (fi)) - return; - /* Assume there is no frame until proven otherwise. */ get_frame_extra_info (fi)->framereg = ARM_SP_REGNUM; get_frame_extra_info (fi)->framesize = 0; @@ -783,7 +744,6 @@ arm_scan_prologue (struct frame_info *fi) if (arm_pc_is_thumb (get_frame_pc (fi))) { thumb_scan_prologue (fi); - save_prologue_cache (fi); return; } @@ -975,8 +935,6 @@ arm_scan_prologue (struct frame_info *fi) get_frame_extra_info (fi)->frameoffset = fp_offset - sp_offset; else get_frame_extra_info (fi)->frameoffset = 0; - - save_prologue_cache (fi); } /* Find REGNUM on the stack. Otherwise, it's in an active register. @@ -1032,7 +990,7 @@ arm_frame_chain (struct frame_info *fi) return 0; /* If the caller is the startup code, we're at the end of the chain. */ - caller_pc = FRAME_SAVED_PC (fi); + caller_pc = DEPRECATED_FRAME_SAVED_PC (fi); /* If the caller is Thumb and the caller is ARM, or vice versa, the frame register of the caller is different from ours. @@ -1090,7 +1048,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi) get_frame_extra_info (fi)->framereg = 0; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); memset (get_frame_saved_regs (fi), '\000', sizeof get_frame_saved_regs (fi)); @@ -1376,137 +1334,6 @@ arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, write_register (4, fun); } -/* Note: ScottB - - This function does not support passing parameters using the FPA - variant of the APCS. It passes any floating point arguments in the - general registers and/or on the stack. */ - -static CORE_ADDR -arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) -{ - CORE_ADDR fp; - int argnum; - int argreg; - int nstack; - int simd_argreg; - int second_pass; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - /* Walk through the list of args and determine how large a temporary - stack is required. Need to take care here as structs may be - passed on the stack, and we have to to push them. On the second - pass, do the store. */ - nstack = 0; - fp = sp; - for (second_pass = 0; second_pass < 2; second_pass++) - { - /* Compute the FP using the information computed during the - first pass. */ - if (second_pass) - fp = sp - nstack; - - simd_argreg = 0; - argreg = ARM_A1_REGNUM; - nstack = 0; - - /* The struct_return pointer occupies the first parameter - passing register. */ - if (struct_return) - { - if (second_pass) - { - if (arm_debug) - fprintf_unfiltered (gdb_stdlog, - "struct return in %s = 0x%s\n", - REGISTER_NAME (argreg), - paddr (struct_addr)); - write_register (argreg, struct_addr); - } - argreg++; - } - - for (argnum = 0; argnum < nargs; argnum++) - { - int len; - struct type *arg_type; - struct type *target_type; - enum type_code typecode; - char *val; - - arg_type = check_typedef (VALUE_TYPE (args[argnum])); - len = TYPE_LENGTH (arg_type); - target_type = TYPE_TARGET_TYPE (arg_type); - typecode = TYPE_CODE (arg_type); - val = VALUE_CONTENTS (args[argnum]); - - /* If the argument is a pointer to a function, and it is a - Thumb function, create a LOCAL copy of the value and set - the THUMB bit in it. */ - if (second_pass - && TYPE_CODE_PTR == typecode - && target_type != NULL - && TYPE_CODE_FUNC == TYPE_CODE (target_type)) - { - CORE_ADDR regval = extract_address (val, len); - if (arm_pc_is_thumb (regval)) - { - val = alloca (len); - store_address (val, len, MAKE_THUMB_ADDR (regval)); - } - } - - /* Copy the argument to general registers or the stack in - register-sized pieces. Large arguments are split between - registers and stack. */ - while (len > 0) - { - int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE; - - if (argreg <= ARM_LAST_ARG_REGNUM) - { - /* The argument is being passed in a general purpose - register. */ - if (second_pass) - { - CORE_ADDR regval = extract_address (val, - partial_len); - if (arm_debug) - fprintf_unfiltered (gdb_stdlog, - "arg %d in %s = 0x%s\n", - argnum, - REGISTER_NAME (argreg), - phex (regval, REGISTER_SIZE)); - write_register (argreg, regval); - } - argreg++; - } - else - { - if (second_pass) - { - /* Push the arguments onto the stack. */ - if (arm_debug) - fprintf_unfiltered (gdb_stdlog, - "arg %d @ 0x%s + %d\n", - argnum, paddr (fp), nstack); - write_memory (fp + nstack, val, REGISTER_SIZE); - } - nstack += REGISTER_SIZE; - } - - len -= partial_len; - val += partial_len; - } - - } - } - - /* Return the bottom of the argument list (pointed to by fp). */ - return fp; -} - /* Pop the current frame. So long as the frame info has been initialized properly (see arm_init_extra_frame_info), this code works for dummy frames as well as regular frames. I.e, there's no @@ -1535,12 +1362,167 @@ arm_pop_frame (void) read_memory_integer (get_frame_saved_regs (frame)[regnum], REGISTER_RAW_SIZE (regnum))); - write_register (ARM_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (ARM_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); write_register (ARM_SP_REGNUM, old_SP); flush_cached_frames (); } +/* When arguments must be pushed onto the stack, they go on in reverse + order. The code below implements a FILO (stack) to do this. */ + +struct stack_item +{ + int len; + struct stack_item *prev; + void *data; +}; + +static struct stack_item * +push_stack_item (struct stack_item *prev, void *contents, int len) +{ + struct stack_item *si; + si = xmalloc (sizeof (struct stack_item)); + si->data = xmalloc (len); + si->len = len; + si->prev = prev; + memcpy (si->data, contents, len); + return si; +} + +static struct stack_item * +pop_stack_item (struct stack_item *si) +{ + struct stack_item *dead = si; + si = si->prev; + xfree (dead->data); + xfree (dead); + return si; +} + +/* We currently only support passing parameters in integer registers. This + conforms with GCC's default model. Several other variants exist and + we should probably support some of them based on the selected ABI. */ + +static CORE_ADDR +arm_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, + CORE_ADDR dummy_addr, int nargs, struct value **args, + CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +{ + int argnum; + int argreg; + int nstack; + struct stack_item *si = NULL; + + /* Set the return address. For the ARM, the return breakpoint is always + at DUMMY_ADDR. */ + /* XXX Fix for Thumb. */ + regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, dummy_addr); + + /* Walk through the list of args and determine how large a temporary + stack is required. Need to take care here as structs may be + passed on the stack, and we have to to push them. */ + nstack = 0; + + argreg = ARM_A1_REGNUM; + nstack = 0; + + /* Some platforms require a double-word aligned stack. Make sure sp + is correctly aligned before we start. We always do this even if + it isn't really needed -- it can never hurt things. */ + sp &= ~(CORE_ADDR)(2 * REGISTER_SIZE - 1); + + /* The struct_return pointer occupies the first parameter + passing register. */ + if (struct_return) + { + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, "struct return in %s = 0x%s\n", + REGISTER_NAME (argreg), paddr (struct_addr)); + regcache_cooked_write_unsigned (regcache, argreg, struct_addr); + argreg++; + } + + for (argnum = 0; argnum < nargs; argnum++) + { + int len; + struct type *arg_type; + struct type *target_type; + enum type_code typecode; + char *val; + + arg_type = check_typedef (VALUE_TYPE (args[argnum])); + len = TYPE_LENGTH (arg_type); + target_type = TYPE_TARGET_TYPE (arg_type); + typecode = TYPE_CODE (arg_type); + val = VALUE_CONTENTS (args[argnum]); + + /* If the argument is a pointer to a function, and it is a + Thumb function, create a LOCAL copy of the value and set + the THUMB bit in it. */ + if (TYPE_CODE_PTR == typecode + && target_type != NULL + && TYPE_CODE_FUNC == TYPE_CODE (target_type)) + { + CORE_ADDR regval = extract_address (val, len); + if (arm_pc_is_thumb (regval)) + { + val = alloca (len); + store_address (val, len, MAKE_THUMB_ADDR (regval)); + } + } + + /* Copy the argument to general registers or the stack in + register-sized pieces. Large arguments are split between + registers and stack. */ + while (len > 0) + { + int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE; + + if (argreg <= ARM_LAST_ARG_REGNUM) + { + /* The argument is being passed in a general purpose + register. */ + CORE_ADDR regval = extract_address (val, partial_len); + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n", + argnum, REGISTER_NAME (argreg), + phex (regval, REGISTER_SIZE)); + regcache_cooked_write_unsigned (regcache, argreg, regval); + argreg++; + } + else + { + /* Push the arguments onto the stack. */ + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n", + argnum, nstack); + si = push_stack_item (si, val, REGISTER_SIZE); + nstack += REGISTER_SIZE; + } + + len -= partial_len; + val += partial_len; + } + } + /* If we have an odd number of words to push, then decrement the stack + by one word now, so first stack argument will be dword aligned. */ + if (nstack & 4) + sp -= 4; + + while (si) + { + sp -= si->len; + write_memory (sp, si->data, si->len); + si = pop_stack_item (si); + } + + /* Finally, update teh SP register. */ + regcache_cooked_write_unsigned (regcache, ARM_SP_REGNUM, sp); + + return sp; +} + static void print_fpu_flags (int flags) { @@ -2227,9 +2209,7 @@ arm_extract_return_value (struct type *type, if (TYPE_CODE_FLT == TYPE_CODE (type)) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - - switch (tdep->fp_model) + switch (arm_get_fp_model (current_gdbarch)) { case ARM_FLOAT_FPA: { @@ -2244,7 +2224,7 @@ arm_extract_return_value (struct type *type, } break; - case ARM_FLOAT_SOFT: + case ARM_FLOAT_SOFT_FPA: case ARM_FLOAT_SOFT_VFP: regcache_cooked_read (regs, ARM_A1_REGNUM, valbuf); if (TYPE_LENGTH (type) > 4) @@ -2422,10 +2402,9 @@ arm_store_return_value (struct type *type, struct regcache *regs, if (TYPE_CODE (type) == TYPE_CODE_FLT) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); char buf[ARM_MAX_REGISTER_RAW_SIZE]; - switch (tdep->fp_model) + switch (arm_get_fp_model (current_gdbarch)) { case ARM_FLOAT_FPA: @@ -2433,7 +2412,7 @@ arm_store_return_value (struct type *type, struct regcache *regs, regcache_cooked_write (regs, ARM_F0_REGNUM, buf); break; - case ARM_FLOAT_SOFT: + case ARM_FLOAT_SOFT_FPA: case ARM_FLOAT_SOFT_VFP: regcache_cooked_write (regs, ARM_A1_REGNUM, valbuf); if (TYPE_LENGTH (type) > 4) @@ -2501,15 +2480,6 @@ arm_store_return_value (struct type *type, struct regcache *regs, } } -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ - -static void -arm_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -{ - write_register (ARM_A1_REGNUM, addr); -} - static int arm_get_longjmp_target (CORE_ADDR *pc) { @@ -2577,16 +2547,92 @@ arm_skip_stub (CORE_ADDR pc) return 0; /* not a stub */ } -/* If the user changes the register disassembly flavor used for info - register and other commands, we have to also switch the flavor used - in opcodes for disassembly output. This function is run in the set - disassembly_flavor command, and does that. */ +static void +set_arm_command (char *args, int from_tty) +{ + printf_unfiltered ("\"set arm\" must be followed by an apporpriate subcommand.\n"); + help_list (setarmcmdlist, "set arm ", all_commands, gdb_stdout); +} static void -set_disassembly_flavor_sfunc (char *args, int from_tty, +show_arm_command (char *args, int from_tty) +{ + cmd_show_list (showarmcmdlist, from_tty, ""); +} + +enum arm_float_model +arm_get_fp_model (struct gdbarch *gdbarch) +{ + if (arm_fp_model == ARM_FLOAT_AUTO) + return gdbarch_tdep (gdbarch)->fp_model; + + return arm_fp_model; +} + +static void +arm_set_fp (struct gdbarch *gdbarch) +{ + enum arm_float_model fp_model = arm_get_fp_model (gdbarch); + + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE + && (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA)) + { + set_gdbarch_double_format (gdbarch, + &floatformat_ieee_double_littlebyte_bigword); + set_gdbarch_long_double_format + (gdbarch, &floatformat_ieee_double_littlebyte_bigword); + } + else + { + set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little); + set_gdbarch_long_double_format (gdbarch, + &floatformat_ieee_double_little); + } +} + +static void +set_fp_model_sfunc (char *args, int from_tty, + struct cmd_list_element *c) +{ + enum arm_float_model fp_model; + + for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++) + if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0) + { + arm_fp_model = fp_model; + break; + } + + if (fp_model == ARM_FLOAT_LAST) + internal_error (__FILE__, __LINE__, "Invalid fp model accepted: %s.", + current_fp_model); + + if (gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm) + arm_set_fp (current_gdbarch); +} + +static void +show_fp_model (char *args, int from_tty, + struct cmd_list_element *c) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (arm_fp_model == ARM_FLOAT_AUTO + && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm) + printf_filtered (" - the default for the current ABI is \"%s\".\n", + fp_model_strings[tdep->fp_model]); +} + +/* If the user changes the register disassembly style used for info + register and other commands, we have to also switch the style used + in opcodes for disassembly output. This function is run in the "set + arm disassembly" command, and does that. */ + +static void +set_disassembly_style_sfunc (char *args, int from_tty, struct cmd_list_element *c) { - set_disassembly_flavor (); + set_disassembly_style (); } /* Return the ARM register name corresponding to register I. */ @@ -2597,16 +2643,16 @@ arm_register_name (int i) } static void -set_disassembly_flavor (void) +set_disassembly_style (void) { const char *setname, *setdesc, **regnames; int numregs, j; - /* Find the flavor that the user wants in the opcodes table. */ + /* Find the style that the user wants in the opcodes table. */ int current = 0; numregs = get_arm_regnames (current, &setname, &setdesc, ®names); - while ((disassembly_flavor != setname) - && (current < num_flavor_options)) + while ((disassembly_style != setname) + && (current < num_disassembly_options)) get_arm_regnames (++current, &setname, &setdesc, ®names); current_option = current; @@ -2630,19 +2676,17 @@ set_disassembly_flavor (void) set_arm_regname_option (current); } -/* arm_othernames implements the "othernames" command. This is kind - of hacky, and I prefer the set-show disassembly-flavor which is - also used for the x86 gdb. I will keep this around, however, in - case anyone is actually using it. */ +/* arm_othernames implements the "othernames" command. This is deprecated + by the "set arm disassembly" command. */ static void arm_othernames (char *names, int n) { /* Circle through the various flavors. */ - current_option = (current_option + 1) % num_flavor_options; + current_option = (current_option + 1) % num_disassembly_options; - disassembly_flavor = valid_flavors[current_option]; - set_disassembly_flavor (); + disassembly_style = valid_disassembly_styles[current_option]; + set_disassembly_style (); } /* Fetch, and possibly build, an appropriate link_map_offsets structure @@ -2850,8 +2894,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) ready to unwind the PC first (see frame.c:get_prev_frame()). */ set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default); - /* This is the way it has always defaulted. */ - tdep->fp_model = ARM_FLOAT_FPA; + /* We used to default to FPA for generic ARM, but almost nobody uses that + now, and we now provide a way for the user to force the model. So + default to the most useful variant. */ + tdep->fp_model = ARM_FLOAT_SOFT_FPA; /* Breakpoints. */ switch (info.byte_order) @@ -2884,38 +2930,25 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->lowest_pc = 0x20; tdep->jb_pc = -1; /* Longjump support not enabled by default. */ - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_call_dummy_words (gdbarch, arm_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); - - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_push_return_address (gdbarch, arm_push_return_address); - set_gdbarch_push_arguments (gdbarch, arm_push_arguments); + set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call); /* Frame handling. */ - set_gdbarch_frame_chain_valid (gdbarch, arm_frame_chain_valid); + 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_frame_chain (gdbarch, arm_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, arm_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, arm_frameless_function_invocation); - set_gdbarch_frame_saved_pc (gdbarch, arm_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, arm_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, arm_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address); set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs); - set_gdbarch_pop_frame (gdbarch, arm_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, arm_pop_frame); /* Address manipulation. */ set_gdbarch_smash_text_address (gdbarch, arm_smash_text_address); @@ -2928,7 +2961,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_skip_prologue (gdbarch, arm_skip_prologue); /* Get the PC when a frame might not be available. */ - set_gdbarch_saved_pc_after_call (gdbarch, arm_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, arm_saved_pc_after_call); /* The stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -2964,7 +2997,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Returning results. */ set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value); set_gdbarch_store_return_value (gdbarch, arm_store_return_value); - set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention); set_gdbarch_extract_struct_value_address (gdbarch, arm_extract_struct_value_address); @@ -2973,6 +3005,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* XXX For an RDI target we should ask the target if it can single-step. */ set_gdbarch_software_single_step (gdbarch, arm_software_single_step); + /* Disassembly. */ + set_gdbarch_print_insn (gdbarch, gdb_print_insn_arm); + /* Minsymbol frobbing. */ set_gdbarch_elf_make_msymbol_special (gdbarch, arm_elf_make_msymbol_special); set_gdbarch_coff_make_msymbol_special (gdbarch, @@ -2999,20 +3034,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) case BFD_ENDIAN_LITTLE: set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little); - if (tdep->fp_model == ARM_FLOAT_VFP - || tdep->fp_model == ARM_FLOAT_SOFT_VFP) - { - set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little); - set_gdbarch_long_double_format (gdbarch, - &floatformat_ieee_double_little); - } - else - { - set_gdbarch_double_format - (gdbarch, &floatformat_ieee_double_littlebyte_bigword); - set_gdbarch_long_double_format - (gdbarch, &floatformat_ieee_double_littlebyte_bigword); - } + arm_set_fp (gdbarch); break; default: @@ -3020,22 +3042,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) "arm_gdbarch_init: bad byte order for float format"); } - /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still - references the old architecture vector, not the one we are - building here. */ - if (get_frame_saved_regs (prologue_cache) != NULL) - xfree (get_frame_saved_regs (prologue_cache)); - - /* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still - references the old architecture vector, not the one we are - building here. */ - { - CORE_ADDR *saved_regs = xcalloc (1, (sizeof (CORE_ADDR) - * (gdbarch_num_regs (gdbarch) - + gdbarch_num_pseudo_regs (gdbarch)))); - deprecated_set_frame_saved_regs_hack (prologue_cache, saved_regs); - } - return gdbarch; } @@ -3077,7 +3083,7 @@ _initialize_arm_tdep (void) { struct ui_file *stb; long length; - struct cmd_list_element *new_cmd; + struct cmd_list_element *new_set, *new_show; const char *setname; const char *setdesc; const char **regnames; @@ -3100,31 +3106,39 @@ _initialize_arm_tdep (void) gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_ARM_APCS, arm_init_abi_apcs); - tm_print_insn = gdb_print_insn_arm; - /* Get the number of possible sets of register names defined in opcodes. */ - num_flavor_options = get_arm_regname_num_options (); + num_disassembly_options = get_arm_regname_num_options (); + + /* Add root prefix command for all "set arm"/"show arm" commands. */ + add_prefix_cmd ("arm", no_class, set_arm_command, + "Various ARM-specific commands.", + &setarmcmdlist, "set arm ", 0, &setlist); + + add_prefix_cmd ("arm", no_class, show_arm_command, + "Various ARM-specific commands.", + &showarmcmdlist, "show arm ", 0, &showlist); /* Sync the opcode insn printer with our register viewer. */ parse_arm_disassembler_option ("reg-names-std"); /* Begin creating the help text. */ stb = mem_fileopen (); - fprintf_unfiltered (stb, "Set the disassembly flavor.\n\ -The valid values are:\n"); + fprintf_unfiltered (stb, "Set the disassembly style.\n" + "The valid values are:\n"); /* Initialize the array that will be passed to add_set_enum_cmd(). */ - valid_flavors = xmalloc ((num_flavor_options + 1) * sizeof (char *)); - for (i = 0; i < num_flavor_options; i++) + valid_disassembly_styles + = xmalloc ((num_disassembly_options + 1) * sizeof (char *)); + for (i = 0; i < num_disassembly_options; i++) { numregs = get_arm_regnames (i, &setname, &setdesc, ®names); - valid_flavors[i] = setname; + valid_disassembly_styles[i] = setname; fprintf_unfiltered (stb, "%s - %s\n", setname, setdesc); /* Copy the default names (if found) and synchronize disassembler. */ if (!strcmp (setname, "std")) { - disassembly_flavor = setname; + disassembly_style = setname; current_option = i; for (j = 0; j < numregs; j++) arm_register_names[j] = (char *) regnames[j]; @@ -3132,40 +3146,73 @@ The valid values are:\n"); } } /* Mark the end of valid options. */ - valid_flavors[num_flavor_options] = NULL; + valid_disassembly_styles[num_disassembly_options] = NULL; /* Finish the creation of the help text. */ fprintf_unfiltered (stb, "The default is \"std\"."); helptext = ui_file_xstrdup (stb, &length); ui_file_delete (stb); - /* Add the disassembly-flavor command. */ - new_cmd = add_set_enum_cmd ("disassembly-flavor", no_class, - valid_flavors, - &disassembly_flavor, + /* Add the deprecated disassembly-flavor command. */ + new_set = add_set_enum_cmd ("disassembly-flavor", no_class, + valid_disassembly_styles, + &disassembly_style, helptext, &setlist); - set_cmd_sfunc (new_cmd, set_disassembly_flavor_sfunc); - add_show_from_set (new_cmd, &showlist); - - /* ??? Maybe this should be a boolean. */ - add_show_from_set (add_set_cmd ("apcs32", no_class, - var_zinteger, (char *) &arm_apcs_32, - "Set usage of ARM 32-bit mode.\n", &setlist), - &showlist); + set_cmd_sfunc (new_set, set_disassembly_style_sfunc); + deprecate_cmd (new_set, "set arm disassembly"); + deprecate_cmd (add_show_from_set (new_set, &showlist), + "show arm disassembly"); + + /* And now add the new interface. */ + new_set = add_set_enum_cmd ("disassembler", no_class, + valid_disassembly_styles, &disassembly_style, + helptext, &setarmcmdlist); + + set_cmd_sfunc (new_set, set_disassembly_style_sfunc); + add_show_from_set (new_set, &showarmcmdlist); + + add_setshow_cmd_full ("apcs32", no_class, + var_boolean, (char *) &arm_apcs_32, + "Set usage of ARM 32-bit mode.", + "Show usage of ARM 32-bit mode.", + NULL, NULL, + &setlist, &showlist, &new_set, &new_show); + deprecate_cmd (new_set, "set arm apcs32"); + deprecate_cmd (new_show, "show arm apcs32"); + + add_setshow_boolean_cmd ("apcs32", no_class, &arm_apcs_32, + "Set usage of ARM 32-bit mode. " + "When off, a 26-bit PC will be used.", + "Show usage of ARM 32-bit mode. " + "When off, a 26-bit PC will be used.", + NULL, NULL, + &setarmcmdlist, &showarmcmdlist); + + /* Add a command to allow the user to force the FPU model. */ + new_set = add_set_enum_cmd + ("fpu", no_class, fp_model_strings, ¤t_fp_model, + "Set the floating point type.\n" + "auto - Determine the FP typefrom the OS-ABI.\n" + "softfpa - Software FP, mixed-endian doubles on little-endian ARMs.\n" + "fpa - FPA co-processor (GCC compiled).\n" + "softvfp - Software FP with pure-endian doubles.\n" + "vfp - VFP co-processor.", + &setarmcmdlist); + set_cmd_sfunc (new_set, set_fp_model_sfunc); + set_cmd_sfunc (add_show_from_set (new_set, &showarmcmdlist), show_fp_model); /* Add the deprecated "othernames" command. */ - - add_com ("othernames", class_obscure, arm_othernames, - "Switch to the next set of register names."); - - /* Allocate the prologue_cache. */ - prologue_cache = deprecated_frame_xmalloc (); - deprecated_set_frame_extra_info_hack (prologue_cache, xcalloc (1, sizeof (struct frame_extra_info))); + deprecate_cmd (add_com ("othernames", class_obscure, arm_othernames, + "Switch to the next set of register names."), + "set arm disassembly"); /* Debugging flag. */ - add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger, - &arm_debug, "Set arm debugging.\n\ -When non-zero, arm specific debugging is enabled.", &setdebuglist), - &showdebuglist); + add_setshow_boolean_cmd ("arm", class_maintenance, &arm_debug, + "Set ARM debugging. " + "When on, arm-specific debugging is enabled.", + "Show ARM debugging. " + "When on, arm-specific debugging is enabled.", + NULL, NULL, + &setdebuglist, &showdebuglist); } diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index b8c4711..26f3a83 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -109,16 +109,24 @@ enum gdb_regnum { only generate 2 of those. The third is APCS_FLOAT, where arguments to functions are passed in floating-point registers. - In addition to the traditional models, VFP adds two more. */ + In addition to the traditional models, VFP adds two more. + + If you update this enum, don't forget to update fp_model_strings in + arm-tdep.c. */ enum arm_float_model { - ARM_FLOAT_SOFT, - ARM_FLOAT_FPA, - ARM_FLOAT_SOFT_VFP, - ARM_FLOAT_VFP + ARM_FLOAT_AUTO, /* Automatic detection. Do not set in tdep. */ + ARM_FLOAT_SOFT_FPA, /* Traditional soft-float (mixed-endian on LE ARM). */ + ARM_FLOAT_FPA, /* FPA co-processor. GCC calling convention. */ + ARM_FLOAT_SOFT_VFP, /* Soft-float with pure-endian doubles. */ + ARM_FLOAT_VFP, /* Full VFP calling convention. */ + ARM_FLOAT_LAST /* Keep at end. */ }; +/* A method to the setting based on user's choice and ABI setting. */ +enum arm_float_model arm_get_fp_model (struct gdbarch *); + /* Target-dependent structure in gdbarch. */ struct gdbarch_tdep { diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c index d12fda0..88cf2e5 100644 --- a/gdb/armnbsd-tdep.c +++ b/gdb/armnbsd-tdep.c @@ -66,7 +66,7 @@ arm_netbsd_aout_init_abi (struct gdbarch_info info, set_gdbarch_in_solib_call_trampoline (gdbarch, arm_netbsd_aout_in_solib_call_trampoline); - tdep->fp_model = ARM_FLOAT_SOFT; + tdep->fp_model = ARM_FLOAT_SOFT_FPA; } static void diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 975132a..b787c81 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -736,7 +736,7 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi) int reg; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); frame_saved_regs_zalloc (fi); @@ -1147,7 +1147,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, avr_write_pc); set_gdbarch_read_fp (gdbarch, avr_read_fp); set_gdbarch_read_sp (gdbarch, avr_read_sp); - set_gdbarch_write_sp (gdbarch, avr_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp); set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS); @@ -1168,25 +1168,18 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, print_insn_avr); set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); /* set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */ set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer); set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address); - set_gdbarch_push_arguments (gdbarch, avr_push_arguments); - set_gdbarch_push_return_address (gdbarch, avr_push_return_address); - set_gdbarch_pop_frame (gdbarch, avr_pop_frame); + set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, avr_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame); set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention); - set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, avr_store_struct_return); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, avr_scan_prologue); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, avr_init_extra_frame_info); @@ -1200,11 +1193,11 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) avr_remote_translate_xfer_address); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); /* ??? */ - set_gdbarch_frame_chain (gdbarch, avr_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, avr_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, avr_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, avr_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, avr_frame_address); set_gdbarch_frame_locals_address (gdbarch, avr_frame_address); - set_gdbarch_saved_pc_after_call (gdbarch, avr_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_convert_from_func_ptr_addr (gdbarch, diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h index 3e1006a..b091384 100644 --- a/gdb/ax-gdb.h +++ b/gdb/ax-gdb.h @@ -20,7 +20,8 @@ #ifndef AX_GDB_H #define AX_GDB_H - + +struct expression; /* Types and enums */ diff --git a/gdb/block.c b/gdb/block.c index eda282a..603744e 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -30,7 +30,7 @@ C++ files, namely using declarations and the current namespace in scope. */ -struct namespace_info +struct block_namespace_info { const char *scope; struct using_direct *using; @@ -160,30 +160,6 @@ block_for_pc (register CORE_ADDR pc) /* Now come some functions designed to deal with C++ namespace issues. The accessors are safe to use even in the non-C++ case. */ -/* This returns the using directives associated to BLOCK (but _not_ - its parents), if any. */ - -static struct using_direct * -block_using (const struct block *block) -{ - if (BLOCK_NAMESPACE (block) == NULL) - return NULL; - else - return BLOCK_NAMESPACE (block)->using; -} - -/* Set block_using (BLOCK) to USING; if needed, allocate memory via - OBSTACK. */ - -void -block_set_using (struct block *block, struct using_direct *using, - struct obstack *obstack) -{ - block_initialize_namespace (block, obstack); - - BLOCK_NAMESPACE (block)->using = using; -} - /* This returns the namespace that BLOCK is enclosed in, or "" if it isn't enclosed in a namespace at all. This travels the chain of superblocks looking for a scope, if necessary. */ @@ -201,7 +177,7 @@ block_scope (const struct block *block) return ""; } -/* Set block_scope (BLOCK) to SCOPE; if needed, allocate memory via +/* Set BLOCK's scope member to SCOPE; if needed, allocate memory via OBSTACK. (It won't make a copy of SCOPE, however, so that already has to be allocated correctly.) */ @@ -214,6 +190,32 @@ block_set_scope (struct block *block, const char *scope, BLOCK_NAMESPACE (block)->scope = scope; } +/* This returns the using directives associated to BLOCK (but _not_ + its parents), if any. */ + +static struct using_direct * +block_using (const struct block *block) +{ + if (BLOCK_NAMESPACE (block) == NULL) + return NULL; + else + return BLOCK_NAMESPACE (block)->using; +} + +/* Set BLOCK's using member to USING; if needed, allocate memory via + OBSTACK. (It won't make a copy of USING, however, so that already + has to be allocated correctly.) */ + +void +block_set_using (struct block *block, + struct using_direct *using, + struct obstack *obstack) +{ + block_initialize_namespace (block, obstack); + + BLOCK_NAMESPACE (block)->using = using; +} + /* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and ititialize its members to zero. */ @@ -223,7 +225,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack) if (BLOCK_NAMESPACE (block) == NULL) { BLOCK_NAMESPACE (block) - = obstack_alloc (obstack, sizeof (struct namespace_info)); + = obstack_alloc (obstack, sizeof (struct block_namespace_info)); BLOCK_NAMESPACE (block)->scope = NULL; BLOCK_NAMESPACE (block)->using = NULL; } @@ -319,4 +321,3 @@ allocate_block (struct obstack *obstack) return bl; } - diff --git a/gdb/block.h b/gdb/block.h index 36d9601..4a67085 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -26,10 +26,10 @@ struct symbol; struct symtab; -struct dictionary; -struct namespace_info; +struct block_namespace_info; struct using_direct; struct obstack; +struct dictionary; /* All of the name-scope contours of the program are represented by `struct block' objects. @@ -92,7 +92,7 @@ struct block this block: using directives and the current namespace scope. */ - struct namespace_info *namespace; + struct block_namespace_info *namespace; } cplus_specific; } diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 69ca9d8..fd4eefd 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -44,11 +44,11 @@ void _initialize_blockframe (void); -/* Is ADDR inside the startup file? Note that if your machine - has a way to detect the bottom of the stack, there is no need - to call this function from FRAME_CHAIN_VALID; the reason for - doing so is that some machines have no way of detecting bottom - of stack. +/* Is ADDR inside the startup file? Note that if your machine has a + way to detect the bottom of the stack, there is no need to call + this function from DEPRECATED_FRAME_CHAIN_VALID; the reason for + doing so is that some machines have no way of detecting bottom of + stack. A PC of zero is always considered to be the bottom of the stack. */ @@ -75,7 +75,7 @@ inside_entry_file (CORE_ADDR addr) that correspond to the main() function. See comments above for why we might want to do this. - Typically called from FRAME_CHAIN_VALID. + Typically called from DEPRECATED_FRAME_CHAIN_VALID. A PC of zero is always considered to be the bottom of the stack. */ @@ -87,9 +87,10 @@ inside_main_func (CORE_ADDR pc) if (symfile_objfile == 0) return 0; - /* If the addr range is not set up at symbol reading time, set it up now. - This is for FRAME_CHAIN_VALID_ALTERNATE. I do this for coff, because - it is unable to set it up and symbol reading time. */ + /* If the addr range is not set up at symbol reading time, set it up + now. This is for DEPRECATED_FRAME_CHAIN_VALID_ALTERNATE. I do + this for coff, because it is unable to set it up and symbol + reading time. */ if (symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC && symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC) @@ -113,7 +114,7 @@ inside_main_func (CORE_ADDR pc) that correspond to the process entry point function. See comments in objfiles.h for why we might want to do this. - Typically called from FRAME_CHAIN_VALID. + Typically called from DEPRECATED_FRAME_CHAIN_VALID. A PC of zero is always considered to be the bottom of the stack. */ @@ -145,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame) { CORE_ADDR func_start, after_prologue; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); if (func_start) { func_start += FUNCTION_START_OFFSET; @@ -553,12 +554,12 @@ deprecated_pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp, && (pc) <= (CALL_DUMMY_ADDRESS () + DECR_PC_AFTER_BREAK)); } -/* Function: frame_chain_valid - Returns true for a user frame or a call_function_by_hand dummy frame, - and false for the CRT0 start-up frame. Purpose is to terminate backtrace. */ +/* Returns true for a user frame or a call_function_by_hand dummy + frame, and false for the CRT0 start-up frame. Purpose is to + terminate backtrace. */ int -frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) +legacy_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) { /* Don't prune CALL_DUMMY frames. */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES @@ -574,6 +575,11 @@ frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) if (INNER_THAN (fp, get_frame_base (fi))) return 0; + /* If the architecture has a custom DEPRECATED_FRAME_CHAIN_VALID, + call it now. */ + if (DEPRECATED_FRAME_CHAIN_VALID_P ()) + return DEPRECATED_FRAME_CHAIN_VALID (fp, fi); + /* If we're already inside the entry function for the main objfile, then it isn't valid. */ if (inside_entry_func (get_frame_pc (fi))) @@ -586,9 +592,5 @@ frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) if (inside_entry_file (frame_pc_unwind (fi))) return 0; - /* If the architecture has a custom FRAME_CHAIN_VALID, call it now. */ - if (FRAME_CHAIN_VALID_P ()) - return FRAME_CHAIN_VALID (fp, fi); - return 1; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5104c3d..6bbc642 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -81,10 +81,6 @@ static void clear_command (char *, int); static void catch_command (char *, int); -static void handle_gnu_4_16_catch_command (char *, int, int); - -static struct symtabs_and_lines get_catch_sals (int); - static void watch_command (char *, int); static int can_use_hardware_watchpoint (struct value *); @@ -1680,7 +1676,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc) /* Return nonzero if FRAME is a dummy frame. We can't use DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would - take too much time, at least using get_saved_register on the 68k. + take too much time, at least using frame_register() on the 68k. This means that for this function to work right a port must use the bp_call_dummy breakpoint. */ @@ -1689,9 +1685,6 @@ deprecated_frame_in_dummy (struct frame_info *frame) { struct breakpoint *b; - if (!CALL_DUMMY_P) - return 0; - /* This function is used by two files: get_frame_type(), after first checking that !DEPRECATED_USE_GENERIC_DUMMY_FRAMES; and sparc-tdep.c, which doesn't yet use generic dummy frames anyway. */ @@ -1817,6 +1810,11 @@ bpstat_copy (bpstat bs) { tmp = (bpstat) xmalloc (sizeof (*tmp)); memcpy (tmp, bs, sizeof (*tmp)); + if (bs->commands != NULL) + tmp->commands = copy_command_lines (bs->commands); + if (bs->old_val != NULL) + tmp->old_val = value_copy (bs->old_val); + if (p == NULL) /* This is the first thing in the chain. */ retval = tmp; @@ -2759,9 +2757,9 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) /* We will stop here */ if (b->disposition == disp_disable) b->enable_state = bp_disabled; - bs->commands = copy_command_lines (b->commands); if (b->silent) bs->print = 0; + bs->commands = b->commands; if (bs->commands && (STREQ ("silent", bs->commands->line) || (xdb_commands && STREQ ("Q", bs->commands->line)))) @@ -2769,6 +2767,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) bs->commands = bs->commands->next; bs->print = 0; } + bs->commands = copy_command_lines (bs->commands); } } /* Print nothing for this entry if we dont stop or if we dont print. */ @@ -3420,7 +3419,7 @@ print_one_breakpoint (struct breakpoint *b, ui_out_text (uiout, "\tstop only in stack frame at "); /* FIXME: cagney/2002-12-01: Shouldn't be poeking around inside the frame ID. */ - ui_out_field_core_addr (uiout, "frame", b->frame_id.base); + ui_out_field_core_addr (uiout, "frame", b->frame_id.stack_addr); ui_out_text (uiout, "\n"); } @@ -5701,187 +5700,6 @@ enable_catch_breakpoint (void) } #endif /* 0 */ -struct sal_chain -{ - struct sal_chain *next; - struct symtab_and_line sal; -}; - -#if 0 -/* Not really used -- invocation in handle_gnu_4_16_catch_command - had been commented out in the v.4.16 sources, and stays - disabled there now because "catch NAME" syntax isn't allowed. - pai/1997-07-11 */ -/* This isn't used; I don't know what it was for. */ -/* For each catch clause identified in ARGS, run FUNCTION - with that clause as an argument. */ -static struct symtabs_and_lines -map_catch_names (char *args, int (*function) ()) -{ - register char *p = args; - register char *p1; - struct symtabs_and_lines sals; -#if 0 - struct sal_chain *sal_chain = 0; -#endif - - if (p == 0) - error_no_arg ("one or more catch names"); - - sals.nelts = 0; - sals.sals = NULL; - - while (*p) - { - p1 = p; - /* Don't swallow conditional part. */ - if (p1[0] == 'i' && p1[1] == 'f' - && (p1[2] == ' ' || p1[2] == '\t')) - break; - - if (isalpha (*p1)) - { - p1++; - while (isalnum (*p1) || *p1 == '_' || *p1 == '$') - p1++; - } - - if (*p1 && *p1 != ' ' && *p1 != '\t') - error ("Arguments must be catch names."); - - *p1 = 0; -#if 0 - if (function (p)) - { - struct sal_chain *next = (struct sal_chain *) - alloca (sizeof (struct sal_chain)); - next->next = sal_chain; - next->sal = get_catch_sal (p); - sal_chain = next; - goto win; - } -#endif - printf_unfiltered ("No catch clause for exception %s.\n", p); -#if 0 - win: -#endif - p = p1; - while (*p == ' ' || *p == '\t') - p++; - } -} -#endif - -/* This shares a lot of code with `print_frame_label_vars' from stack.c. */ - -static struct symtabs_and_lines -get_catch_sals (int this_level_only) -{ - register struct blockvector *bl; - register struct block *block; - int index, have_default = 0; - CORE_ADDR pc; - struct symtabs_and_lines sals; - struct sal_chain *sal_chain = 0; - char *blocks_searched; - - /* Not sure whether an error message is always the correct response, - but it's better than a core dump. */ - if (deprecated_selected_frame == NULL) - error ("No selected frame."); - block = get_frame_block (deprecated_selected_frame, 0); - pc = get_frame_pc (deprecated_selected_frame); - - sals.nelts = 0; - sals.sals = NULL; - - if (block == 0) - error ("No symbol table info available.\n"); - - bl = blockvector_for_pc (BLOCK_END (block) - 4, &index); - blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); - memset (blocks_searched, 0, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); - - while (block != 0) - { - CORE_ADDR end = BLOCK_END (block) - 4; - int last_index; - - if (bl != blockvector_for_pc (end, &index)) - error ("blockvector blotch"); - if (BLOCKVECTOR_BLOCK (bl, index) != block) - error ("blockvector botch"); - last_index = BLOCKVECTOR_NBLOCKS (bl); - index += 1; - - /* Don't print out blocks that have gone by. */ - while (index < last_index - && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < pc) - index++; - - while (index < last_index - && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < end) - { - if (blocks_searched[index] == 0) - { - struct block *b = BLOCKVECTOR_BLOCK (bl, index); - struct dict_iterator iter; - register struct symbol *sym; - - ALL_BLOCK_SYMBOLS (b, iter, sym) - { - if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default")) - { - if (have_default) - continue; - have_default = 1; - } - if (SYMBOL_CLASS (sym) == LOC_LABEL) - { - struct sal_chain *next = (struct sal_chain *) - alloca (sizeof (struct sal_chain)); - next->next = sal_chain; - next->sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), - 0); - sal_chain = next; - } - } - blocks_searched[index] = 1; - } - index++; - } - if (have_default) - break; - if (sal_chain && this_level_only) - break; - - /* After handling the function's top-level block, stop. - Don't continue to its superblock, the block of - per-file symbols. */ - if (BLOCK_FUNCTION (block)) - break; - block = BLOCK_SUPERBLOCK (block); - } - - if (sal_chain) - { - struct sal_chain *tmp_chain; - - /* Count the number of entries. */ - for (index = 0, tmp_chain = sal_chain; tmp_chain; - tmp_chain = tmp_chain->next) - index++; - - sals.nelts = index; - sals.sals = (struct symtab_and_line *) - xmalloc (index * sizeof (struct symtab_and_line)); - for (index = 0; sal_chain; sal_chain = sal_chain->next, index++) - sals.sals[index] = sal_chain->sal; - } - - return sals; -} - static void ep_skip_leading_whitespace (char **s) { @@ -6219,23 +6037,8 @@ catch_exception_command_1 (enum exception_event_kind ex_event, char *arg, else return; /* something went wrong with setting up callbacks */ } - else - { - /* No callbacks from runtime system for exceptions. - Try GNU C++ exception breakpoints using labels in debug info. */ - if (ex_event == EX_EVENT_CATCH) - { - handle_gnu_4_16_catch_command (arg, tempflag, from_tty); - } - else if (ex_event == EX_EVENT_THROW) - { - /* Set a breakpoint on __raise_exception () */ - warning ("Unsupported with this platform/compiler combination."); - warning ("Perhaps you can achieve the effect you want by setting"); - warning ("a breakpoint on __raise_exception()."); - } - } + warning ("Unsupported with this platform/compiler combination."); } /* Cover routine to allow wrapping target_enable_exception_catchpoints @@ -6255,111 +6058,6 @@ cover_target_enable_exception_callback (void *arg) return 1; /*is valid */ } - - -/* This is the original v.4.16 and earlier version of the - catch_command_1() function. Now that other flavours of "catch" - have been introduced, and since exception handling can be handled - in other ways (through target ops) also, this is used only for the - GNU C++ exception handling system. - Note: Only the "catch" flavour of GDB 4.16 is handled here. The - "catch NAME" is now no longer allowed in catch_command_1(). Also, - there was no code in GDB 4.16 for "catch throw". - - Called from catch_exception_command_1 () */ - - -static void -handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty) -{ - /* First, translate ARG into something we can deal with in terms - of breakpoints. */ - - struct symtabs_and_lines sals; - struct symtab_and_line sal; - register struct expression *cond = 0; - register struct breakpoint *b; - char *save_arg; - int i; - - init_sal (&sal); /* initialize to zeroes */ - - /* If no arg given, or if first arg is 'if ', all active catch clauses - are breakpointed. */ - - if (!arg || (arg[0] == 'i' && arg[1] == 'f' - && (arg[2] == ' ' || arg[2] == '\t'))) - { - /* Grab all active catch clauses. */ - sals = get_catch_sals (0); - } - else - { - /* Grab selected catch clauses. */ - error ("catch NAME not implemented"); - -#if 0 - /* Not sure why this code has been disabled. I'm leaving - it disabled. We can never come here now anyway - since we don't allow the "catch NAME" syntax. - pai/1997-07-11 */ - - /* This isn't used; I don't know what it was for. */ - sals = map_catch_names (arg, catch_breakpoint); -#endif - } - - if (!sals.nelts) - return; - - save_arg = arg; - for (i = 0; i < sals.nelts; i++) - { - resolve_sal_pc (&sals.sals[i]); - - while (arg && *arg) - { - if (arg[0] == 'i' && arg[1] == 'f' - && (arg[2] == ' ' || arg[2] == '\t')) - cond = parse_exp_1 ((arg += 2, &arg), - block_for_pc (sals.sals[i].pc), 0); - else - error ("Junk at end of arguments."); - } - arg = save_arg; - } - - for (i = 0; i < sals.nelts; i++) - { - sal = sals.sals[i]; - - if (from_tty) - describe_other_breakpoints (sal.pc, sal.section); - - /* Important -- this is an ordinary breakpoint. For platforms - with callback support for exceptions, - create_exception_catchpoint() will create special bp types - (bp_catch_catch and bp_catch_throw), and there is code in - insert_breakpoints() and elsewhere that depends on that. */ - b = set_raw_breakpoint (sal, bp_breakpoint); - set_breakpoint_count (breakpoint_count + 1); - b->number = breakpoint_count; - - b->cond = cond; - b->enable_state = bp_enabled; - b->disposition = tempflag ? disp_del : disp_donttouch; - - mention (b); - } - - if (sals.nelts > 1) - { - warning ("Multiple breakpoints were set."); - warning ("Use the \"delete\" command to delete unwanted breakpoints."); - } - xfree (sals.sals); -} - static void catch_command_1 (char *arg, int tempflag, int from_tty) { diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 494da48..71980ab 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -44,9 +44,9 @@ #include "macrotab.h" #include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */ #include "block.h" -#include "dictionary.h" -#include "gdb_assert.h" #include "cp-support.h" +#include "dictionary.h" + /* Ask buildsym.h to define the vars it normally declares `extern'. */ #define EXTERN /**/ @@ -66,15 +66,8 @@ static struct pending *free_pendings; otherwise empty symtab from being tossed. */ static int have_line_numbers; - -/* List of using directives that are active in the current file. */ - -static struct using_direct *using_list; - static int compare_line_numbers (const void *ln1p, const void *ln2p); - -static void scan_for_anonymous_namespaces (struct symbol *symbol); /* Initial sizes of data structures. These are realloc'd larger if @@ -139,71 +132,8 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead) /* Check to see if we might need to look for a mention of anonymous namespaces. */ - if (SYMBOL_LANGUAGE (symbol) == language_cplus - && !processing_has_namespace_info - && SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL) - scan_for_anonymous_namespaces (symbol); -} - -/* Check to see if a symbol is contained within an anonymous - namespace; if so, add an appropriate using directive. */ - -static void -scan_for_anonymous_namespaces (struct symbol *symbol) -{ - const char *name = SYMBOL_CPLUS_DEMANGLED_NAME (symbol); - unsigned int previous_component; - unsigned int next_component; - const char *len; - const char *anonymous_name; - int anonymous_len; - - /* Start with a quick-and-dirty check for mentions of anonymous - namespaces. */ - - switch (cp_is_anonymous (name)) - { - case 1: - anonymous_name = "(anonymous namespace)"; - break; - case 2: - /* FIXME: carlton/2003-03-10: This corresponds to GCCv2, and - urrently, the demangler actually can't demangle all anonymous - namespace mentions correctly. (See PR gdb/1134.) Given - GCCv2's lack of namespace support, I'm tempted to skip this - case entirely. */ - anonymous_name = "{anonymous}"; - break; - default: - return; - } - - anonymous_len = strlen (anonymous_name); - - previous_component = 0; - next_component = cp_find_first_component (name + previous_component); - - while (name[next_component] == ':') - { - if ((next_component - previous_component) == anonymous_len - && (strncmp (name + previous_component, anonymous_name, - anonymous_len) - == 0)) - { - /* We've found a component of the name that's an anonymous - namespace. So add symbols in it to the namespace given - by the previous component if there is one, or to the - global namespace if there isn't. */ - add_using_directive (name, - previous_component == 0 - ? 0 : previous_component - 2, - next_component); - } - /* The "+ 2" is for the "::". */ - previous_component = next_component + 2; - next_component = (previous_component - + cp_find_first_component (name + previous_component)); - } + if (SYMBOL_LANGUAGE (symbol) == language_cplus) + cp_scan_for_anonymous_namespaces (symbol); } /* Find a symbol named NAME on a LIST. NAME need not be @@ -231,34 +161,6 @@ find_symbol_in_list (struct pending *list, char *name, int length) return (NULL); } -/* Add a using directive to using_list. NAME is the start of a string - that should contain the namespaces we want to add as initial - substrings, OUTER_LENGTH is the end of the outer namespace, and - INNER_LENGTH is the end of the inner namespace. If the using - directive in question has already been added, don't add it - twice. */ - -void -add_using_directive (const char *name, unsigned int outer_length, - unsigned int inner_length) -{ - struct using_direct *current; - struct using_direct *new_node; - - /* Has it already been added? */ - - for (current = using_list; current != NULL; current = current->next) - { - if ((strncmp (current->inner, name, inner_length) == 0) - && (strlen (current->inner) == inner_length) - && (strlen (current->outer) == outer_length)) - return; - } - - using_list = cp_add_using (name, inner_length, outer_length, - using_list); -} - /* At end of reading syms, or in case of quit, really free as many `struct pending's as we can easily find. */ @@ -447,39 +349,10 @@ finish_block (struct symbol *symbol, struct pending **listhead, } } - /* If we're in the C++ case, record the namespace that the - function was defined in. Make sure that the name was - originally mangled: if not, there certainly isn't any - namespace information to worry about! */ - if (SYMBOL_LANGUAGE (symbol) == language_cplus - && SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL) + /* If we're in the C++ case, set the block's scope. */ + if (SYMBOL_LANGUAGE (symbol) == language_cplus) { - if (processing_has_namespace_info) - { - block_set_scope - (block, obsavestring (processing_current_prefix, - strlen (processing_current_prefix), - &objfile->symbol_obstack), - &objfile->symbol_obstack); - } - else - { - /* Try to figure out the appropriate namespace from the - demangled name. */ - - /* FIXME: carlton/2003-02-21: If the function in - question is a method of a class, the name will - actually include the name of the class as well. This - should be harmless, but is a little unfortunate. */ - - const char *name = SYMBOL_CPLUS_DEMANGLED_NAME (symbol); - unsigned int prefix_len = cp_entire_prefix_len (name); - - block_set_scope (block, - obsavestring (name, prefix_len, - &objfile->symbol_obstack), - &objfile->symbol_obstack); - } + cp_set_block_scope (symbol, block, &objfile->symbol_obstack); } } else @@ -911,8 +784,6 @@ start_symtab (const char *name, char *dirname, CORE_ADDR start_addr) global_symbols = NULL; within_function = 0; have_line_numbers = 0; - processing_has_namespace_info = 0; - using_list = NULL; /* Context stack is initially empty. Allocate first one with room for 10 levels; reuse it forever afterward. */ @@ -924,6 +795,10 @@ start_symtab (const char *name, char *dirname, CORE_ADDR start_addr) } context_stack_depth = 0; + /* Set up support for C++ namespace support, in case we need it. */ + + cp_initialize_namespace (); + /* Initialize the list of sub source files with one entry for this file (the top-level source file). */ @@ -1045,14 +920,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr, objfile); blockvector = make_blockvector (objfile); - if (using_list != NULL) - { - block_set_using (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK), - cp_copy_usings (using_list, - &objfile->symbol_obstack), - &objfile->symbol_obstack); - using_list = NULL; - } + cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK), + &objfile->symbol_obstack); } #ifndef PROCESS_LINENUMBER_HOOK diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 026b13e..0a3c087 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -22,6 +22,9 @@ #if !defined (BUILDSYM_H) #define BUILDSYM_H 1 +struct objfile; +struct symbol; + /* This module provides definitions used for creating and adding to the symbol table. These routines are called from various symbol- file-reading routines. @@ -85,18 +88,6 @@ EXTERN unsigned char processing_gcc_compilation; EXTERN unsigned char processing_acc_compilation; -/* When set, the file that we're processing seems to have debugging - info for C++ namespaces, so buildsym.c shouldn't try to guess - namespace info itself. */ - -EXTERN unsigned char processing_has_namespace_info; - -/* If processing_has_namespace_info is nonzero, this string should - contain the name of the current prefix (namespaces plus classes). - The string is temporary; copy it if you need it. */ - -EXTERN const char *processing_current_prefix; - /* Count symbols as they are processed, for error messages. */ EXTERN unsigned int symnum; @@ -241,9 +232,6 @@ extern void add_symbol_to_list (struct symbol *symbol, extern struct symbol *find_symbol_in_list (struct pending *list, char *name, int length); -extern void add_using_directive (const char *name, unsigned int outer_length, - unsigned int inner_length); - extern void finish_block (struct symbol *symbol, struct pending **listhead, struct pending_block *old_blocks, diff --git a/gdb/builtin-regs.h b/gdb/builtin-regs.h index fb9fbcf..631903a 100644 --- a/gdb/builtin-regs.h +++ b/gdb/builtin-regs.h @@ -24,6 +24,8 @@ #ifndef BUILTIN_REGS_H #define BUILTIN_REGS_H +struct frame_info; + extern int builtin_reg_map_name_to_regnum (const char *str, int len); extern const char *builtin_reg_map_regnum_to_name (int regnum); diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 4b4af16..e492b9a 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -31,6 +31,7 @@ #include "gdb_assert.h" #include "charset.h" #include "gdb_string.h" +#include "demangle.h" extern void _initialize_c_language (void); static void c_emit_char (int c, struct ui_file * stream, int quoter); @@ -552,6 +553,8 @@ const struct language_defn c_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -604,6 +607,8 @@ const struct language_defn cplus_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + cplus_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -633,6 +638,8 @@ const struct language_defn asm_language_defn = c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/c-lang.h b/gdb/c-lang.h index 0c6c730..2cc00ca 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -23,6 +23,8 @@ #if !defined (C_LANG_H) #define C_LANG_H 1 +struct ui_file; + #include "value.h" #include "macroexp.h" diff --git a/gdb/cli-out.c b/gdb/cli-out.c index e3b45cd..38bf36f 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -1,6 +1,6 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -33,6 +33,7 @@ struct ui_out_data struct ui_file *stream; int suppress_output; }; +typedef struct ui_out_data cli_out_data; /* These are the CLI output functions */ @@ -110,7 +111,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (nr_rows == 0) data->suppress_output = 1; else @@ -124,7 +125,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols, void cli_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* first, close the table header line */ @@ -136,7 +137,7 @@ cli_table_body (struct ui_out *uiout) void cli_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); data->suppress_output = 0; } @@ -147,7 +148,7 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; cli_field_string (uiout, 0, width, alignment, 0, colhdr); @@ -161,7 +162,7 @@ cli_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -173,7 +174,7 @@ cli_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -187,7 +188,7 @@ cli_field_int (struct ui_out *uiout, int fldno, int width, { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; sprintf (buffer, "%d", value); @@ -201,7 +202,7 @@ cli_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; cli_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -221,7 +222,7 @@ cli_field_string (struct ui_out *uiout, int before = 0; int after = 0; - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -268,7 +269,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -281,7 +282,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno, void cli_spaces (struct ui_out *uiout, int numspaces) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; print_spaces_filtered (numspaces, data->stream); @@ -290,7 +291,7 @@ cli_spaces (struct ui_out *uiout, int numspaces) void cli_text (struct ui_out *uiout, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; fputs_filtered (string, data->stream); @@ -300,7 +301,7 @@ void cli_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if (ui_out_get_verblvl (uiout) >= verbosity) @@ -310,7 +311,7 @@ cli_message (struct ui_out *uiout, int verbosity, void cli_wrap_hint (struct ui_out *uiout, char *identstring) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; wrap_here (identstring); @@ -319,7 +320,7 @@ cli_wrap_hint (struct ui_out *uiout, char *identstring) void cli_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); gdb_flush (data->stream); } @@ -334,7 +335,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, const char *fldname, const char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); va_list args; va_start (args, format); @@ -348,7 +349,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, static void field_separator (void) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); fputc_filtered (' ', data->stream); } @@ -359,7 +360,7 @@ cli_out_new (struct ui_file *stream) { int flags = ui_source_list; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + cli_out_data *data = XMALLOC (cli_out_data); data->stream = stream; data->suppress_output = 0; return ui_out_new (&cli_ui_out_impl, data, flags); @@ -368,7 +369,7 @@ cli_out_new (struct ui_file *stream) struct ui_file * cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream) { - struct ui_out_data *data = ui_out_data (uiout); + cli_out_data *data = ui_out_data (uiout); struct ui_file *old = data->stream; data->stream = stream; return old; diff --git a/gdb/cli-out.h b/gdb/cli-out.h index a984d05..8bca872 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -22,6 +22,8 @@ #ifndef CLI_OUT_H #define CLI_OUT_H +struct ui_file; + extern struct ui_out *cli_out_new (struct ui_file *stream); extern struct ui_file *cli_out_set_stream (struct ui_out *uiout, diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 108329a..c33c242 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -171,6 +171,10 @@ struct cmd_list_element *maintenanceinfolist; struct cmd_list_element *maintenanceprintlist; +/* Chain containing all defined "maintenance list" subcommands. */ + +struct cmd_list_element *maintenancelistlist; + struct cmd_list_element *setprintlist; struct cmd_list_element *showprintlist; @@ -1032,6 +1036,7 @@ init_cmd_lists (void) maintenancelist = NULL; maintenanceinfolist = NULL; maintenanceprintlist = NULL; + maintenancelistlist = NULL; setprintlist = NULL; showprintlist = NULL; setchecklist = NULL; diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index a6e574e..1f340ef 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -87,6 +87,10 @@ extern struct cmd_list_element *maintenanceinfolist; extern struct cmd_list_element *maintenanceprintlist; +/* Chain containing all defined "maintenance list" subcommands. */ + +extern struct cmd_list_element *maintenancelistlist; + extern struct cmd_list_element *setprintlist; extern struct cmd_list_element *showprintlist; diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h index 898e3cc..03cb841 100644 --- a/gdb/cli/cli-script.h +++ b/gdb/cli/cli-script.h @@ -19,6 +19,10 @@ #if !defined (CLI_SCRIPT_H) #define CLI_SCRIPT_H 1 +struct ui_file; +struct command_line; +struct cmd_list_element; + /* Exported to cli/cli-cmds.c */ extern void script_from_file (FILE *stream, char *file); diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h index 393612a..470b8b7 100644 --- a/gdb/cli/cli-setshow.h +++ b/gdb/cli/cli-setshow.h @@ -19,6 +19,8 @@ #if !defined (CLI_SETSHOW_H) #define CLI_SETSHOW_H 1 +struct cmd_list_element; + /* Exported to cli/cli-cmds.c and gdb/top.c */ /* Do a "set" or "show" command. ARG is NULL if no argument, or the text diff --git a/gdb/config/i386/cygwin.mt b/gdb/config/i386/cygwin.mt index 4dfc0c2..6c16345 100644 --- a/gdb/config/i386/cygwin.mt +++ b/gdb/config/i386/cygwin.mt @@ -1,5 +1,5 @@ # Target: Intel 386 run win32 -TDEPFILES= i386-tdep.o i387-tdep.o +TDEPFILES= i386-tdep.o i386-cygwin-tdep.o i387-tdep.o TM_FILE= tm-cygwin.h diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h index 9c8f41c..74db165 100644 --- a/gdb/config/i386/nm-ptx4.h +++ b/gdb/config/i386/nm-ptx4.h @@ -1,66 +1,66 @@ -/* Definitions to make GDB run on a Sequent Symmetry under ptx - with Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - -#include "config/nm-sysv4.h" - -#undef USE_PROC_FS - -#include "i386/nm-symmetry.h" - -#define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0) -#define PTRACE_WRITE_REGS(pid,regaddr) \ - mptrace (XPT_WREGS, (pid), (regaddr), 0) - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ - -#define FETCH_INFERIOR_REGISTERS - -/* We must fetch all the regs before storing, since we store all at once. */ - -#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) - -#define CHILD_WAIT -struct target_waitstatus; -extern ptid_t child_wait (ptid_t, struct target_waitstatus *); - -/* - * ptx does attach as of ptx version 2.1. Prior to that, the interface - * exists but does not work. - * - * FIXME: Using attach/detach requires using the ptx MPDEBUGGER - * interface. There are still problems with that, so for now don't - * enable attach/detach. If you turn it on anyway, it will mostly - * work, but has a number of bugs. -fubar, 2/94. - */ -/*#define ATTACH_DETACH 1 */ -#undef ATTACH_DETACH -#define PTRACE_ATTACH XPT_DEBUG -#define PTRACE_DETACH XPT_UNDEBUG -/* - * The following drivel is needed because there are two ptrace-ish - * calls on ptx: ptrace() and mptrace(), each of which does about half - * of the ptrace functions. - */ -#define PTRACE_ATTACH_CALL(pid) ptx_do_attach(pid) -#define PTRACE_DETACH_CALL(pid, signo) ptx_do_detach(pid, signo) +// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx +// OBSOLETE with Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #include "config/nm-sysv4.h" +// OBSOLETE +// OBSOLETE #undef USE_PROC_FS +// OBSOLETE +// OBSOLETE #include "i386/nm-symmetry.h" +// OBSOLETE +// OBSOLETE #define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0) +// OBSOLETE #define PTRACE_WRITE_REGS(pid,regaddr) \ +// OBSOLETE mptrace (XPT_WREGS, (pid), (regaddr), 0) +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* We must fetch all the regs before storing, since we store all at once. */ +// OBSOLETE +// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) +// OBSOLETE +// OBSOLETE #define CHILD_WAIT +// OBSOLETE struct target_waitstatus; +// OBSOLETE extern ptid_t child_wait (ptid_t, struct target_waitstatus *); +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * ptx does attach as of ptx version 2.1. Prior to that, the interface +// OBSOLETE * exists but does not work. +// OBSOLETE * +// OBSOLETE * FIXME: Using attach/detach requires using the ptx MPDEBUGGER +// OBSOLETE * interface. There are still problems with that, so for now don't +// OBSOLETE * enable attach/detach. If you turn it on anyway, it will mostly +// OBSOLETE * work, but has a number of bugs. -fubar, 2/94. +// OBSOLETE */ +// OBSOLETE /*#define ATTACH_DETACH 1 */ +// OBSOLETE #undef ATTACH_DETACH +// OBSOLETE #define PTRACE_ATTACH XPT_DEBUG +// OBSOLETE #define PTRACE_DETACH XPT_UNDEBUG +// OBSOLETE /* +// OBSOLETE * The following drivel is needed because there are two ptrace-ish +// OBSOLETE * calls on ptx: ptrace() and mptrace(), each of which does about half +// OBSOLETE * of the ptrace functions. +// OBSOLETE */ +// OBSOLETE #define PTRACE_ATTACH_CALL(pid) ptx_do_attach(pid) +// OBSOLETE #define PTRACE_DETACH_CALL(pid, signo) ptx_do_detach(pid, signo) diff --git a/gdb/config/i386/nm-symmetry.h b/gdb/config/i386/nm-symmetry.h index d3f57e6..72b7d8d 100644 --- a/gdb/config/i386/nm-symmetry.h +++ b/gdb/config/i386/nm-symmetry.h @@ -1,50 +1,50 @@ -/* Definitions to make GDB run on a Sequent Symmetry under dynix 3.0, - with Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1998, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ - -#define FETCH_INFERIOR_REGISTERS - -/* We must fetch all the regs before storing, since we store all at once. */ - -#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) - -#ifdef _SEQUENT_ -#define CHILD_WAIT -extern ptid_t child_wait (ptid_t, struct target_waitstatus *); -#endif - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -#ifdef _SEQUENT_ -#include <sys/param.h> -#include <sys/user.h> -#include <sys/mc_vmparam.h> -/* VA_UAREA is defined in <sys/mc_vmparam.h>, and is dependant upon - sizeof(struct user) */ -#define KERNEL_U_ADDR (VA_UAREA) /* ptx */ -#else -#define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) /* dynix */ -#endif +// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under dynix 3.0, +// OBSOLETE with Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1998, 2000 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ +// OBSOLETE +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* We must fetch all the regs before storing, since we store all at once. */ +// OBSOLETE +// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) +// OBSOLETE +// OBSOLETE #ifdef _SEQUENT_ +// OBSOLETE #define CHILD_WAIT +// OBSOLETE extern ptid_t child_wait (ptid_t, struct target_waitstatus *); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* This is the amount to subtract from u.u_ar0 +// OBSOLETE to get the offset in the core file of the register values. */ +// OBSOLETE +// OBSOLETE #ifdef _SEQUENT_ +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/user.h> +// OBSOLETE #include <sys/mc_vmparam.h> +// OBSOLETE /* VA_UAREA is defined in <sys/mc_vmparam.h>, and is dependant upon +// OBSOLETE sizeof(struct user) */ +// OBSOLETE #define KERNEL_U_ADDR (VA_UAREA) /* ptx */ +// OBSOLETE #else +// OBSOLETE #define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) /* dynix */ +// OBSOLETE #endif diff --git a/gdb/config/i386/ptx.mh b/gdb/config/i386/ptx.mh index 554b411..048f5e5 100644 --- a/gdb/config/i386/ptx.mh +++ b/gdb/config/i386/ptx.mh @@ -1,7 +1,7 @@ -# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387 - -XM_FILE= xm-ptx.h -NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o -XM_CLIBS= -lPW -lseq - -NAT_FILE= nm-symmetry.h +# OBSOLETE # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387 +# OBSOLETE +# OBSOLETE XM_FILE= xm-ptx.h +# OBSOLETE NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o +# OBSOLETE XM_CLIBS= -lPW -lseq +# OBSOLETE +# OBSOLETE NAT_FILE= nm-symmetry.h diff --git a/gdb/config/i386/ptx.mt b/gdb/config/i386/ptx.mt index 757df33..e9551e2 100644 --- a/gdb/config/i386/ptx.mt +++ b/gdb/config/i386/ptx.mt @@ -1,3 +1,3 @@ -# Target: Sequent Symmetry running ptx 2.0, with Weitek 1167 or i387. -TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o -TM_FILE= tm-ptx.h +# OBSOLETE # Target: Sequent Symmetry running ptx 2.0, with Weitek 1167 or i387. +# OBSOLETE TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o +# OBSOLETE TM_FILE= tm-ptx.h diff --git a/gdb/config/i386/ptx4.mh b/gdb/config/i386/ptx4.mh index e4aa55e..4d23635 100644 --- a/gdb/config/i386/ptx4.mh +++ b/gdb/config/i386/ptx4.mh @@ -1,8 +1,8 @@ -# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387 - -XM_FILE= xm-ptx4.h -NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o \ - core-regset.o solib.o solib-svr4.o solib-legacy.o -XM_CLIBS= -lseq - -NAT_FILE= nm-ptx4.h +# OBSOLETE # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387 +# OBSOLETE +# OBSOLETE XM_FILE= xm-ptx4.h +# OBSOLETE NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o \ +# OBSOLETE core-regset.o solib.o solib-svr4.o solib-legacy.o +# OBSOLETE XM_CLIBS= -lseq +# OBSOLETE +# OBSOLETE NAT_FILE= nm-ptx4.h diff --git a/gdb/config/i386/ptx4.mt b/gdb/config/i386/ptx4.mt index f347809..ad268f8 100644 --- a/gdb/config/i386/ptx4.mt +++ b/gdb/config/i386/ptx4.mt @@ -1,3 +1,3 @@ -# Target: Sequent Symmetry running ptx 4.0, with Weitek 1167 or i387. -TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o -TM_FILE= tm-ptx4.h +# OBSOLETE # Target: Sequent Symmetry running ptx 4.0, with Weitek 1167 or i387. +# OBSOLETE TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o +# OBSOLETE TM_FILE= tm-ptx4.h diff --git a/gdb/config/i386/symmetry.mh b/gdb/config/i386/symmetry.mh index 486a2fb..19c5264 100644 --- a/gdb/config/i386/symmetry.mh +++ b/gdb/config/i386/symmetry.mh @@ -1,4 +1,4 @@ -# Host: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387. -XM_FILE= xm-symmetry.h -NAT_FILE= nm-symmetry.h -NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o symm-nat.o +# OBSOLETE # Host: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387. +# OBSOLETE XM_FILE= xm-symmetry.h +# OBSOLETE NAT_FILE= nm-symmetry.h +# OBSOLETE NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o symm-nat.o diff --git a/gdb/config/i386/symmetry.mt b/gdb/config/i386/symmetry.mt index a3dba70..8fccbd2 100644 --- a/gdb/config/i386/symmetry.mt +++ b/gdb/config/i386/symmetry.mt @@ -1,3 +1,3 @@ -# Target: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387. -TDEPFILES= i386-tdep.o symm-tdep.o i387-tdep.o -TM_FILE= tm-symmetry.h +# OBSOLETE # Target: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387. +# OBSOLETE TDEPFILES= i386-tdep.o symm-tdep.o i387-tdep.o +# OBSOLETE TM_FILE= tm-symmetry.h diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h index 80026e3..4d3ba83 100644 --- a/gdb/config/i386/tm-ptx.h +++ b/gdb/config/i386/tm-ptx.h @@ -1,200 +1,194 @@ -/* Target machine definitions for GDB on a Sequent Symmetry under ptx - with Weitek 1167 and i387 support. - - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000, - 2003 Free Software Foundation, Inc. - - Symmetry version by Jay Vosburgh (fubar@sequent.com). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_PTX_H -#define TM_PTX_H 1 - -/* I don't know if this will work for cross-debugging, even if you do get - a copy of the right include file. */ - -#include <sys/reg.h> - -#ifdef SEQUENT_PTX4 -#include "i386/tm-i386.h" -#else /* !SEQUENT_PTX4 */ -#include "i386/tm-i386.h" -#endif - -/* Amount PC must be decremented by after a breakpoint. This is often the - number of bytes in BREAKPOINT but not always (such as now). */ - -#undef DECR_PC_AFTER_BREAK -#define DECR_PC_AFTER_BREAK 0 - -/* Number of machine registers */ - -#undef NUM_REGS -#define NUM_REGS 49 - -/* Initializer for an array of names of registers. There should be at least - NUM_REGS strings in this initializer. Any excess ones are simply ignored. - The order of the first 8 registers must match the compiler's numbering - scheme (which is the same as the 386 scheme) and also regmap in the various - *-nat.c files. */ - -#undef REGISTER_NAME -#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ - "esp", "ebp", "esi", "edi", \ - "eip", "eflags", "st0", "st1", \ - "st2", "st3", "st4", "st5", \ - "st6", "st7", "fp1", "fp2", \ - "fp3", "fp4", "fp5", "fp6", \ - "fp7", "fp8", "fp9", "fp10", \ - "fp11", "fp12", "fp13", "fp14", \ - "fp15", "fp16", "fp17", "fp18", \ - "fp19", "fp20", "fp21", "fp22", \ - "fp23", "fp24", "fp25", "fp26", \ - "fp27", "fp28", "fp29", "fp30", \ - "fp31" } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define EAX_REGNUM 0 -#define ECX_REGNUM 1 -#define EDX_REGNUM 2 -#define EBX_REGNUM 3 - -#define ESP_REGNUM 4 -#define EBP_REGNUM 5 - -#define ESI_REGNUM 6 -#define EDI_REGNUM 7 - -#define EIP_REGNUM 8 -#define EFLAGS_REGNUM 9 - -#define ST0_REGNUM 10 -#define ST1_REGNUM 11 -#define ST2_REGNUM 12 -#define ST3_REGNUM 13 - -#define ST4_REGNUM 14 -#define ST5_REGNUM 15 -#define ST6_REGNUM 16 -#define ST7_REGNUM 17 - -#define FP1_REGNUM 18 /* first 1167 register */ -/* Get %fp2 - %fp31 by addition, since they are contiguous */ - -#undef SP_REGNUM -#define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */ -#undef FP_REGNUM -#define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */ -#undef PC_REGNUM -#define PC_REGNUM EIP_REGNUM /* Contains program counter */ -#undef PS_REGNUM -#define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */ - -/* - * For ptx, this is a little bit bizarre, since the register block - * is below the u area in memory. This means that blockend here ends - * up being negative (for the call from coredep.c) since the value in - * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us - * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define - * FETCH_INFERIOR_REGISTERS (and supply our own functions for that), - * the core file case will be the only use of this function. - */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ (addr) = ptx_register_u_addr((blockend), (regno)); } - -extern int ptx_register_u_addr (int, int); - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. 10 i*86 registers, 8 i387 - registers, and 31 Weitek 1167 registers */ - -#undef REGISTER_BYTES -#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#undef DEPRECATED_MAX_REGISTER_RAW_SIZE -#define DEPRECATED_MAX_REGISTER_RAW_SIZE 10 - -/* Nonzero if register N requires conversion - from raw format to virtual format. */ - -#undef REGISTER_CONVERTIBLE -#define REGISTER_CONVERTIBLE(N) \ -((N < ST0_REGNUM) ? 0 : \ - (N < FP1_REGNUM) ? 1 : \ - 0) - -/* Convert data from raw format for register REGNUM - to virtual format for register REGNUM. */ -extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ - -#undef REGISTER_CONVERT_TO_VIRTUAL -#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ -((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \ - (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \ - (FROM),(TO)) : \ - (void)memcpy ((TO), (FROM), 4)) - -/* Convert data from virtual format for register REGNUM - to raw format for register REGNUM. */ - -#undef REGISTER_CONVERT_TO_RAW -#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ -((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \ - (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \ - (FROM),(TO)) : \ - (void)memcpy ((TO), (FROM), 4)) - -/* Return the GDB type object for the "standard" data type - of data in register N. */ -/* - * Note: the 1167 registers (the last line, builtin_type_float) are - * generally used in pairs, with each pair being treated as a double. - * It it also possible to use them singly as floats. I'm not sure how - * in gdb to treat the register pair pseudo-doubles. -fubar - */ -#undef REGISTER_VIRTUAL_TYPE -#define REGISTER_VIRTUAL_TYPE(N) \ -((N < ST0_REGNUM) ? builtin_type_int : \ - (N < FP1_REGNUM) ? builtin_type_double : \ - builtin_type_float) - -/* 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. */ - -#undef DEPRECATED_EXTRACT_RETURN_VALUE -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - symmetry_extract_return_value(TYPE, REGBUF, VALBUF) - -/* - #undef FRAME_FIND_SAVED_REGS - #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); } - */ - -#endif /* ifndef TM_PTX_H */ +// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under ptx +// OBSOLETE with Weitek 1167 and i387 support. +// OBSOLETE +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000, +// OBSOLETE 2003 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com). +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef TM_PTX_H +// OBSOLETE #define TM_PTX_H 1 +// OBSOLETE +// OBSOLETE /* I don't know if this will work for cross-debugging, even if you do get +// OBSOLETE a copy of the right include file. */ +// OBSOLETE +// OBSOLETE #include <sys/reg.h> +// OBSOLETE +// OBSOLETE #ifdef SEQUENT_PTX4 +// OBSOLETE #include "i386/tm-i386.h" +// OBSOLETE #else /* !SEQUENT_PTX4 */ +// OBSOLETE #include "i386/tm-i386.h" +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Amount PC must be decremented by after a breakpoint. This is often the +// OBSOLETE number of bytes in BREAKPOINT but not always (such as now). */ +// OBSOLETE +// OBSOLETE #undef DECR_PC_AFTER_BREAK +// OBSOLETE #define DECR_PC_AFTER_BREAK 0 +// OBSOLETE +// OBSOLETE /* Number of machine registers */ +// OBSOLETE +// OBSOLETE #undef NUM_REGS +// OBSOLETE #define NUM_REGS 49 +// OBSOLETE +// OBSOLETE /* Initializer for an array of names of registers. There should be at least +// OBSOLETE NUM_REGS strings in this initializer. Any excess ones are simply ignored. +// OBSOLETE The order of the first 8 registers must match the compiler's numbering +// OBSOLETE scheme (which is the same as the 386 scheme) and also regmap in the various +// OBSOLETE *-nat.c files. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_NAME +// OBSOLETE #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ +// OBSOLETE "esp", "ebp", "esi", "edi", \ +// OBSOLETE "eip", "eflags", "st0", "st1", \ +// OBSOLETE "st2", "st3", "st4", "st5", \ +// OBSOLETE "st6", "st7", "fp1", "fp2", \ +// OBSOLETE "fp3", "fp4", "fp5", "fp6", \ +// OBSOLETE "fp7", "fp8", "fp9", "fp10", \ +// OBSOLETE "fp11", "fp12", "fp13", "fp14", \ +// OBSOLETE "fp15", "fp16", "fp17", "fp18", \ +// OBSOLETE "fp19", "fp20", "fp21", "fp22", \ +// OBSOLETE "fp23", "fp24", "fp25", "fp26", \ +// OBSOLETE "fp27", "fp28", "fp29", "fp30", \ +// OBSOLETE "fp31" } +// OBSOLETE +// OBSOLETE /* Register numbers of various important registers. +// OBSOLETE Note that some of these values are "real" register numbers, +// OBSOLETE and correspond to the general registers of the machine, +// OBSOLETE and some are "phony" register numbers which are too large +// OBSOLETE to be actual register numbers as far as the user is concerned +// OBSOLETE but do serve to get the desired values when passed to read_register. */ +// OBSOLETE +// OBSOLETE #define EAX_REGNUM 0 +// OBSOLETE #define ECX_REGNUM 1 +// OBSOLETE #define EDX_REGNUM 2 +// OBSOLETE #define EBX_REGNUM 3 +// OBSOLETE +// OBSOLETE #define ESP_REGNUM 4 +// OBSOLETE #define EBP_REGNUM 5 +// OBSOLETE +// OBSOLETE #define ESI_REGNUM 6 +// OBSOLETE #define EDI_REGNUM 7 +// OBSOLETE +// OBSOLETE #define EIP_REGNUM 8 +// OBSOLETE #define EFLAGS_REGNUM 9 +// OBSOLETE +// OBSOLETE #define ST0_REGNUM 10 +// OBSOLETE #define ST1_REGNUM 11 +// OBSOLETE #define ST2_REGNUM 12 +// OBSOLETE #define ST3_REGNUM 13 +// OBSOLETE +// OBSOLETE #define ST4_REGNUM 14 +// OBSOLETE #define ST5_REGNUM 15 +// OBSOLETE #define ST6_REGNUM 16 +// OBSOLETE #define ST7_REGNUM 17 +// OBSOLETE +// OBSOLETE #define FP1_REGNUM 18 /* first 1167 register */ +// OBSOLETE /* Get %fp2 - %fp31 by addition, since they are contiguous */ +// OBSOLETE +// OBSOLETE #undef SP_REGNUM +// OBSOLETE #define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */ +// OBSOLETE #undef FP_REGNUM +// OBSOLETE #define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */ +// OBSOLETE #undef PC_REGNUM +// OBSOLETE #define PC_REGNUM EIP_REGNUM /* Contains program counter */ +// OBSOLETE #undef PS_REGNUM +// OBSOLETE #define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */ +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * For ptx, this is a little bit bizarre, since the register block +// OBSOLETE * is below the u area in memory. This means that blockend here ends +// OBSOLETE * up being negative (for the call from coredep.c) since the value in +// OBSOLETE * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us +// OBSOLETE * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define +// OBSOLETE * FETCH_INFERIOR_REGISTERS (and supply our own functions for that), +// OBSOLETE * the core file case will be the only use of this function. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { (addr) = ptx_register_u_addr((blockend), (regno)); } +// OBSOLETE +// OBSOLETE extern int ptx_register_u_addr (int, int); +// OBSOLETE +// OBSOLETE /* Total amount of space needed to store our copies of the machine's +// OBSOLETE register state, the array `registers'. 10 i*86 registers, 8 i387 +// OBSOLETE registers, and 31 Weitek 1167 registers */ +// OBSOLETE +// OBSOLETE #undef REGISTER_BYTES +// OBSOLETE #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) +// OBSOLETE +// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */ +// OBSOLETE +// OBSOLETE #undef DEPRECATED_MAX_REGISTER_RAW_SIZE +// OBSOLETE #define DEPRECATED_MAX_REGISTER_RAW_SIZE 10 +// OBSOLETE +// OBSOLETE /* Nonzero if register N requires conversion +// OBSOLETE from raw format to virtual format. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERTIBLE +// OBSOLETE #define REGISTER_CONVERTIBLE(N) \ +// OBSOLETE ((N < ST0_REGNUM) ? 0 : \ +// OBSOLETE (N < FP1_REGNUM) ? 1 : \ +// OBSOLETE 0) +// OBSOLETE +// OBSOLETE /* Convert data from raw format for register REGNUM +// OBSOLETE to virtual format for register REGNUM. */ +// OBSOLETE extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERT_TO_VIRTUAL +// OBSOLETE #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ +// OBSOLETE ((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \ +// OBSOLETE (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \ +// OBSOLETE (FROM),(TO)) : \ +// OBSOLETE (void)memcpy ((TO), (FROM), 4)) +// OBSOLETE +// OBSOLETE /* Convert data from virtual format for register REGNUM +// OBSOLETE to raw format for register REGNUM. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERT_TO_RAW +// OBSOLETE #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ +// OBSOLETE ((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \ +// OBSOLETE (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \ +// OBSOLETE (FROM),(TO)) : \ +// OBSOLETE (void)memcpy ((TO), (FROM), 4)) +// OBSOLETE +// OBSOLETE /* Return the GDB type object for the "standard" data type +// OBSOLETE of data in register N. */ +// OBSOLETE /* +// OBSOLETE * Note: the 1167 registers (the last line, builtin_type_float) are +// OBSOLETE * generally used in pairs, with each pair being treated as a double. +// OBSOLETE * It it also possible to use them singly as floats. I'm not sure how +// OBSOLETE * in gdb to treat the register pair pseudo-doubles. -fubar +// OBSOLETE */ +// OBSOLETE #undef REGISTER_VIRTUAL_TYPE +// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ +// OBSOLETE ((N < ST0_REGNUM) ? builtin_type_int : \ +// OBSOLETE (N < FP1_REGNUM) ? builtin_type_double : \ +// OBSOLETE builtin_type_float) +// OBSOLETE +// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state +// OBSOLETE a function return value of type TYPE, and copy that, in virtual format, +// OBSOLETE into VALBUF. */ +// OBSOLETE +// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE +// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +// OBSOLETE symmetry_extract_return_value(TYPE, REGBUF, VALBUF) +// OBSOLETE +// OBSOLETE #endif /* ifndef TM_PTX_H */ diff --git a/gdb/config/i386/tm-ptx4.h b/gdb/config/i386/tm-ptx4.h index a13d4a6..5f83db4 100644 --- a/gdb/config/i386/tm-ptx4.h +++ b/gdb/config/i386/tm-ptx4.h @@ -1,26 +1,26 @@ -/* Target machine definitions for GDB on a Sequent Symmetry under ptx - with Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994 - Free Software Foundation, Inc. - Symmetry version by Jay Vosburgh (fubar@sequent.com). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define SEQUENT_PTX4 - -#include "i386/tm-ptx.h" +// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under ptx +// OBSOLETE with Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com). +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define SEQUENT_PTX4 +// OBSOLETE +// OBSOLETE #include "i386/tm-ptx.h" diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index a15f45f..c8680a3 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -1,291 +1,291 @@ -/* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0, - with Weitek 1167 and i387 support. - - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2003 Free - Software Foundation, Inc. - - Symmetry version by Jay Vosburgh (fubar@sequent.com). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_SYMMETRY_H -#define TM_SYMMETRY_H 1 - -#include "regcache.h" -#include "doublest.h" - -/* I don't know if this will work for cross-debugging, even if you do get - a copy of the right include file. */ -#include <machine/reg.h> - -#include "i386/tm-i386.h" - -/* Amount PC must be decremented by after a breakpoint. This is often the - number of bytes in BREAKPOINT but not always (such as now). */ - -#undef DECR_PC_AFTER_BREAK -#define DECR_PC_AFTER_BREAK 0 - -/* Number of machine registers */ - -#undef NUM_REGS -#define NUM_REGS 49 - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -/* Initializer for an array of names of registers. There should be at least - NUM_REGS strings in this initializer. Any excess ones are simply ignored. - Symmetry registers are in this weird order to match the register numbers - in the symbol table entries. If you change the order, things will probably - break mysteriously for no apparent reason. Also note that the st(0)... - st(7) 387 registers are represented as st0...st7. */ - -#undef REGISTER_NAME -#define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \ - "ebx", "esi", "edi", "st2", "st3", \ - "st4", "st5", "st6", "st7", "esp", \ - "ebp", "eip", "eflags","fp1", "fp2", \ - "fp3", "fp4", "fp5", "fp6", "fp7", \ - "fp8", "fp9", "fp10", "fp11", "fp12", \ - "fp13", "fp14", "fp15", "fp16", "fp17", \ - "fp18", "fp19", "fp20", "fp21", "fp22", \ - "fp23", "fp24", "fp25", "fp26", "fp27", \ - "fp28", "fp29", "fp30", "fp31" } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define EAX_REGNUM 0 -#define EDX_REGNUM 1 -#define ECX_REGNUM 2 -#define ST0_REGNUM 3 -#define ST1_REGNUM 4 -#define EBX_REGNUM 5 -#define ESI_REGNUM 6 -#define EDI_REGNUM 7 -#define ST2_REGNUM 8 -#define ST3_REGNUM 9 - -#define ST4_REGNUM 10 -#define ST5_REGNUM 11 -#define ST6_REGNUM 12 -#define ST7_REGNUM 13 - -#define FP1_REGNUM 18 /* first 1167 register */ -/* Get %fp2 - %fp31 by addition, since they are contiguous */ - -#undef SP_REGNUM -#define SP_REGNUM 14 /* (usp) Contains address of top of stack */ -#define ESP_REGNUM 14 -#undef FP_REGNUM -#define FP_REGNUM 15 /* (ebp) Contains address of executing stack frame */ -#define EBP_REGNUM 15 -#undef PC_REGNUM -#define PC_REGNUM 16 /* (eip) Contains program counter */ -#define EIP_REGNUM 16 -#undef PS_REGNUM -#define PS_REGNUM 17 /* (ps) Contains processor status */ -#define EFLAGS_REGNUM 17 - -/* - * Following macro translates i386 opcode register numbers to Symmetry - * register numbers. This is used by i386_frame_find_saved_regs. - * - * %eax %ecx %edx %ebx %esp %ebp %esi %edi - * i386 0 1 2 3 4 5 6 7 - * Symmetry 0 2 1 5 14 15 6 7 - * - */ -#define I386_REGNO_TO_SYMMETRY(n) \ -((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n)) - -/* The magic numbers below are offsets into u_ar0 in the user struct. - * They live in <machine/reg.h>. Gdb calls this macro with blockend - * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are - * saved in the u area (along with a few others that aren't useful - * here. See <machine/reg.h>). - */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ struct user foo; /* needed for finding fpu regs */ \ -switch (regno) { \ - case 0: \ - addr = blockend + EAX * sizeof(int); break; \ - case 1: \ - addr = blockend + EDX * sizeof(int); break; \ - case 2: \ - addr = blockend + ECX * sizeof(int); break; \ - case 3: /* st(0) */ \ - addr = ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \ - break; \ - case 4: /* st(1) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \ - break; \ - case 5: \ - addr = blockend + EBX * sizeof(int); break; \ - case 6: \ - addr = blockend + ESI * sizeof(int); break; \ - case 7: \ - addr = blockend + EDI * sizeof(int); break; \ - case 8: /* st(2) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \ - break; \ - case 9: /* st(3) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \ - break; \ - case 10: /* st(4) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \ - break; \ - case 11: /* st(5) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \ - break; \ - case 12: /* st(6) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \ - break; \ - case 13: /* st(7) */ \ - addr = ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \ - break; \ - case 14: \ - addr = blockend + ESP * sizeof(int); break; \ - case 15: \ - addr = blockend + EBP * sizeof(int); break; \ - case 16: \ - addr = blockend + EIP * sizeof(int); break; \ - case 17: \ - addr = blockend + FLAGS * sizeof(int); break; \ - case 18: /* fp1 */ \ - case 19: /* fp2 */ \ - case 20: /* fp3 */ \ - case 21: /* fp4 */ \ - case 22: /* fp5 */ \ - case 23: /* fp6 */ \ - case 24: /* fp7 */ \ - case 25: /* fp8 */ \ - case 26: /* fp9 */ \ - case 27: /* fp10 */ \ - case 28: /* fp11 */ \ - case 29: /* fp12 */ \ - case 30: /* fp13 */ \ - case 31: /* fp14 */ \ - case 32: /* fp15 */ \ - case 33: /* fp16 */ \ - case 34: /* fp17 */ \ - case 35: /* fp18 */ \ - case 36: /* fp19 */ \ - case 37: /* fp20 */ \ - case 38: /* fp21 */ \ - case 39: /* fp22 */ \ - case 40: /* fp23 */ \ - case 41: /* fp24 */ \ - case 42: /* fp25 */ \ - case 43: /* fp26 */ \ - case 44: /* fp27 */ \ - case 45: /* fp28 */ \ - case 46: /* fp29 */ \ - case 47: /* fp30 */ \ - case 48: /* fp31 */ \ - addr = ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \ - } \ -} - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. 10 i*86 registers, 8 i387 - registers, and 31 Weitek 1167 registers */ - -#undef REGISTER_BYTES -#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) - -/* Nonzero if register N requires conversion - from raw format to virtual format. */ - -#undef REGISTER_CONVERTIBLE -#define REGISTER_CONVERTIBLE(N) \ -(((N) < 3) ? 0 : \ -((N) < 5) ? 1 : \ -((N) < 8) ? 0 : \ -((N) < 14) ? 1 : \ - 0) - -#include "floatformat.h" - -/* Convert data from raw format for register REGNUM in buffer FROM - to virtual format with type TYPE in buffer TO. */ - -#undef REGISTER_CONVERT_TO_VIRTUAL -#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ -{ \ - DOUBLEST val; \ - floatformat_to_doublest (&floatformat_i387_ext, (FROM), &val); \ - store_floating ((TO), TYPE_LENGTH (TYPE), val); \ -} - -/* Convert data from virtual format with type TYPE in buffer FROM - to raw format for register REGNUM in buffer TO. */ - -#undef REGISTER_CONVERT_TO_RAW -#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ -{ \ - DOUBLEST val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ - floatformat_from_doublest (&floatformat_i387_ext, &val, (TO)); \ -} - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#undef REGISTER_VIRTUAL_TYPE -#define REGISTER_VIRTUAL_TYPE(N) \ -((N < 3) ? builtin_type_int : \ -(N < 5) ? builtin_type_double : \ -(N < 8) ? builtin_type_int : \ -(N < 14) ? builtin_type_double : \ - builtin_type_int) - -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. - Native cc passes the address in eax, gcc (up to version 2.5.8) - passes it on the stack. gcc should be fixed in future versions to - adopt native cc conventions. */ - -#undef PUSH_ARGUMENTS -#undef STORE_STRUCT_RETURN -#define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR)) - -/* 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. */ - -#undef DEPRECATED_EXTRACT_RETURN_VALUE -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - symmetry_extract_return_value(TYPE, REGBUF, VALBUF) - -/* The following redefines make backtracing through sigtramp work. - They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp - from the sigcontext structure which is pushed by the kernel on the - user stack, along with a pointer to it. */ - -#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", name)) - -/* Offset to saved PC in sigcontext, from <signal.h>. */ -#define SIGCONTEXT_PC_OFFSET 16 - -#endif /* ifndef TM_SYMMETRY_H */ +// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0, +// OBSOLETE with Weitek 1167 and i387 support. +// OBSOLETE +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2003 Free +// OBSOLETE Software Foundation, Inc. +// OBSOLETE +// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com). +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef TM_SYMMETRY_H +// OBSOLETE #define TM_SYMMETRY_H 1 +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE #include "doublest.h" +// OBSOLETE +// OBSOLETE /* I don't know if this will work for cross-debugging, even if you do get +// OBSOLETE a copy of the right include file. */ +// OBSOLETE #include <machine/reg.h> +// OBSOLETE +// OBSOLETE #include "i386/tm-i386.h" +// OBSOLETE +// OBSOLETE /* Amount PC must be decremented by after a breakpoint. This is often the +// OBSOLETE number of bytes in BREAKPOINT but not always (such as now). */ +// OBSOLETE +// OBSOLETE #undef DECR_PC_AFTER_BREAK +// OBSOLETE #define DECR_PC_AFTER_BREAK 0 +// OBSOLETE +// OBSOLETE /* Number of machine registers */ +// OBSOLETE +// OBSOLETE #undef NUM_REGS +// OBSOLETE #define NUM_REGS 49 +// OBSOLETE +// OBSOLETE /* Initializer for an array of names of registers. +// OBSOLETE There should be NUM_REGS strings in this initializer. */ +// OBSOLETE +// OBSOLETE /* Initializer for an array of names of registers. There should be at least +// OBSOLETE NUM_REGS strings in this initializer. Any excess ones are simply ignored. +// OBSOLETE Symmetry registers are in this weird order to match the register numbers +// OBSOLETE in the symbol table entries. If you change the order, things will probably +// OBSOLETE break mysteriously for no apparent reason. Also note that the st(0)... +// OBSOLETE st(7) 387 registers are represented as st0...st7. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_NAME +// OBSOLETE #define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \ +// OBSOLETE "ebx", "esi", "edi", "st2", "st3", \ +// OBSOLETE "st4", "st5", "st6", "st7", "esp", \ +// OBSOLETE "ebp", "eip", "eflags","fp1", "fp2", \ +// OBSOLETE "fp3", "fp4", "fp5", "fp6", "fp7", \ +// OBSOLETE "fp8", "fp9", "fp10", "fp11", "fp12", \ +// OBSOLETE "fp13", "fp14", "fp15", "fp16", "fp17", \ +// OBSOLETE "fp18", "fp19", "fp20", "fp21", "fp22", \ +// OBSOLETE "fp23", "fp24", "fp25", "fp26", "fp27", \ +// OBSOLETE "fp28", "fp29", "fp30", "fp31" } +// OBSOLETE +// OBSOLETE /* Register numbers of various important registers. +// OBSOLETE Note that some of these values are "real" register numbers, +// OBSOLETE and correspond to the general registers of the machine, +// OBSOLETE and some are "phony" register numbers which are too large +// OBSOLETE to be actual register numbers as far as the user is concerned +// OBSOLETE but do serve to get the desired values when passed to read_register. */ +// OBSOLETE +// OBSOLETE #define EAX_REGNUM 0 +// OBSOLETE #define EDX_REGNUM 1 +// OBSOLETE #define ECX_REGNUM 2 +// OBSOLETE #define ST0_REGNUM 3 +// OBSOLETE #define ST1_REGNUM 4 +// OBSOLETE #define EBX_REGNUM 5 +// OBSOLETE #define ESI_REGNUM 6 +// OBSOLETE #define EDI_REGNUM 7 +// OBSOLETE #define ST2_REGNUM 8 +// OBSOLETE #define ST3_REGNUM 9 +// OBSOLETE +// OBSOLETE #define ST4_REGNUM 10 +// OBSOLETE #define ST5_REGNUM 11 +// OBSOLETE #define ST6_REGNUM 12 +// OBSOLETE #define ST7_REGNUM 13 +// OBSOLETE +// OBSOLETE #define FP1_REGNUM 18 /* first 1167 register */ +// OBSOLETE /* Get %fp2 - %fp31 by addition, since they are contiguous */ +// OBSOLETE +// OBSOLETE #undef SP_REGNUM +// OBSOLETE #define SP_REGNUM 14 /* (usp) Contains address of top of stack */ +// OBSOLETE #define ESP_REGNUM 14 +// OBSOLETE #undef FP_REGNUM +// OBSOLETE #define FP_REGNUM 15 /* (ebp) Contains address of executing stack frame */ +// OBSOLETE #define EBP_REGNUM 15 +// OBSOLETE #undef PC_REGNUM +// OBSOLETE #define PC_REGNUM 16 /* (eip) Contains program counter */ +// OBSOLETE #define EIP_REGNUM 16 +// OBSOLETE #undef PS_REGNUM +// OBSOLETE #define PS_REGNUM 17 /* (ps) Contains processor status */ +// OBSOLETE #define EFLAGS_REGNUM 17 +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Following macro translates i386 opcode register numbers to Symmetry +// OBSOLETE * register numbers. This is used by i386_frame_find_saved_regs. +// OBSOLETE * +// OBSOLETE * %eax %ecx %edx %ebx %esp %ebp %esi %edi +// OBSOLETE * i386 0 1 2 3 4 5 6 7 +// OBSOLETE * Symmetry 0 2 1 5 14 15 6 7 +// OBSOLETE * +// OBSOLETE */ +// OBSOLETE #define I386_REGNO_TO_SYMMETRY(n) \ +// OBSOLETE ((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n)) +// OBSOLETE +// OBSOLETE /* The magic numbers below are offsets into u_ar0 in the user struct. +// OBSOLETE * They live in <machine/reg.h>. Gdb calls this macro with blockend +// OBSOLETE * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are +// OBSOLETE * saved in the u area (along with a few others that aren't useful +// OBSOLETE * here. See <machine/reg.h>). +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { struct user foo; /* needed for finding fpu regs */ \ +// OBSOLETE switch (regno) { \ +// OBSOLETE case 0: \ +// OBSOLETE addr = blockend + EAX * sizeof(int); break; \ +// OBSOLETE case 1: \ +// OBSOLETE addr = blockend + EDX * sizeof(int); break; \ +// OBSOLETE case 2: \ +// OBSOLETE addr = blockend + ECX * sizeof(int); break; \ +// OBSOLETE case 3: /* st(0) */ \ +// OBSOLETE addr = ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 4: /* st(1) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 5: \ +// OBSOLETE addr = blockend + EBX * sizeof(int); break; \ +// OBSOLETE case 6: \ +// OBSOLETE addr = blockend + ESI * sizeof(int); break; \ +// OBSOLETE case 7: \ +// OBSOLETE addr = blockend + EDI * sizeof(int); break; \ +// OBSOLETE case 8: /* st(2) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 9: /* st(3) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 10: /* st(4) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 11: /* st(5) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 12: /* st(6) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 13: /* st(7) */ \ +// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \ +// OBSOLETE break; \ +// OBSOLETE case 14: \ +// OBSOLETE addr = blockend + ESP * sizeof(int); break; \ +// OBSOLETE case 15: \ +// OBSOLETE addr = blockend + EBP * sizeof(int); break; \ +// OBSOLETE case 16: \ +// OBSOLETE addr = blockend + EIP * sizeof(int); break; \ +// OBSOLETE case 17: \ +// OBSOLETE addr = blockend + FLAGS * sizeof(int); break; \ +// OBSOLETE case 18: /* fp1 */ \ +// OBSOLETE case 19: /* fp2 */ \ +// OBSOLETE case 20: /* fp3 */ \ +// OBSOLETE case 21: /* fp4 */ \ +// OBSOLETE case 22: /* fp5 */ \ +// OBSOLETE case 23: /* fp6 */ \ +// OBSOLETE case 24: /* fp7 */ \ +// OBSOLETE case 25: /* fp8 */ \ +// OBSOLETE case 26: /* fp9 */ \ +// OBSOLETE case 27: /* fp10 */ \ +// OBSOLETE case 28: /* fp11 */ \ +// OBSOLETE case 29: /* fp12 */ \ +// OBSOLETE case 30: /* fp13 */ \ +// OBSOLETE case 31: /* fp14 */ \ +// OBSOLETE case 32: /* fp15 */ \ +// OBSOLETE case 33: /* fp16 */ \ +// OBSOLETE case 34: /* fp17 */ \ +// OBSOLETE case 35: /* fp18 */ \ +// OBSOLETE case 36: /* fp19 */ \ +// OBSOLETE case 37: /* fp20 */ \ +// OBSOLETE case 38: /* fp21 */ \ +// OBSOLETE case 39: /* fp22 */ \ +// OBSOLETE case 40: /* fp23 */ \ +// OBSOLETE case 41: /* fp24 */ \ +// OBSOLETE case 42: /* fp25 */ \ +// OBSOLETE case 43: /* fp26 */ \ +// OBSOLETE case 44: /* fp27 */ \ +// OBSOLETE case 45: /* fp28 */ \ +// OBSOLETE case 46: /* fp29 */ \ +// OBSOLETE case 47: /* fp30 */ \ +// OBSOLETE case 48: /* fp31 */ \ +// OBSOLETE addr = ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \ +// OBSOLETE } \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Total amount of space needed to store our copies of the machine's +// OBSOLETE register state, the array `registers'. 10 i*86 registers, 8 i387 +// OBSOLETE registers, and 31 Weitek 1167 registers */ +// OBSOLETE +// OBSOLETE #undef REGISTER_BYTES +// OBSOLETE #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4)) +// OBSOLETE +// OBSOLETE /* Nonzero if register N requires conversion +// OBSOLETE from raw format to virtual format. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERTIBLE +// OBSOLETE #define REGISTER_CONVERTIBLE(N) \ +// OBSOLETE (((N) < 3) ? 0 : \ +// OBSOLETE ((N) < 5) ? 1 : \ +// OBSOLETE ((N) < 8) ? 0 : \ +// OBSOLETE ((N) < 14) ? 1 : \ +// OBSOLETE 0) +// OBSOLETE +// OBSOLETE #include "floatformat.h" +// OBSOLETE +// OBSOLETE /* Convert data from raw format for register REGNUM in buffer FROM +// OBSOLETE to virtual format with type TYPE in buffer TO. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERT_TO_VIRTUAL +// OBSOLETE #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ +// OBSOLETE { \ +// OBSOLETE DOUBLEST val; \ +// OBSOLETE floatformat_to_doublest (&floatformat_i387_ext, (FROM), &val); \ +// OBSOLETE deprecated_store_floating ((TO), TYPE_LENGTH (TYPE), val); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Convert data from virtual format with type TYPE in buffer FROM +// OBSOLETE to raw format for register REGNUM in buffer TO. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_CONVERT_TO_RAW +// OBSOLETE #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ +// OBSOLETE { \ +// OBSOLETE DOUBLEST val = deprecated_extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ +// OBSOLETE floatformat_from_doublest (&floatformat_i387_ext, &val, (TO)); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the GDB type object for the "standard" data type +// OBSOLETE of data in register N. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_VIRTUAL_TYPE +// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ +// OBSOLETE ((N < 3) ? builtin_type_int : \ +// OBSOLETE (N < 5) ? builtin_type_double : \ +// OBSOLETE (N < 8) ? builtin_type_int : \ +// OBSOLETE (N < 14) ? builtin_type_double : \ +// OBSOLETE builtin_type_int) +// OBSOLETE +// OBSOLETE /* Store the address of the place in which to copy the structure the +// OBSOLETE subroutine will return. This is called from call_function. +// OBSOLETE Native cc passes the address in eax, gcc (up to version 2.5.8) +// OBSOLETE passes it on the stack. gcc should be fixed in future versions to +// OBSOLETE adopt native cc conventions. */ +// OBSOLETE +// OBSOLETE #undef DEPRECATED_PUSH_ARGUMENTS +// OBSOLETE #undef STORE_STRUCT_RETURN +// OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR)) +// OBSOLETE +// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state +// OBSOLETE a function return value of type TYPE, and copy that, in virtual format, +// OBSOLETE into VALBUF. */ +// OBSOLETE +// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE +// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +// OBSOLETE symmetry_extract_return_value(TYPE, REGBUF, VALBUF) +// OBSOLETE +// OBSOLETE /* The following redefines make backtracing through sigtramp work. +// OBSOLETE They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp +// OBSOLETE from the sigcontext structure which is pushed by the kernel on the +// OBSOLETE user stack, along with a pointer to it. */ +// OBSOLETE +// OBSOLETE #define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", name)) +// OBSOLETE +// OBSOLETE /* Offset to saved PC in sigcontext, from <signal.h>. */ +// OBSOLETE #define SIGCONTEXT_PC_OFFSET 16 +// OBSOLETE +// OBSOLETE #endif /* ifndef TM_SYMMETRY_H */ diff --git a/gdb/config/i386/xm-ptx.h b/gdb/config/i386/xm-ptx.h index 8987f29..1ecae0c 100644 --- a/gdb/config/i386/xm-ptx.h +++ b/gdb/config/i386/xm-ptx.h @@ -1,38 +1,38 @@ -/* Definitions to make GDB run on a Sequent Symmetry under ptx, with - Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995 - 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. */ - -/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ - -#ifdef _SEQUENT_PTX4_ -#include "config/xm-sysv4.h" -#endif /* _SEQUENT_PTX4_ */ - -/* This machine doesn't have the siginterrupt call. */ -#define NO_SIGINTERRUPT - -#define HAVE_WAIT_STRUCT - -#undef HAVE_TERMIO -#define HAVE_TERMIOS -#define USG - -#define USE_O_NOCTTY +// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx, with +// OBSOLETE Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ +// OBSOLETE +// OBSOLETE #ifdef _SEQUENT_PTX4_ +// OBSOLETE #include "config/xm-sysv4.h" +// OBSOLETE #endif /* _SEQUENT_PTX4_ */ +// OBSOLETE +// OBSOLETE /* This machine doesn't have the siginterrupt call. */ +// OBSOLETE #define NO_SIGINTERRUPT +// OBSOLETE +// OBSOLETE #define HAVE_WAIT_STRUCT +// OBSOLETE +// OBSOLETE #undef HAVE_TERMIO +// OBSOLETE #define HAVE_TERMIOS +// OBSOLETE #define USG +// OBSOLETE +// OBSOLETE #define USE_O_NOCTTY diff --git a/gdb/config/i386/xm-ptx4.h b/gdb/config/i386/xm-ptx4.h index 6059413..7f0605d 100644 --- a/gdb/config/i386/xm-ptx4.h +++ b/gdb/config/i386/xm-ptx4.h @@ -1,27 +1,27 @@ -/* Definitions to make GDB run on a Sequent Symmetry under ptx, with - Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1992, 1993, 1994 - 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. */ - -/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ - -#include "config/xm-sysv4.h" - -#include "i386/xm-ptx.h" +// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx, with +// OBSOLETE Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ +// OBSOLETE +// OBSOLETE #include "config/xm-sysv4.h" +// OBSOLETE +// OBSOLETE #include "i386/xm-ptx.h" diff --git a/gdb/config/i386/xm-symmetry.h b/gdb/config/i386/xm-symmetry.h index 781a343..27711f2 100644 --- a/gdb/config/i386/xm-symmetry.h +++ b/gdb/config/i386/xm-symmetry.h @@ -1,28 +1,28 @@ -/* Definitions to make GDB run on a Sequent Symmetry under - dynix 3.1, with Weitek 1167 and i387 support. - Copyright 1986, 1987, 1989, 1992, 1993, 1994 - 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. */ - -/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ - -/* This machine doesn't have the siginterrupt call. */ -#define NO_SIGINTERRUPT - -#define HAVE_WAIT_STRUCT +// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under +// OBSOLETE dynix 3.1, with Weitek 1167 and i387 support. +// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ +// OBSOLETE +// OBSOLETE /* This machine doesn't have the siginterrupt call. */ +// OBSOLETE #define NO_SIGINTERRUPT +// OBSOLETE +// OBSOLETE #define HAVE_WAIT_STRUCT diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index a1abc0e..03172b0 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct frame_info; + #include "regcache.h" /* Define BPT_VECTOR if it is different than the default. @@ -99,8 +101,8 @@ extern int delta68_in_sigtramp (CORE_ADDR pc, char *name); #define IN_SIGTRAMP(pc,name) delta68_in_sigtramp (pc, name) extern CORE_ADDR delta68_frame_saved_pc (struct frame_info *fi); -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) +#undef DEPRECATED_FRAME_SAVED_PC +#define DEPRECATED_FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi) extern CORE_ADDR delta68_frame_args_address (struct frame_info *fi); #undef FRAME_ARGS_ADDRESS diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h index 4990bb0..cc20c62 100644 --- a/gdb/config/m68k/tm-linux.h +++ b/gdb/config/m68k/tm-linux.h @@ -100,8 +100,8 @@ #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) +#undef DEPRECATED_FRAME_SAVED_PC +#define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *); #define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc) diff --git a/gdb/config/m68k/tm-os68k.h b/gdb/config/m68k/tm-os68k.h index 2954570..815efff 100644 --- a/gdb/config/m68k/tm-os68k.h +++ b/gdb/config/m68k/tm-os68k.h @@ -35,5 +35,5 @@ If our current frame pointer is zero, we're at the top; else read out the saved FP from memory pointed to by the current FP. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) +#undef DEPRECATED_FRAME_CHAIN +#define DEPRECATED_FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h index 253fd53..aafba6a 100644 --- a/gdb/config/m68k/tm-sun3.h +++ b/gdb/config/m68k/tm-sun3.h @@ -86,17 +86,18 @@ /* The code which tries to deal with this bug is never harmful on a sun3. */ #define SUN_FIXED_LBRAC_BUG (0) -/* On the sun3 the kernel pushes a sigcontext on the user stack and then - `calls' _sigtramp in user code. _sigtramp saves the floating point status - on the stack and calls the signal handler function. The stack does not - contain enough information to allow a normal backtrace, but sigcontext - contains the saved user pc/sp. FRAME_CHAIN and friends in tm-m68k.h and - m68k_find_saved_regs deal with this situation by manufacturing a fake frame - for _sigtramp. - SIG_PC_FP_OFFSET is the offset from the signal handler frame to the - saved pc in sigcontext. - SIG_SP_FP_OFFSET is the offset from the signal handler frame to the end - of sigcontext which is identical to the saved sp at SIG_PC_FP_OFFSET - 4. +/* On the sun3 the kernel pushes a sigcontext on the user stack and + then `calls' _sigtramp in user code. _sigtramp saves the floating + point status on the stack and calls the signal handler + function. The stack does not contain enough information to allow a + normal backtrace, but sigcontext contains the saved user + pc/sp. DEPRECATED_FRAME_CHAIN and friends in tm-m68k.h and + m68k_find_saved_regs deal with this situation by manufacturing a + fake frame for _sigtramp. SIG_PC_FP_OFFSET is the offset from the + signal handler frame to the saved pc in sigcontext. + SIG_SP_FP_OFFSET is the offset from the signal handler frame to the + end of sigcontext which is identical to the saved sp at + SIG_PC_FP_OFFSET - 4. Please note that it is impossible to correctly backtrace from a breakpoint in _sigtramp as _sigtramp modifies the stack pointer a few times. */ diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h index 76ac6fd..f7e8fca 100644 --- a/gdb/config/m68k/tm-vx68.h +++ b/gdb/config/m68k/tm-vx68.h @@ -39,8 +39,8 @@ If our current frame pointer is zero, we're at the top; else read out the saved FP from memory pointed to by the current FP. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) +#undef DEPRECATED_FRAME_CHAIN +#define DEPRECATED_FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) /* FIXME, Longjmp information stolen from Sun-3 config. Dunno if right. */ /* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least diff --git a/gdb/config/mips/mipsm3.mh b/gdb/config/mips/mipsm3.mh index 864ad57..fc9f37c 100644 --- a/gdb/config/mips/mipsm3.mh +++ b/gdb/config/mips/mipsm3.mh @@ -1,6 +1,6 @@ -# Host: Little endian MIPS machine such as pmax -# running Mach 3.0 operating system - -NATDEPFILES= mipsm3-nat.o m3-nat.o core-aout.o -XM_FILE= xm-mipsm3.h -NAT_FILE= ../nm-m3.h +# OBSOLETE # Host: Little endian MIPS machine such as pmax +# OBSOLETE # running Mach 3.0 operating system +# OBSOLETE +# OBSOLETE NATDEPFILES= mipsm3-nat.o m3-nat.o core-aout.o +# OBSOLETE XM_FILE= xm-mipsm3.h +# OBSOLETE NAT_FILE= ../nm-m3.h diff --git a/gdb/config/mips/mipsm3.mt b/gdb/config/mips/mipsm3.mt index 66856d1..837b27e 100644 --- a/gdb/config/mips/mipsm3.mt +++ b/gdb/config/mips/mipsm3.mt @@ -1,4 +1,4 @@ -# Target: Little-endian MIPS machine such as pmax -# running Mach 3.0 operating system -TDEPFILES= mips-tdep.o -TM_FILE= tm-mipsm3.h +# OBSOLETE # Target: Little-endian MIPS machine such as pmax +# OBSOLETE # running Mach 3.0 operating system +# OBSOLETE TDEPFILES= mips-tdep.o +# OBSOLETE TM_FILE= tm-mipsm3.h diff --git a/gdb/config/mips/tm-irix3.h b/gdb/config/mips/tm-irix3.h index 8875f79..03c66bd 100644 --- a/gdb/config/mips/tm-irix3.h +++ b/gdb/config/mips/tm-irix3.h @@ -33,15 +33,11 @@ #undef FCRCS_REGNUM #undef FCRIR_REGNUM -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ +/* Initializer for an array of names for registers 32 and above. + There should be NUM_REGS-32 strings in this initializer. */ #define MIPS_REGISTER_NAMES \ - { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \ - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ - "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index 26813ba..59d3c58 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -34,15 +34,11 @@ #undef FCRCS_REGNUM #undef FCRIR_REGNUM -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ +/* Initializer for an array of names for registers 32 and above. + There should be NUM_REGS-32 strings in this initializer. */ #define MIPS_REGISTER_NAMES \ - { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ - "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", \ - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ + { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index e092d4a..dada615 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -59,16 +59,12 @@ extern int mips_step_skips_delay (CORE_ADDR); #define MIPS_REGSIZE 4 #endif -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ +/* Initializer for an array of names for registers 32 and above. + There should be NUM_REGS-32 strings in this initializer. */ #ifndef MIPS_REGISTER_NAMES #define MIPS_REGISTER_NAMES \ - { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \ - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \ - "sr", "lo", "hi", "bad", "cause","pc", \ + { "sr", "lo", "hi", "bad", "cause","pc", \ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ diff --git a/gdb/config/mips/tm-mipsm3.h b/gdb/config/mips/tm-mipsm3.h index 9e2f490..dbc10d7 100644 --- a/gdb/config/mips/tm-mipsm3.h +++ b/gdb/config/mips/tm-mipsm3.h @@ -1,67 +1,67 @@ -/* Definitions to make GDB run on a mips box under Mach 3.0 - Copyright 1992, 1993, 1998 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. */ - -/* Mach specific definitions for little endian mips (e.g. pmax) - * running Mach 3.0 - * - * Author: Jukka Virtanen <jtv@hut.fi> - */ - -/* Include common definitions for Mach3 systems */ -#include "config/nm-m3.h" - -/* Define offsets to access CPROC stack when it does not have - * a kernel thread. - */ - -/* From mk/user/threads/mips/csw.s */ -#define SAVED_FP (12*4) -#define SAVED_PC (13*4) -#define SAVED_BYTES (14*4) - -/* Using these, define our offsets to items strored in - * cproc_switch in csw.s - */ -#define MACHINE_CPROC_SP_OFFSET SAVED_BYTES -#define MACHINE_CPROC_PC_OFFSET SAVED_PC -#define MACHINE_CPROC_FP_OFFSET SAVED_FP - -/* Thread flavors used in setting the Trace state. - - * In <mach/machine/thread_status.h> - */ -#define TRACE_FLAVOR MIPS_EXC_STATE -#define TRACE_FLAVOR_SIZE MIPS_EXC_STATE_COUNT -#define TRACE_SET(x,state) ((struct mips_exc_state *)state)->cause = EXC_SST; -#define TRACE_CLEAR(x,state) 0 - -/* Mach supports attach/detach */ -#define ATTACH_DETACH 1 - -#include "mips/tm-mips.h" - -/* Address of end of user stack space. - * for MACH, see <machine/vmparam.h> - */ -#undef STACK_END_ADDR -#define STACK_END_ADDR USRSTACK - -/* Output registers in tabular format */ -#define TABULAR_REGISTER_OUTPUT +// OBSOLETE /* Definitions to make GDB run on a mips box under Mach 3.0 +// OBSOLETE Copyright 1992, 1993, 1998 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Mach specific definitions for little endian mips (e.g. pmax) +// OBSOLETE * running Mach 3.0 +// OBSOLETE * +// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi> +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Include common definitions for Mach3 systems */ +// OBSOLETE #include "config/nm-m3.h" +// OBSOLETE +// OBSOLETE /* Define offsets to access CPROC stack when it does not have +// OBSOLETE * a kernel thread. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* From mk/user/threads/mips/csw.s */ +// OBSOLETE #define SAVED_FP (12*4) +// OBSOLETE #define SAVED_PC (13*4) +// OBSOLETE #define SAVED_BYTES (14*4) +// OBSOLETE +// OBSOLETE /* Using these, define our offsets to items strored in +// OBSOLETE * cproc_switch in csw.s +// OBSOLETE */ +// OBSOLETE #define MACHINE_CPROC_SP_OFFSET SAVED_BYTES +// OBSOLETE #define MACHINE_CPROC_PC_OFFSET SAVED_PC +// OBSOLETE #define MACHINE_CPROC_FP_OFFSET SAVED_FP +// OBSOLETE +// OBSOLETE /* Thread flavors used in setting the Trace state. +// OBSOLETE +// OBSOLETE * In <mach/machine/thread_status.h> +// OBSOLETE */ +// OBSOLETE #define TRACE_FLAVOR MIPS_EXC_STATE +// OBSOLETE #define TRACE_FLAVOR_SIZE MIPS_EXC_STATE_COUNT +// OBSOLETE #define TRACE_SET(x,state) ((struct mips_exc_state *)state)->cause = EXC_SST; +// OBSOLETE #define TRACE_CLEAR(x,state) 0 +// OBSOLETE +// OBSOLETE /* Mach supports attach/detach */ +// OBSOLETE #define ATTACH_DETACH 1 +// OBSOLETE +// OBSOLETE #include "mips/tm-mips.h" +// OBSOLETE +// OBSOLETE /* Address of end of user stack space. +// OBSOLETE * for MACH, see <machine/vmparam.h> +// OBSOLETE */ +// OBSOLETE #undef STACK_END_ADDR +// OBSOLETE #define STACK_END_ADDR USRSTACK +// OBSOLETE +// OBSOLETE /* Output registers in tabular format */ +// OBSOLETE #define TABULAR_REGISTER_OUTPUT diff --git a/gdb/config/mips/tm-tx39.h b/gdb/config/mips/tm-tx39.h index d6fbd29..d095db0 100644 --- a/gdb/config/mips/tm-tx39.h +++ b/gdb/config/mips/tm-tx39.h @@ -21,11 +21,7 @@ #undef MIPS_REGISTER_NAMES #define MIPS_REGISTER_NAMES \ - { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \ - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \ - "sr", "lo", "hi", "bad", "cause","pc", \ + { "sr", "lo", "hi", "bad", "cause","pc", \ "", "", "", "", "", "", "", "", \ "", "", "", "", "", "", "", "", \ "", "", "", "", "", "", "", "", \ diff --git a/gdb/config/mips/tm-tx39l.h b/gdb/config/mips/tm-tx39l.h index 0c6d32b..81f3b6d 100644 --- a/gdb/config/mips/tm-tx39l.h +++ b/gdb/config/mips/tm-tx39l.h @@ -21,11 +21,7 @@ #undef MIPS_REGISTER_NAMES #define MIPS_REGISTER_NAMES \ - { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \ - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \ - "sr", "lo", "hi", "bad", "cause","pc", \ + { "sr", "lo", "hi", "bad", "cause","pc", \ "", "", "", "", "", "", "", "", \ "", "", "", "", "", "", "", "", \ "", "", "", "", "", "", "", "", \ diff --git a/gdb/config/mips/xm-mipsm3.h b/gdb/config/mips/xm-mipsm3.h index b2e9f4d..2207d3a 100644 --- a/gdb/config/mips/xm-mipsm3.h +++ b/gdb/config/mips/xm-mipsm3.h @@ -1,29 +1,29 @@ -/* Definitions to make GDB run on a mips box under 4.3bsd. - Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc. - Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin - and by Alessandro Forin(af@cs.cmu.edu) at CMU - - 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. */ - -#define KERNEL_U_ADDR 0 /* Not needed. */ - -/* Only used for core files on DECstations. */ - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\ - else addr = 0; /* ..somewhere in the pcb */ +// OBSOLETE /* Definitions to make GDB run on a mips box under 4.3bsd. +// OBSOLETE Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc. +// OBSOLETE Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin +// OBSOLETE and by Alessandro Forin(af@cs.cmu.edu) at CMU +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0 /* Not needed. */ +// OBSOLETE +// OBSOLETE /* Only used for core files on DECstations. */ +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\ +// OBSOLETE else addr = 0; /* ..somewhere in the pcb */ diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h index 114acd8..0fb5627 100644 --- a/gdb/config/nm-linux.h +++ b/gdb/config/nm-linux.h @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct target_ops; + /* GNU/Linux is SVR4-ish but its /proc file system isn't. */ #undef USE_PROC_FS diff --git a/gdb/config/nm-lynx.h b/gdb/config/nm-lynx.h index 1fb0eb6..4a55a13 100644 --- a/gdb/config/nm-lynx.h +++ b/gdb/config/nm-lynx.h @@ -23,6 +23,8 @@ #ifndef NM_LYNX_H #define NM_LYNX_H +struct target_waitstatus; + #include <sys/conf.h> #include <sys/kernel.h> /* sys/kernel.h should define this, but doesn't always, sigh. */ diff --git a/gdb/config/nm-m3.h b/gdb/config/nm-m3.h index 07bc26a..0cc84e3 100644 --- a/gdb/config/nm-m3.h +++ b/gdb/config/nm-m3.h @@ -1,126 +1,126 @@ -/* Mach 3.0 common definitions and global vars. - - Copyright 1992, 1993, 1994, 1996 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 NM_M3_H -#define NM_M3_H - -#include <mach.h> -#include "regcache.h" - -/* Mach3 doesn't declare errno in <errno.h>. */ -extern int errno; - -/* Task port of our debugged inferior. */ - -extern task_t inferior_task; - -/* Thread port of the current thread in the inferior. */ - -extern thread_t current_thread; - -/* If nonzero, we must suspend/abort && resume threads - * when setting or getting the state. - */ -extern int must_suspend_thread; - -#define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it) - -/* Try to get the privileged host port for authentication to machid - - * If you can get this, you may debug anything on this host. - * - * If you can't, gdb gives it's own task port as the - * authentication port - */ -#define mach_privileged_host_port() task_by_pid(-1) - -/* - * This is the MIG ID number of the emulator/server bsd_execve() RPC call. - * - * It SHOULD never change, but if it does, gdb `run' - * command won't work until you fix this define. - * - */ -#define MIG_EXEC_SYSCALL_ID 101000 - -/* If our_message_port gets a msg with this ID, - * GDB suspends it's inferior and enters command level. - * (Useful at least if ^C does not work) - */ -#define GDB_MESSAGE_ID_STOP 0x41151 - -/* wait3 WNOHANG is defined in <sys/wait.h> but - * for some reason gdb does not want to include - * that file. - * - * If your system defines WNOHANG differently, this has to be changed. - */ -#define WNOHANG 1 - -/* Before storing, we need to read all the registers. */ - -#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) - -/* Check if the inferior exists */ -#define MACH_ERROR_NO_INFERIOR \ - do if (!MACH_PORT_VALID (inferior_task)) \ - error ("Inferior task does not exist."); while(0) - -/* Error handler for mach calls */ -#define CHK(str,ret) \ - do if (ret != KERN_SUCCESS) \ - error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \ - mach_error_string(ret)); while(0) - -/* This is from POE9 emulator/emul_stack.h - */ -/* - * Top of emulator stack holds link and reply port. - */ -struct emul_stack_top - { - struct emul_stack_top *link; - mach_port_t reply_port; - }; - -#define EMULATOR_STACK_SIZE (4096*4) - -#define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid) - -#define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg) - -#define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid) - -#define ATTACH_TO_THREAD attach_to_thread - -/* Don't do wait_for_inferior on attach. */ -#define ATTACH_NO_WAIT - -/* Do Mach 3 dependent operations when ^C or a STOP is requested */ -#define DO_QUIT() mach3_quit () - -#if 0 -/* This is bogus. It is NOT OK to quit out of target_wait. */ -/* If in mach_msg() and ^C is typed set immediate_quit */ -#define REQUEST_QUIT() mach3_request_quit () -#endif - -#endif /* NM_M3_H */ +// OBSOLETE /* Mach 3.0 common definitions and global vars. +// OBSOLETE +// OBSOLETE Copyright 1992, 1993, 1994, 1996 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #ifndef NM_M3_H +// OBSOLETE #define NM_M3_H +// OBSOLETE +// OBSOLETE #include <mach.h> +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Mach3 doesn't declare errno in <errno.h>. */ +// OBSOLETE extern int errno; +// OBSOLETE +// OBSOLETE /* Task port of our debugged inferior. */ +// OBSOLETE +// OBSOLETE extern task_t inferior_task; +// OBSOLETE +// OBSOLETE /* Thread port of the current thread in the inferior. */ +// OBSOLETE +// OBSOLETE extern thread_t current_thread; +// OBSOLETE +// OBSOLETE /* If nonzero, we must suspend/abort && resume threads +// OBSOLETE * when setting or getting the state. +// OBSOLETE */ +// OBSOLETE extern int must_suspend_thread; +// OBSOLETE +// OBSOLETE #define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it) +// OBSOLETE +// OBSOLETE /* Try to get the privileged host port for authentication to machid +// OBSOLETE +// OBSOLETE * If you can get this, you may debug anything on this host. +// OBSOLETE * +// OBSOLETE * If you can't, gdb gives it's own task port as the +// OBSOLETE * authentication port +// OBSOLETE */ +// OBSOLETE #define mach_privileged_host_port() task_by_pid(-1) +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * This is the MIG ID number of the emulator/server bsd_execve() RPC call. +// OBSOLETE * +// OBSOLETE * It SHOULD never change, but if it does, gdb `run' +// OBSOLETE * command won't work until you fix this define. +// OBSOLETE * +// OBSOLETE */ +// OBSOLETE #define MIG_EXEC_SYSCALL_ID 101000 +// OBSOLETE +// OBSOLETE /* If our_message_port gets a msg with this ID, +// OBSOLETE * GDB suspends it's inferior and enters command level. +// OBSOLETE * (Useful at least if ^C does not work) +// OBSOLETE */ +// OBSOLETE #define GDB_MESSAGE_ID_STOP 0x41151 +// OBSOLETE +// OBSOLETE /* wait3 WNOHANG is defined in <sys/wait.h> but +// OBSOLETE * for some reason gdb does not want to include +// OBSOLETE * that file. +// OBSOLETE * +// OBSOLETE * If your system defines WNOHANG differently, this has to be changed. +// OBSOLETE */ +// OBSOLETE #define WNOHANG 1 +// OBSOLETE +// OBSOLETE /* Before storing, we need to read all the registers. */ +// OBSOLETE +// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES) +// OBSOLETE +// OBSOLETE /* Check if the inferior exists */ +// OBSOLETE #define MACH_ERROR_NO_INFERIOR \ +// OBSOLETE do if (!MACH_PORT_VALID (inferior_task)) \ +// OBSOLETE error ("Inferior task does not exist."); while(0) +// OBSOLETE +// OBSOLETE /* Error handler for mach calls */ +// OBSOLETE #define CHK(str,ret) \ +// OBSOLETE do if (ret != KERN_SUCCESS) \ +// OBSOLETE error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \ +// OBSOLETE mach_error_string(ret)); while(0) +// OBSOLETE +// OBSOLETE /* This is from POE9 emulator/emul_stack.h +// OBSOLETE */ +// OBSOLETE /* +// OBSOLETE * Top of emulator stack holds link and reply port. +// OBSOLETE */ +// OBSOLETE struct emul_stack_top +// OBSOLETE { +// OBSOLETE struct emul_stack_top *link; +// OBSOLETE mach_port_t reply_port; +// OBSOLETE }; +// OBSOLETE +// OBSOLETE #define EMULATOR_STACK_SIZE (4096*4) +// OBSOLETE +// OBSOLETE #define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid) +// OBSOLETE +// OBSOLETE #define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg) +// OBSOLETE +// OBSOLETE #define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid) +// OBSOLETE +// OBSOLETE #define ATTACH_TO_THREAD attach_to_thread +// OBSOLETE +// OBSOLETE /* Don't do wait_for_inferior on attach. */ +// OBSOLETE #define ATTACH_NO_WAIT +// OBSOLETE +// OBSOLETE /* Do Mach 3 dependent operations when ^C or a STOP is requested */ +// OBSOLETE #define DO_QUIT() mach3_quit () +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* This is bogus. It is NOT OK to quit out of target_wait. */ +// OBSOLETE /* If in mach_msg() and ^C is typed set immediate_quit */ +// OBSOLETE #define REQUEST_QUIT() mach3_request_quit () +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #endif /* NM_M3_H */ diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh index d4a152d..e4d0215 100644 --- a/gdb/config/pa/hppabsd.mh +++ b/gdb/config/pa/hppabsd.mh @@ -1,4 +1,4 @@ -# Host: Hewlett-Packard PA-RISC machine, running BSD -XM_FILE= xm-hppab.h -NAT_FILE= nm-hppab.h -NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o +# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD +# OBSOLETE XM_FILE= xm-hppab.h +# OBSOLETE NAT_FILE= nm-hppab.h +# OBSOLETE NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o diff --git a/gdb/config/pa/hppabsd.mt b/gdb/config/pa/hppabsd.mt index 0fc0380..e63f9b8 100644 --- a/gdb/config/pa/hppabsd.mt +++ b/gdb/config/pa/hppabsd.mt @@ -1,3 +1,3 @@ -# Target: HP PA-RISC running bsd -TDEPFILES= hppa-tdep.o -TM_FILE= tm-hppab.h +# OBSOLETE # Target: HP PA-RISC running bsd +# OBSOLETE TDEPFILES= hppa-tdep.o +# OBSOLETE TM_FILE= tm-hppab.h diff --git a/gdb/config/pa/hppaosf.mh b/gdb/config/pa/hppaosf.mh index d6dd282..0e82dc1 100644 --- a/gdb/config/pa/hppaosf.mh +++ b/gdb/config/pa/hppaosf.mh @@ -1,5 +1,5 @@ -# Host: Hewlett-Packard PA-RISC machine, running BSD -XM_FILE= xm-hppab.h -NAT_FILE= nm-hppao.h -NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o -NAT_CLIBS= -lmachid -lnetname -lmach +# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD +# OBSOLETE XM_FILE= xm-hppab.h +# OBSOLETE NAT_FILE= nm-hppao.h +# OBSOLETE NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o +# OBSOLETE NAT_CLIBS= -lmachid -lnetname -lmach diff --git a/gdb/config/pa/hppaosf.mt b/gdb/config/pa/hppaosf.mt index 6754023..4a54c79 100644 --- a/gdb/config/pa/hppaosf.mt +++ b/gdb/config/pa/hppaosf.mt @@ -1,3 +1,3 @@ -# Target: HP PA-RISC running OSF1 -TDEPFILES= hppa-tdep.o -TM_FILE= tm-hppao.h +# OBSOLETE # Target: HP PA-RISC running OSF1 +# OBSOLETE TDEPFILES= hppa-tdep.o +# OBSOLETE TM_FILE= tm-hppao.h diff --git a/gdb/config/pa/hppapro.mt b/gdb/config/pa/hppapro.mt index 4851b18..cfd9969 100644 --- a/gdb/config/pa/hppapro.mt +++ b/gdb/config/pa/hppapro.mt @@ -1,3 +1,3 @@ -# Target: PA based debug monitor -TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o -TM_FILE= tm-pro.h +# OBSOLETE # Target: PA based debug monitor +# OBSOLETE TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o +# OBSOLETE TM_FILE= tm-pro.h diff --git a/gdb/config/pa/nm-hppab.h b/gdb/config/pa/nm-hppab.h index d9827dc..96dea6e 100644 --- a/gdb/config/pa/nm-hppab.h +++ b/gdb/config/pa/nm-hppab.h @@ -1,123 +1,123 @@ -/* HPPA PA-RISC machine native support for BSD, for GDB. - Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "somsolib.h" -#include "regcache.h" - -#define U_REGS_OFFSET 0 - -#define KERNEL_U_ADDR 0 - -/* What a coincidence! */ -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = (int)(blockend) + REGISTER_BYTE (regno);} - -/* 3rd argument to ptrace is supposed to be a caddr_t. */ - -#define PTRACE_ARG3_TYPE caddr_t - -/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace - with five arguments, so programs written for normal ptrace lose. */ -#define FIVE_ARG_PTRACE - - -/* fetch_inferior_registers is in hppab-nat.c. */ -#define FETCH_INFERIOR_REGISTERS - -/* attach/detach works to some extent under BSD and HPUX. So long - as the process you're attaching to isn't blocked waiting on io, - blocked waiting on a signal, or in a system call things work - fine. (The problems in those cases are related to the fact that - the kernel can't provide complete register information for the - target process... Which really pisses off GDB.) */ - -#define ATTACH_DETACH - -/* The PA-BSD kernel has support for using the data memory break bit - to implement fast watchpoints. - - Watchpoints on the PA act much like traditional page protection - schemes, but with some notable differences. - - First, a special bit in the page table entry is used to cause - a trap when a specific page is written to. This avoids having - to overload watchpoints on the page protection bits. This makes - it possible for the kernel to easily decide if a trap was caused - by a watchpoint or by the user writing to protected memory and can - signal the user program differently in each case. - - Second, the PA has a bit in the processor status word which causes - data memory breakpoints (aka watchpoints) to be disabled for a single - instruction. This bit can be used to avoid the overhead of unprotecting - and reprotecting pages when it becomes necessary to step over a watchpoint. - - - When the kernel receives a trap indicating a write to a page which - is being watched, the kernel performs a couple of simple actions. First - is sets the magic "disable memory breakpoint" bit in the processor - status word, it then sends a SIGTRAP to the process which caused the - trap. - - GDB will take control and catch the signal for the inferior. GDB then - examines the PSW-X bit to determine if the SIGTRAP was caused by a - watchpoint firing. If so GDB single steps the inferior over the - instruction which caused the watchpoint to trigger (note because the - kernel disabled the data memory break bit for one instruction no trap - will be taken!). GDB will then determines the appropriate action to - take. (this may include restarting the inferior if the watchpoint - fired because of a write to an address on the same page as a watchpoint, - but no write to the watched address occured). */ - -#define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */ - -/* The PA can watch any number of locations, there's no need for it to reject - anything (generic routines already check that all intermediates are - in memory). */ -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ - ((type) == bp_hardware_watchpoint) - -/* When a hardware watchpoint fires off the PC will be left at the - instruction which caused the watchpoint. It will be necessary for - GDB to step over the watchpoint. - - On a PA running BSD, it is trivial to identify when it will be - necessary to step over a hardware watchpoint as we can examine - the PSW-X bit. If the bit is on, then we trapped because of a - watchpoint, else we trapped for some other reason. */ -#define STOPPED_BY_WATCHPOINT(W) \ - ((W).kind == TARGET_WAITKIND_STOPPED \ - && (W).value.sig == TARGET_SIGNAL_TRAP \ - && ((int) read_register (IPSW_REGNUM) & 0x00100000)) - -/* The PA can single step over a watchpoint if the kernel has set the - "X" bit in the processor status word (disable data memory breakpoint - for one instruction). - - The kernel will always set this bit before notifying the inferior - that it hit a watchpoint. Thus, the inferior can single step over - the instruction which caused the watchpoint to fire. This avoids - the traditional need to disable the watchpoint, step the inferior, - then enable the watchpoint again. */ -#define HAVE_STEPPABLE_WATCHPOINT - -/* Use these macros for watchpoint insertion/deletion. */ -/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */ -#define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1) -#define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0) +// OBSOLETE /* HPPA PA-RISC machine native support for BSD, for GDB. +// OBSOLETE Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "somsolib.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #define U_REGS_OFFSET 0 +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0 +// OBSOLETE +// OBSOLETE /* What a coincidence! */ +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);} +// OBSOLETE +// OBSOLETE /* 3rd argument to ptrace is supposed to be a caddr_t. */ +// OBSOLETE +// OBSOLETE #define PTRACE_ARG3_TYPE caddr_t +// OBSOLETE +// OBSOLETE /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace +// OBSOLETE with five arguments, so programs written for normal ptrace lose. */ +// OBSOLETE #define FIVE_ARG_PTRACE +// OBSOLETE +// OBSOLETE +// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */ +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long +// OBSOLETE as the process you're attaching to isn't blocked waiting on io, +// OBSOLETE blocked waiting on a signal, or in a system call things work +// OBSOLETE fine. (The problems in those cases are related to the fact that +// OBSOLETE the kernel can't provide complete register information for the +// OBSOLETE target process... Which really pisses off GDB.) */ +// OBSOLETE +// OBSOLETE #define ATTACH_DETACH +// OBSOLETE +// OBSOLETE /* The PA-BSD kernel has support for using the data memory break bit +// OBSOLETE to implement fast watchpoints. +// OBSOLETE +// OBSOLETE Watchpoints on the PA act much like traditional page protection +// OBSOLETE schemes, but with some notable differences. +// OBSOLETE +// OBSOLETE First, a special bit in the page table entry is used to cause +// OBSOLETE a trap when a specific page is written to. This avoids having +// OBSOLETE to overload watchpoints on the page protection bits. This makes +// OBSOLETE it possible for the kernel to easily decide if a trap was caused +// OBSOLETE by a watchpoint or by the user writing to protected memory and can +// OBSOLETE signal the user program differently in each case. +// OBSOLETE +// OBSOLETE Second, the PA has a bit in the processor status word which causes +// OBSOLETE data memory breakpoints (aka watchpoints) to be disabled for a single +// OBSOLETE instruction. This bit can be used to avoid the overhead of unprotecting +// OBSOLETE and reprotecting pages when it becomes necessary to step over a watchpoint. +// OBSOLETE +// OBSOLETE +// OBSOLETE When the kernel receives a trap indicating a write to a page which +// OBSOLETE is being watched, the kernel performs a couple of simple actions. First +// OBSOLETE is sets the magic "disable memory breakpoint" bit in the processor +// OBSOLETE status word, it then sends a SIGTRAP to the process which caused the +// OBSOLETE trap. +// OBSOLETE +// OBSOLETE GDB will take control and catch the signal for the inferior. GDB then +// OBSOLETE examines the PSW-X bit to determine if the SIGTRAP was caused by a +// OBSOLETE watchpoint firing. If so GDB single steps the inferior over the +// OBSOLETE instruction which caused the watchpoint to trigger (note because the +// OBSOLETE kernel disabled the data memory break bit for one instruction no trap +// OBSOLETE will be taken!). GDB will then determines the appropriate action to +// OBSOLETE take. (this may include restarting the inferior if the watchpoint +// OBSOLETE fired because of a write to an address on the same page as a watchpoint, +// OBSOLETE but no write to the watched address occured). */ +// OBSOLETE +// OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */ +// OBSOLETE +// OBSOLETE /* The PA can watch any number of locations, there's no need for it to reject +// OBSOLETE anything (generic routines already check that all intermediates are +// OBSOLETE in memory). */ +// OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ +// OBSOLETE ((type) == bp_hardware_watchpoint) +// OBSOLETE +// OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the +// OBSOLETE instruction which caused the watchpoint. It will be necessary for +// OBSOLETE GDB to step over the watchpoint. +// OBSOLETE +// OBSOLETE On a PA running BSD, it is trivial to identify when it will be +// OBSOLETE necessary to step over a hardware watchpoint as we can examine +// OBSOLETE the PSW-X bit. If the bit is on, then we trapped because of a +// OBSOLETE watchpoint, else we trapped for some other reason. */ +// OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \ +// OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \ +// OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \ +// OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000)) +// OBSOLETE +// OBSOLETE /* The PA can single step over a watchpoint if the kernel has set the +// OBSOLETE "X" bit in the processor status word (disable data memory breakpoint +// OBSOLETE for one instruction). +// OBSOLETE +// OBSOLETE The kernel will always set this bit before notifying the inferior +// OBSOLETE that it hit a watchpoint. Thus, the inferior can single step over +// OBSOLETE the instruction which caused the watchpoint to fire. This avoids +// OBSOLETE the traditional need to disable the watchpoint, step the inferior, +// OBSOLETE then enable the watchpoint again. */ +// OBSOLETE #define HAVE_STEPPABLE_WATCHPOINT +// OBSOLETE +// OBSOLETE /* Use these macros for watchpoint insertion/deletion. */ +// OBSOLETE /* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */ +// OBSOLETE #define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1) +// OBSOLETE #define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0) diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h index 8387115..2cc1e30 100644 --- a/gdb/config/pa/nm-hppah.h +++ b/gdb/config/pa/nm-hppah.h @@ -117,6 +117,7 @@ extern int hppa_require_detach (int, int); /* The PA can watch any number of locations (generic routines already check that all intermediates are in watchable memory locations). */ +extern int hppa_can_use_hw_watchpoint (int type, int cnt, int ot); #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ hppa_can_use_hw_watchpoint(type, cnt, ot) @@ -198,9 +199,13 @@ extern void hppa_enable_page_protection_events (int); extern void hppa_disable_page_protection_events (int); /* Use these macros for watchpoint insertion/deletion. */ +extern int hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, + int type); #define target_insert_watchpoint(addr, len, type) \ hppa_insert_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type) +extern int hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, + int type); #define target_remove_watchpoint(addr, len, type) \ hppa_remove_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type) @@ -265,3 +270,5 @@ extern int hppa_resume_execd_vforking_child_to_get_parent_vfork (void); #define MAY_FOLLOW_EXEC (1) #define USE_THREAD_STEP_NEEDED (1) + +#include "infttrace.h" /* For parent_attach_all. */ diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h index 6389b2c..0a6b810 100644 --- a/gdb/config/pa/nm-hppao.h +++ b/gdb/config/pa/nm-hppao.h @@ -1,43 +1,43 @@ -/* HPPA PA-RISC machine native support for Lites, for GDB. - Copyright 1995, 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "config/nm-m3.h" -#define U_REGS_OFFSET 0 - -#define KERNEL_U_ADDR 0 - -/* What a coincidence! */ -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = (int)(blockend) + REGISTER_BYTE (regno);} - -/* fetch_inferior_registers is in hppab-nat.c. */ -#define FETCH_INFERIOR_REGISTERS - -/* attach/detach works to some extent under BSD and HPUX. So long - as the process you're attaching to isn't blocked waiting on io, - blocked waiting on a signal, or in a system call things work - fine. (The problems in those cases are related to the fact that - the kernel can't provide complete register information for the - target process... Which really pisses off GDB.) */ - -#define ATTACH_DETACH - -#define EMULATOR_BASE 0x90100000 -#define EMULATOR_END 0x90200000 +// OBSOLETE /* HPPA PA-RISC machine native support for Lites, for GDB. +// OBSOLETE Copyright 1995, 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "config/nm-m3.h" +// OBSOLETE #define U_REGS_OFFSET 0 +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0 +// OBSOLETE +// OBSOLETE /* What a coincidence! */ +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);} +// OBSOLETE +// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */ +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long +// OBSOLETE as the process you're attaching to isn't blocked waiting on io, +// OBSOLETE blocked waiting on a signal, or in a system call things work +// OBSOLETE fine. (The problems in those cases are related to the fact that +// OBSOLETE the kernel can't provide complete register information for the +// OBSOLETE target process... Which really pisses off GDB.) */ +// OBSOLETE +// OBSOLETE #define ATTACH_DETACH +// OBSOLETE +// OBSOLETE #define EMULATOR_BASE 0x90100000 +// OBSOLETE #define EMULATOR_END 0x90200000 diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index dc23a63..c0b3e26 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -24,6 +24,9 @@ #include "regcache.h" +/* Wonder if this is correct? Should be using push_dummy_call(). */ +#define DEPRECATED_DUMMY_WRITE_SP(SP) generic_target_write_sp (SP) + #define GDB_MULTI_ARCH 0 /* NOTE: cagney/2002-11-24: This is a guess. */ @@ -101,8 +104,8 @@ extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *); #endif #if !GDB_MULTI_ARCH -#undef SAVED_PC_AFTER_CALL -#define SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame) +#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 @@ -116,10 +119,6 @@ extern CORE_ADDR hppa_stack_align (CORE_ADDR sp); #define STACK_ALIGN(sp) hppa_stack_align (sp) #endif -#if !GDB_MULTI_ARCH -#define EXTRA_STACK_ALIGNMENT_NEEDED 0 -#endif - /* Sequence of bytes for breakpoint instruction. */ #define BREAKPOINT {0x00, 0x01, 0x00, 0x04} @@ -390,21 +389,21 @@ extern void hppa_init_extra_frame_info (int, struct frame_info *); /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ -/* FRAME_CHAIN takes a frame's nominal address and produces the - frame's chain-pointer. */ +/* 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 FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe) +#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 FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe) +#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe) #endif /* Define other aspects of the stack frame. */ @@ -420,7 +419,7 @@ extern int hppa_frameless_function_invocation (struct frame_info *); #if !GDB_MULTI_ARCH extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); -#define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) +#define DEPRECATED_FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME) #endif #if !GDB_MULTI_ARCH @@ -442,28 +441,21 @@ extern int hppa_frame_num_args (struct frame_info *frame); #define FRAME_ARGS_SKIP 0 #endif -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - hppa_frame_find_saved_regs (frame_info, &frame_saved_regs) -extern void hppa_frame_find_saved_regs (struct frame_info *, - struct frame_saved_regs *); - +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. */ -/* Push an empty stack frame, to record the current PC, etc. */ - -/* FIXME: brobecker 2002-12-26. This macro definition takes advantage - of the fact that DEPRECATED_PUSH_DUMMY_FRAME is called within a - function where a variable inf_status of type struct inferior_status - * is defined. Ugh! Until this is fixed, we will not be able to - move to multiarch partial. */ -#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status) -extern void hppa_push_dummy_frame (struct inferior_status *); +#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 POP_FRAME hppa_pop_frame () +#define DEPRECATED_POP_FRAME hppa_pop_frame () extern void hppa_pop_frame (void); #endif @@ -623,7 +615,7 @@ extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int, struct value **, struct type *, int); #if !GDB_MULTI_ARCH -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ (hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index e6177b0..503e426 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -122,20 +122,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SR5_REGNUM 48 -#undef FRAME_ARGS_ADDRESS -#define FRAME_ARGS_ADDRESS(fi) ((fi)->ap) - /* We access locals from SP. This may not work for frames which call alloca; for those, we may need to consult unwind tables. jimb: FIXME. */ #undef FRAME_LOCALS_ADDRESS #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) -#define INIT_FRAME_AP init_frame_ap - -#define EXTRA_FRAME_INFO \ - CORE_ADDR ap; - /* For a number of horrible reasons we may have to adjust the location of variables on the stack. Ugh. jimb: why? */ #define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR) @@ -191,7 +183,6 @@ call_dummy 0xe820f0000fb110d3LL, 0x0001000400151820LL,\ 0xe6c0000008000240LL} -#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1 #define CALL_DUMMY_BREAKPOINT_OFFSET 22 * 4 /* CALL_DUMMY_LENGTH is computed based on the size of a word on the target @@ -321,11 +312,11 @@ call_dummy for (i = 0; i < NUM_REGS; i++) \ { \ if (i == SP_REGNUM) \ - (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ + (FSR)[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \ else if (i >= FP0_REGNUM) \ - (FSR)->regs[i] = TMP2 + (i - FP0_REGNUM) * 8; \ + (FSR)[i] = TMP2 + (i - FP0_REGNUM) * 8; \ else \ - (FSR)->regs[i] = TMP1 + i * 8; \ + (FSR)[i] = TMP1 + i * 8; \ } \ } diff --git a/gdb/config/pa/tm-hppab.h b/gdb/config/pa/tm-hppab.h index 1cd438d..edacdbf 100644 --- a/gdb/config/pa/tm-hppab.h +++ b/gdb/config/pa/tm-hppab.h @@ -1,47 +1,47 @@ -/* Parameters for execution on an HP PA-RISC machine running BSD, for GDB. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). */ - -/* For BSD: - - The signal context structure pointer is always saved at the base - of the frame + 0x4. - - We get the PC & SP directly from the sigcontext structure itself. - For other registers we have to dive in a little deeper: - - The hardware save state pointer is at offset 0x10 within the - signal context structure. - - Within the hardware save state, registers are found in the same order - as the register numbers in GDB. */ - -#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ -{ \ - *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \ -} - -#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ -{ \ - *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \ -} - -#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ -{ \ - int i; \ - CORE_ADDR TMP; \ - TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - TMP = read_memory_integer (TMP + 0x10, 4); \ - for (i = 0; i < NUM_REGS; i++) \ - { \ - if (i == SP_REGNUM) \ - (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \ - else \ - (FSR)->regs[i] = TMP + i * 4; \ - } \ -} - -/* It's mostly just the common stuff. */ -#include "pa/tm-hppa.h" +// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running BSD, for GDB. +// OBSOLETE Contributed by the Center for Software Science at the +// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */ +// OBSOLETE +// OBSOLETE /* For BSD: +// OBSOLETE +// OBSOLETE The signal context structure pointer is always saved at the base +// OBSOLETE of the frame + 0x4. +// OBSOLETE +// OBSOLETE We get the PC & SP directly from the sigcontext structure itself. +// OBSOLETE For other registers we have to dive in a little deeper: +// OBSOLETE +// OBSOLETE The hardware save state pointer is at offset 0x10 within the +// OBSOLETE signal context structure. +// OBSOLETE +// OBSOLETE Within the hardware save state, registers are found in the same order +// OBSOLETE as the register numbers in GDB. */ +// OBSOLETE +// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ +// OBSOLETE { \ +// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ +// OBSOLETE { \ +// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ +// OBSOLETE { \ +// OBSOLETE int i; \ +// OBSOLETE CORE_ADDR TMP; \ +// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \ +// OBSOLETE for (i = 0; i < NUM_REGS; i++) \ +// OBSOLETE { \ +// OBSOLETE if (i == SP_REGNUM) \ +// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \ +// OBSOLETE else \ +// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \ +// OBSOLETE } \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* It's mostly just the common stuff. */ +// OBSOLETE #include "pa/tm-hppa.h" diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h index 4e68de9..070c83c 100644 --- a/gdb/config/pa/tm-hppah.h +++ b/gdb/config/pa/tm-hppah.h @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct frame_info; + /* The solib hooks are not really designed to have a list of hook and handler routines. So until we clean up those interfaces you either get SOM shared libraries or HP's unusual PA64 ELF shared @@ -46,9 +48,8 @@ extern void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ hppa_hpux_frame_base_before_sigtramp (FRAME, TMP) -struct frame_saved_regs; extern void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ hppa_hpux_frame_find_saved_regs_in_sigtramp (FRAME, FSR) diff --git a/gdb/config/pa/tm-hppao.h b/gdb/config/pa/tm-hppao.h index e6fae89..a466287 100644 --- a/gdb/config/pa/tm-hppao.h +++ b/gdb/config/pa/tm-hppao.h @@ -1,98 +1,98 @@ -/* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). */ - -#include "regcache.h" - -/* Define offsets to access CPROC stack when it does not have - * a kernel thread. - */ -#define MACHINE_CPROC_SP_OFFSET 20 -#define MACHINE_CPROC_PC_OFFSET 16 -#define MACHINE_CPROC_FP_OFFSET 12 - -/* - * Software defined PSW masks. - */ -#define PSW_SS 0x10000000 /* Kernel managed single step */ - -/* Thread flavors used in re-setting the T bit. - * @@ this is also bad for cross debugging. - */ -#define TRACE_FLAVOR HP800_THREAD_STATE -#define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT -#define TRACE_SET(x,state) \ - ((struct hp800_thread_state *)state)->cr22 |= PSW_SS -#define TRACE_CLEAR(x,state) \ - ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1) - -/* For OSF1 (Should be close if not identical to BSD, but I haven't - tested it yet): - - The signal context structure pointer is always saved at the base - of the frame + 0x4. - - We get the PC & SP directly from the sigcontext structure itself. - For other registers we have to dive in a little deeper: - - The hardware save state pointer is at offset 0x10 within the - signal context structure. - - Within the hardware save state, registers are found in the same order - as the register numbers in GDB. */ - -#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ -{ \ - *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \ -} - -#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ -{ \ - *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \ -} - -#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ -{ \ - int i; \ - CORE_ADDR TMP; \ - TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \ - TMP = read_memory_integer (TMP + 0x10, 4); \ - for (i = 0; i < NUM_REGS; i++) \ - { \ - if (i == SP_REGNUM) \ - (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \ - else \ - (FSR)->regs[i] = TMP + i * 4; \ - } \ -} - -/* OSF1 does not need the pc space queue restored. */ -#define NO_PC_SPACE_QUEUE_RESTORE - -/* The mach kernel uses the recovery counter to implement single - stepping. While this greatly simplifies the kernel support - necessary for single stepping, it unfortunately does the wrong - thing in the presense of a nullified instruction (gives control - back two insns after the nullifed insn). This is an artifact - of the HP architecture (recovery counter doesn't tick for - nullified insns). - - Do our best to avoid losing in such situations. */ -#define INSTRUCTION_NULLIFIED \ -(({ \ - int ipsw = (int)read_register(IPSW_REGNUM); \ - if (ipsw & PSW_N) \ - { \ - int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \ - write_register(PCOQ_HEAD_REGNUM, pcoqt); \ - write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \ - write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \ - stop_pc = pcoqt; \ - } \ - }), 0) - -/* It's mostly just the common stuff. */ - -#include "pa/tm-hppa.h" +// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB. +// OBSOLETE Contributed by the Center for Software Science at the +// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Define offsets to access CPROC stack when it does not have +// OBSOLETE * a kernel thread. +// OBSOLETE */ +// OBSOLETE #define MACHINE_CPROC_SP_OFFSET 20 +// OBSOLETE #define MACHINE_CPROC_PC_OFFSET 16 +// OBSOLETE #define MACHINE_CPROC_FP_OFFSET 12 +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Software defined PSW masks. +// OBSOLETE */ +// OBSOLETE #define PSW_SS 0x10000000 /* Kernel managed single step */ +// OBSOLETE +// OBSOLETE /* Thread flavors used in re-setting the T bit. +// OBSOLETE * @@ this is also bad for cross debugging. +// OBSOLETE */ +// OBSOLETE #define TRACE_FLAVOR HP800_THREAD_STATE +// OBSOLETE #define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT +// OBSOLETE #define TRACE_SET(x,state) \ +// OBSOLETE ((struct hp800_thread_state *)state)->cr22 |= PSW_SS +// OBSOLETE #define TRACE_CLEAR(x,state) \ +// OBSOLETE ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1) +// OBSOLETE +// OBSOLETE /* For OSF1 (Should be close if not identical to BSD, but I haven't +// OBSOLETE tested it yet): +// OBSOLETE +// OBSOLETE The signal context structure pointer is always saved at the base +// OBSOLETE of the frame + 0x4. +// OBSOLETE +// OBSOLETE We get the PC & SP directly from the sigcontext structure itself. +// OBSOLETE For other registers we have to dive in a little deeper: +// OBSOLETE +// OBSOLETE The hardware save state pointer is at offset 0x10 within the +// OBSOLETE signal context structure. +// OBSOLETE +// OBSOLETE Within the hardware save state, registers are found in the same order +// OBSOLETE as the register numbers in GDB. */ +// OBSOLETE +// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \ +// OBSOLETE { \ +// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \ +// OBSOLETE { \ +// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \ +// OBSOLETE { \ +// OBSOLETE int i; \ +// OBSOLETE CORE_ADDR TMP; \ +// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \ +// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \ +// OBSOLETE for (i = 0; i < NUM_REGS; i++) \ +// OBSOLETE { \ +// OBSOLETE if (i == SP_REGNUM) \ +// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \ +// OBSOLETE else \ +// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \ +// OBSOLETE } \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* OSF1 does not need the pc space queue restored. */ +// OBSOLETE #define NO_PC_SPACE_QUEUE_RESTORE +// OBSOLETE +// OBSOLETE /* The mach kernel uses the recovery counter to implement single +// OBSOLETE stepping. While this greatly simplifies the kernel support +// OBSOLETE necessary for single stepping, it unfortunately does the wrong +// OBSOLETE thing in the presense of a nullified instruction (gives control +// OBSOLETE back two insns after the nullifed insn). This is an artifact +// OBSOLETE of the HP architecture (recovery counter doesn't tick for +// OBSOLETE nullified insns). +// OBSOLETE +// OBSOLETE Do our best to avoid losing in such situations. */ +// OBSOLETE #define INSTRUCTION_NULLIFIED \ +// OBSOLETE (({ \ +// OBSOLETE int ipsw = (int)read_register(IPSW_REGNUM); \ +// OBSOLETE if (ipsw & PSW_N) \ +// OBSOLETE { \ +// OBSOLETE int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \ +// OBSOLETE write_register(PCOQ_HEAD_REGNUM, pcoqt); \ +// OBSOLETE write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \ +// OBSOLETE write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \ +// OBSOLETE stop_pc = pcoqt; \ +// OBSOLETE } \ +// OBSOLETE }), 0) +// OBSOLETE +// OBSOLETE /* It's mostly just the common stuff. */ +// OBSOLETE +// OBSOLETE #include "pa/tm-hppa.h" diff --git a/gdb/config/pa/tm-pro.h b/gdb/config/pa/tm-pro.h index 05ecb62..c4f2b77 100644 --- a/gdb/config/pa/tm-pro.h +++ b/gdb/config/pa/tm-pro.h @@ -1,14 +1,14 @@ -/* Parameters for execution on an HP PA-RISC level 0 embedded system. - This is based on tm-hppab.h. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). */ - -#define PA_LEVEL_0 /* Disables touching space regs and fp */ - -/* All the PRO targets use software floating point at the moment. */ -#define SOFT_FLOAT 1 - -/* It's mostly just the common stuff. */ -#include "pa/tm-hppa.h" - -#define GDB_TARGET_IS_PA_ELF +// OBSOLETE /* Parameters for execution on an HP PA-RISC level 0 embedded system. +// OBSOLETE This is based on tm-hppab.h. +// OBSOLETE Contributed by the Center for Software Science at the +// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */ +// OBSOLETE +// OBSOLETE #define PA_LEVEL_0 /* Disables touching space regs and fp */ +// OBSOLETE +// OBSOLETE /* All the PRO targets use software floating point at the moment. */ +// OBSOLETE #define SOFT_FLOAT 1 +// OBSOLETE +// OBSOLETE /* It's mostly just the common stuff. */ +// OBSOLETE #include "pa/tm-hppa.h" +// OBSOLETE +// OBSOLETE #define GDB_TARGET_IS_PA_ELF diff --git a/gdb/config/pa/xm-hppab.h b/gdb/config/pa/xm-hppab.h index d2561df..d46e5ad 100644 --- a/gdb/config/pa/xm-hppab.h +++ b/gdb/config/pa/xm-hppab.h @@ -1,24 +1,24 @@ -/* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB. - Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "pa/xm-pa.h" +// OBSOLETE /* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB. +// OBSOLETE Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE Contributed by the Center for Software Science at the +// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "pa/xm-pa.h" diff --git a/gdb/config/pa/xm-hppah.h b/gdb/config/pa/xm-hppah.h index b1c26dd..a2ed9ba 100644 --- a/gdb/config/pa/xm-hppah.h +++ b/gdb/config/pa/xm-hppah.h @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "pa/xm-pa.h" - #define USG #define HAVE_TERMIOS diff --git a/gdb/config/pa/xm-pa.h b/gdb/config/pa/xm-pa.h index 979609d..0095003 100644 --- a/gdb/config/pa/xm-pa.h +++ b/gdb/config/pa/xm-pa.h @@ -1,5 +1,5 @@ -/* Definitions for all PA machines. */ - -/* This was created for "makeva", which is obsolete. This file can - probably go away (unless someone can think of some other host thing - which is common to various pa machines). */ +// OBSOLETE /* Definitions for all PA machines. */ +// OBSOLETE +// OBSOLETE /* This was created for "makeva", which is obsolete. This file can +// OBSOLETE probably go away (unless someone can think of some other host thing +// OBSOLETE which is common to various pa machines). */ diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 1bdd9eb..c736589 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct frame_info; + #define GDB_MULTI_ARCH 1 /* Minimum possible text address in AIX */ @@ -79,8 +81,8 @@ extern void aix_process_linenos (void); /* Define other aspects of the stack frame. */ #define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \ - (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ - prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()) + (fromleaf ? DEPRECATED_SAVED_PC_AFTER_CALL (prev->next) : \ + prev->next ? DEPRECATED_FRAME_SAVED_PC (prev->next) : read_pc ()) /* NOTE: cagney/2002-12-08: Add local declaration of init_frame_pc_noop() because it isn't possible to include "arch-utils.h" here. Not too bad as this entire file is going away diff --git a/gdb/config/sparc/sparclet.mt b/gdb/config/sparc/sparclet.mt index f08cfd7..5dde41b 100644 --- a/gdb/config/sparc/sparclet.mt +++ b/gdb/config/sparc/sparclet.mt @@ -1,3 +1,3 @@ -# Target: SPARC embedded Sparclet monitor -TDEPFILES= sparc-tdep.o monitor.o sparclet-rom.o dsrec.o -TM_FILE= tm-sparclet.h +# OBSOLETE # Target: SPARC embedded Sparclet monitor +# OBSOLETE TDEPFILES= sparc-tdep.o monitor.o sparclet-rom.o dsrec.o +# OBSOLETE TM_FILE= tm-sparclet.h diff --git a/gdb/config/sparc/sparclite.mt b/gdb/config/sparc/sparclite.mt index 43cb38c..7ae1008 100644 --- a/gdb/config/sparc/sparclite.mt +++ b/gdb/config/sparc/sparclite.mt @@ -1,5 +1,5 @@ -# Target: Fujitsu SPARClite processor -TDEPFILES= sparc-tdep.o sparcl-tdep.o -TM_FILE= tm-sparclite.h -SIM_OBS = remote-sim.o -SIM = ../sim/erc32/libsim.a +# OBSOLETE # Target: Fujitsu SPARClite processor +# OBSOLETE TDEPFILES= sparc-tdep.o sparcl-tdep.o +# OBSOLETE TM_FILE= tm-sparclite.h +# OBSOLETE SIM_OBS = remote-sim.o +# OBSOLETE SIM = ../sim/erc32/libsim.a diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 691e38f..2d2193d 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct type; + #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL #ifndef GDB_TARGET_IS_SPARC64 @@ -96,22 +98,20 @@ #define CALL_DUMMY_START_OFFSET 0 #undef CALL_DUMMY_BREAKPOINT_OFFSET #define CALL_DUMMY_BREAKPOINT_OFFSET 0 -#undef CALL_DUMMY_BREAKPOINT_OFFSET_P -#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1 #undef CALL_DUMMY_LOCATION #define CALL_DUMMY_LOCATION AT_ENTRY_POINT #undef DEPRECATED_PC_IN_CALL_DUMMY #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_at_entry_point (pc, sp, frame_address) -#undef CALL_DUMMY_STACK_ADJUST -#define CALL_DUMMY_STACK_ADJUST 128 +#undef DEPRECATED_CALL_DUMMY_STACK_ADJUST +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 128 #undef SIZEOF_CALL_DUMMY_WORDS #define SIZEOF_CALL_DUMMY_WORDS 0 #undef CALL_DUMMY_ADDRESS #define CALL_DUMMY_ADDRESS() entry_point_address() #undef FIX_CALL_DUMMY #define FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P) -#undef PUSH_RETURN_ADDRESS -#define PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP) +#undef DEPRECATED_PUSH_RETURN_ADDRESS +#define DEPRECATED_PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP) extern CORE_ADDR sparc_at_entry_push_return_address (CORE_ADDR pc, CORE_ADDR sp); @@ -143,8 +143,8 @@ extern void sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); /* 128 is to reserve space to write the %i/%l registers that will be restored when we resume. */ -#undef CALL_DUMMY_STACK_ADJUST -#define CALL_DUMMY_STACK_ADJUST 128 +#undef DEPRECATED_CALL_DUMMY_STACK_ADJUST +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 128 /* Size of the call dummy in bytes. */ #undef CALL_DUMMY_LENGTH @@ -162,10 +162,6 @@ extern void sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); #undef CALL_DUMMY_BREAKPOINT_OFFSET #define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + (8 * 4)) -/* Let's GDB know that it can make a call_dummy breakpoint. */ -#undef CALL_DUMMY_BREAKPOINT_OFFSET_P -#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1 - /* Call dummy will be located on the stack. */ #undef CALL_DUMMY_LOCATION #define CALL_DUMMY_LOCATION ON_STACK @@ -182,7 +178,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, /* The remainder of these will accept the default definition. */ #undef SIZEOF_CALL_DUMMY_WORDS -#undef PUSH_RETURN_ADDRESS +#undef DEPRECATED_PUSH_RETURN_ADDRESS #undef CALL_DUMMY_ADDRESS #undef STORE_STRUCT_RETURN @@ -208,8 +204,8 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, CORE_ADDR sparc64_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); -#undef PUSH_ARGUMENTS -#define PUSH_ARGUMENTS(A,B,C,D,E) \ +#undef DEPRECATED_PUSH_ARGUMENTS +#define DEPRECATED_PUSH_ARGUMENTS(A,B,C,D,E) \ (sparc64_push_arguments ((A), (B), (C), (D), (E))) /* Store the address of the place in which to copy the structure the @@ -274,7 +270,7 @@ extern void sparc64_write_sp (CORE_ADDR); #define TARGET_READ_SP() (sparc64_read_sp ()) #define TARGET_READ_FP() (sparc64_read_fp ()) -#define TARGET_WRITE_SP(X) (sparc64_write_sp (X)) +#define DEPRECATED_DUMMY_WRITE_SP(X) (sparc64_write_sp (X)) #undef DEPRECATED_EXTRACT_RETURN_VALUE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 20d5b37..414b69e 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -199,10 +199,10 @@ extern int sparc_intreg_size (void); stack rather than with the other registers, and this causes hair and confusion in places like pop_frame. It might be better to remove the ins and locals from `registers', make sure that - get_saved_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. */ + 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. */ #define REGISTER_BYTES (32*4+32*4+8*4) @@ -258,7 +258,7 @@ extern CORE_ADDR sparc_skip_prologue (CORE_ADDR); the new frame is not set up until the new function executes some instructions. */ -#define SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM)) +#define DEPRECATED_SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM)) /* Stack grows downward. */ @@ -392,8 +392,8 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); #define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM) /* - * FRAME_CHAIN and FRAME_INFO definitions, collected here for convenience. - */ + * DEPRECATED_FRAME_CHAIN and FRAME_INFO definitions, collected here + * for convenience. */ #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0) /* @@ -403,58 +403,11 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR); /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. */ - -/* In the case of the Sun 4, the frame-chain's nominal address - is held in the frame pointer register. - - On the Sun4, the frame (in %fp) is %sp for the previous frame. - From the previous frame's %sp, we can find the previous frame's - %fp: it is in the save area just above the previous frame's %sp. - - If we are setting up an arbitrary frame, we'll need to know where - it ends. Hence the following. This part of the frame cache - structure should be checked before it is assumed that this frame's - bottom is in the stack pointer. - - If there isn't a frame below this one, the bottom of this frame is - in the stack pointer. - - If there is a frame below this one, and the frame pointers are - identical, it's a leaf frame and the bottoms are the same also. - - Otherwise the bottom of this frame is the top of the next frame. - - The bottom field is misnamed, since it might imply that memory from - bottom to frame contains this frame. That need not be true if - stack frames are allocated in different segments (e.g. some on a - stack, some on a heap in the data segment). - - GCC 2.6 and later can generate ``flat register window'' code that - makes frames by explicitly saving those registers that need to be - saved. %i7 is used as the frame pointer, and the frame is laid out - so that flat and non-flat calls can be intermixed freely within a - program. Unfortunately for GDB, this means it must detect and - record the flatness of frames. - - Since the prologue in a flat frame also tells us where fp and pc - have been stashed (the frame is of variable size, so their location - is not fixed), it's convenient to record them in the frame info. */ - -#define EXTRA_FRAME_INFO \ - CORE_ADDR bottom; \ - int in_prologue; \ - int flat; \ - /* Following fields only relevant for flat frames. */ \ - CORE_ADDR pc_addr; \ - CORE_ADDR fp_addr; \ - /* Add this to ->frame to get the value of the stack pointer at the */ \ - /* time of the register saves. */ \ - int sp_offset; +/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces + the frame's chain-pointer. */ -/* We need to override GET_SAVED_REGISTER so that we can deal with the - way outs change into ins in different frames. */ +/* We need to override DEPRECATED_GET_SAVED_REGISTER so that we can + deal with the way outs change into ins in different frames. */ void sparc_get_saved_register (char *raw_buffer, int *optimized, @@ -462,7 +415,7 @@ void sparc_get_saved_register (char *raw_buffer, struct frame_info *frame, int regnum, enum lval_type *lvalp); -#define GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \ +#define DEPRECATED_GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \ sparc_get_saved_register (RAW_BUFFER, OPTIMIZED, ADDRP, \ FRAME, REGNUM, LVAL) @@ -472,7 +425,7 @@ void sparc_get_saved_register (char *raw_buffer, sparc_init_extra_frame_info (FROMLEAF, FCI) extern void sparc_init_extra_frame_info (int, struct frame_info *); -#define FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME)) +#define DEPRECATED_FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME)) extern CORE_ADDR sparc_frame_chain (struct frame_info *); /* A macro that tells us whether the function invocation represented @@ -484,7 +437,7 @@ extern CORE_ADDR sparc_frame_chain (struct frame_info *); /* Where is the PC for a specific frame */ -#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME) +#define DEPRECATED_FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME) extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *); /* If the argument is on the stack, it will be here. */ @@ -518,8 +471,8 @@ extern void sparc_print_extra_frame_info (struct frame_info *); extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); #define DEPRECATED_INIT_FRAME_PC(FROMLEAF, PREV) (init_frame_pc_noop (FROMLEAF, PREV)) #define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \ - ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \ - (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ()) + ((FROMLEAF) ? DEPRECATED_SAVED_PC_AFTER_CALL ((PREV)->next) : \ + (PREV)->next ? DEPRECATED_FRAME_SAVED_PC ((PREV)->next) : read_pc ()) /* Define other aspects of the stack frame. */ @@ -649,7 +602,7 @@ extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); #define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + 0x30) -#define CALL_DUMMY_STACK_ADJUST 68 +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 68 /* Call dummy method (eg. on stack, at entry point, etc.) */ @@ -683,12 +636,12 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, /* Push an empty stack frame, to record the current PC, etc. */ #define DEPRECATED_PUSH_DUMMY_FRAME sparc_push_dummy_frame () -#define POP_FRAME sparc_pop_frame () +#define DEPRECATED_POP_FRAME sparc_pop_frame () void sparc_push_dummy_frame (void); void sparc_pop_frame (void); -#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ +#define DEPRECATED_PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ sparc32_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) extern CORE_ADDR sparc32_push_arguments (int, struct value **, CORE_ADDR, int, @@ -756,3 +709,4 @@ extern int deferred_stores; #define TM_PRINT_INSN_MACH bfd_mach_sparc +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED 1 diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h index 6aad71d..95bdeea 100644 --- a/gdb/config/sparc/tm-sparclet.h +++ b/gdb/config/sparc/tm-sparclet.h @@ -1,158 +1,158 @@ -/* Target machine definitions for GDB for an embedded SPARC. - Copyright 1996, 1997, 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - -#define TARGET_SPARCLET 1 /* Still needed for non-multi-arch case */ - -#include "sparc/tm-sparc.h" - -/* Note: we are not defining GDB_MULTI_ARCH for the sparclet target - at this time, because we have not figured out how to detect the - sparclet target from the bfd structure. */ - -/* Sparclet regs, for debugging purposes. */ - -enum { - CCSR_REGNUM = 72, - CCPR_REGNUM = 73, - CCCRCR_REGNUM = 74, - CCOR_REGNUM = 75, - CCOBR_REGNUM = 76, - CCIBR_REGNUM = 77, - CCIR_REGNUM = 78 -}; - -/* Select the sparclet disassembler. Slightly different instruction set from - the V8 sparc. */ - -#undef TM_PRINT_INSN_MACH -#define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclet - -/* overrides of tm-sparc.h */ - -#undef TARGET_BYTE_ORDER - -/* Sequence of bytes for breakpoint instruction (ta 1). */ -#undef BREAKPOINT -#define BIG_BREAKPOINT {0x91, 0xd0, 0x20, 0x01} -#define LITTLE_BREAKPOINT {0x01, 0x20, 0xd0, 0x91} - -#if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0) -/* - * The following defines must go away for MULTI_ARCH. - */ - -#undef NUM_REGS /* formerly "72" */ -/* WIN FP CPU CCP ASR AWR APSR */ -#define NUM_REGS (32 + 32 + 8 + 8 + 8/*+ 32 + 1*/) - -#undef REGISTER_BYTES /* formerly "(32*4 + 32*4 + 8*4)" */ -#define REGISTER_BYTES (32*4 + 32*4 + 8*4 + 8*4 + 8*4/* + 32*4 + 1*4*/) - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ -/* Sparclet has no fp! */ -/* Compiler maps types for floats by number, so can't - change the numbers here. */ - -#undef REGISTER_NAMES -#define REGISTER_NAMES \ -{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ - "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", \ - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ - "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", \ - \ - "", "", "", "", "", "", "", "", /* no FPU regs */ \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - "", "", "", "", "", "", "", "", \ - /* no CPSR, FPSR */ \ - "y", "psr", "wim", "tbr", "pc", "npc", "", "", \ - \ - "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", \ - \ - /* ASR15 ASR19 (don't display them) */ \ - "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", \ -/* \ - "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", \ - "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", \ - "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", \ - "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", \ - "apsr", \ - */ \ -} - -/* Remove FP dependant code which was defined in tm-sparc.h */ -#undef FP0_REGNUM /* Floating point register 0 */ -#undef FPS_REGNUM /* Floating point status register */ -#undef CPS_REGNUM /* Coprocessor status register */ - -/* sparclet register numbers */ -#define CCSR_REGNUM 72 - -#undef DEPRECATED_EXTRACT_RETURN_VALUE -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - { \ - memcpy ((VALBUF), \ - (char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \ - (TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \ - ? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \ - TYPE_LENGTH(TYPE)); \ - } -#undef DEPRECATED_STORE_RETURN_VALUE -#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ - { \ - /* Other values are returned in register %o0. */ \ - deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \ - TYPE_LENGTH (TYPE)); \ - } - -#endif /* GDB_MULTI_ARCH */ - -extern void sparclet_do_registers_info (int regnum, int all); -#undef DEPRECATED_DO_REGISTERS_INFO -#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL) - - -/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a - comment in <machine/setjmp.h>! */ - -#define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */ - -#define JB_ONSSTACK 0 -#define JB_SIGMASK 1 -#define JB_SP 2 -#define JB_PC 3 -#define JB_NPC 4 -#define JB_PSR 5 -#define JB_G1 6 -#define JB_O0 7 -#define JB_WBCNT 8 - -/* Figure out where the longjmp will land. We expect that we have just entered - longjmp and haven't yet setup the stack frame, so the args are still in the - output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we - extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -extern int get_longjmp_target (CORE_ADDR *); - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) +// OBSOLETE /* Target machine definitions for GDB for an embedded SPARC. +// OBSOLETE Copyright 1996, 1997, 2000 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #define TARGET_SPARCLET 1 /* Still needed for non-multi-arch case */ +// OBSOLETE +// OBSOLETE #include "sparc/tm-sparc.h" +// OBSOLETE +// OBSOLETE /* Note: we are not defining GDB_MULTI_ARCH for the sparclet target +// OBSOLETE at this time, because we have not figured out how to detect the +// OBSOLETE sparclet target from the bfd structure. */ +// OBSOLETE +// OBSOLETE /* Sparclet regs, for debugging purposes. */ +// OBSOLETE +// OBSOLETE enum { +// OBSOLETE CCSR_REGNUM = 72, +// OBSOLETE CCPR_REGNUM = 73, +// OBSOLETE CCCRCR_REGNUM = 74, +// OBSOLETE CCOR_REGNUM = 75, +// OBSOLETE CCOBR_REGNUM = 76, +// OBSOLETE CCIBR_REGNUM = 77, +// OBSOLETE CCIR_REGNUM = 78 +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* Select the sparclet disassembler. Slightly different instruction set from +// OBSOLETE the V8 sparc. */ +// OBSOLETE +// OBSOLETE #undef TM_PRINT_INSN_MACH +// OBSOLETE #define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclet +// OBSOLETE +// OBSOLETE /* overrides of tm-sparc.h */ +// OBSOLETE +// OBSOLETE #undef TARGET_BYTE_ORDER +// OBSOLETE +// OBSOLETE /* Sequence of bytes for breakpoint instruction (ta 1). */ +// OBSOLETE #undef BREAKPOINT +// OBSOLETE #define BIG_BREAKPOINT {0x91, 0xd0, 0x20, 0x01} +// OBSOLETE #define LITTLE_BREAKPOINT {0x01, 0x20, 0xd0, 0x91} +// OBSOLETE +// OBSOLETE #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0) +// OBSOLETE /* +// OBSOLETE * The following defines must go away for MULTI_ARCH. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #undef NUM_REGS /* formerly "72" */ +// OBSOLETE /* WIN FP CPU CCP ASR AWR APSR */ +// OBSOLETE #define NUM_REGS (32 + 32 + 8 + 8 + 8/*+ 32 + 1*/) +// OBSOLETE +// OBSOLETE #undef REGISTER_BYTES /* formerly "(32*4 + 32*4 + 8*4)" */ +// OBSOLETE #define REGISTER_BYTES (32*4 + 32*4 + 8*4 + 8*4 + 8*4/* + 32*4 + 1*4*/) +// OBSOLETE +// OBSOLETE /* Initializer for an array of names of registers. +// OBSOLETE There should be NUM_REGS strings in this initializer. */ +// OBSOLETE /* Sparclet has no fp! */ +// OBSOLETE /* Compiler maps types for floats by number, so can't +// OBSOLETE change the numbers here. */ +// OBSOLETE +// OBSOLETE #undef REGISTER_NAMES +// OBSOLETE #define REGISTER_NAMES \ +// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ +// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", \ +// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ +// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", \ +// OBSOLETE \ +// OBSOLETE "", "", "", "", "", "", "", "", /* no FPU regs */ \ +// OBSOLETE "", "", "", "", "", "", "", "", \ +// OBSOLETE "", "", "", "", "", "", "", "", \ +// OBSOLETE "", "", "", "", "", "", "", "", \ +// OBSOLETE /* no CPSR, FPSR */ \ +// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", \ +// OBSOLETE \ +// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", \ +// OBSOLETE \ +// OBSOLETE /* ASR15 ASR19 (don't display them) */ \ +// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", \ +// OBSOLETE /* \ +// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", \ +// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", \ +// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", \ +// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", \ +// OBSOLETE "apsr", \ +// OBSOLETE */ \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Remove FP dependant code which was defined in tm-sparc.h */ +// OBSOLETE #undef FP0_REGNUM /* Floating point register 0 */ +// OBSOLETE #undef FPS_REGNUM /* Floating point status register */ +// OBSOLETE #undef CPS_REGNUM /* Coprocessor status register */ +// OBSOLETE +// OBSOLETE /* sparclet register numbers */ +// OBSOLETE #define CCSR_REGNUM 72 +// OBSOLETE +// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE +// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +// OBSOLETE { \ +// OBSOLETE memcpy ((VALBUF), \ +// OBSOLETE (char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \ +// OBSOLETE (TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \ +// OBSOLETE ? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \ +// OBSOLETE TYPE_LENGTH(TYPE)); \ +// OBSOLETE } +// OBSOLETE #undef DEPRECATED_STORE_RETURN_VALUE +// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \ +// OBSOLETE { \ +// OBSOLETE /* Other values are returned in register %o0. */ \ +// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \ +// OBSOLETE TYPE_LENGTH (TYPE)); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* GDB_MULTI_ARCH */ +// OBSOLETE +// OBSOLETE extern void sparclet_do_registers_info (int regnum, int all); +// OBSOLETE #undef DEPRECATED_DO_REGISTERS_INFO +// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL) +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Offsets into jmp_buf. Not defined by Sun, but at least documented in a +// OBSOLETE comment in <machine/setjmp.h>! */ +// OBSOLETE +// OBSOLETE #define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */ +// OBSOLETE +// OBSOLETE #define JB_ONSSTACK 0 +// OBSOLETE #define JB_SIGMASK 1 +// OBSOLETE #define JB_SP 2 +// OBSOLETE #define JB_PC 3 +// OBSOLETE #define JB_NPC 4 +// OBSOLETE #define JB_PSR 5 +// OBSOLETE #define JB_G1 6 +// OBSOLETE #define JB_O0 7 +// OBSOLETE #define JB_WBCNT 8 +// OBSOLETE +// OBSOLETE /* Figure out where the longjmp will land. We expect that we have just entered +// OBSOLETE longjmp and haven't yet setup the stack frame, so the args are still in the +// OBSOLETE output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we +// OBSOLETE extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. +// OBSOLETE This routine returns true on success */ +// OBSOLETE +// OBSOLETE extern int get_longjmp_target (CORE_ADDR *); +// OBSOLETE +// OBSOLETE #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) diff --git a/gdb/config/sparc/tm-sparclite.h b/gdb/config/sparc/tm-sparclite.h index fb8b6d5..bd8996b 100644 --- a/gdb/config/sparc/tm-sparclite.h +++ b/gdb/config/sparc/tm-sparclite.h @@ -1,123 +1,123 @@ -/* Macro definitions for GDB for a Fujitsu SPARClite. - Copyright 1993, 1994, 1995, 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 "regcache.h" - -#define TARGET_SPARCLITE 1 /* Still needed for non-multi-arch case */ - -#include "sparc/tm-sparc.h" - -/* Note: we are not defining GDB_MULTI_ARCH for the sparclet target - at this time, because we have not figured out how to detect the - sparclet target from the bfd structure. */ - -/* Sparclite regs, for debugging purposes */ - -enum { - DIA1_REGNUM = 72, /* debug instr address register 1 */ - DIA2_REGNUM = 73, /* debug instr address register 2 */ - DDA1_REGNUM = 74, /* debug data address register 1 */ - DDA2_REGNUM = 75, /* debug data address register 2 */ - DDV1_REGNUM = 76, /* debug data value register 1 */ - DDV2_REGNUM = 77, /* debug data value register 2 */ - DCR_REGNUM = 78, /* debug control register */ - DSR_REGNUM = 79 /* debug status regsiter */ -}; - -/* overrides of tm-sparc.h */ - -#undef TARGET_BYTE_ORDER - -/* Select the sparclite disassembler. Slightly different instruction set from - the V8 sparc. */ - -#undef TM_PRINT_INSN_MACH -#define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclite - -/* Amount PC must be decremented by after a hardware instruction breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#define DECR_PC_AFTER_HW_BREAK 4 - -#if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0) -/* - * The following defines must go away for MULTI_ARCH. - */ - -#undef NUM_REGS -#define NUM_REGS 80 - -#undef REGISTER_BYTES -#define REGISTER_BYTES (32*4+32*4+8*4+8*4) - -#undef REGISTER_NAMES -#define REGISTER_NAMES \ -{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ - "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \ - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ - "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \ - \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ - \ - "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", \ - "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" } - -#define DIA1_REGNUM 72 /* debug instr address register 1 */ -#define DIA2_REGNUM 73 /* debug instr address register 2 */ -#define DDA1_REGNUM 74 /* debug data address register 1 */ -#define DDA2_REGNUM 75 /* debug data address register 2 */ -#define DDV1_REGNUM 76 /* debug data value register 1 */ -#define DDV2_REGNUM 77 /* debug data value register 2 */ -#define DCR_REGNUM 78 /* debug control register */ -#define DSR_REGNUM 79 /* debug status regsiter */ - -#endif /* GDB_MULTI_ARCH */ - -#define TARGET_HW_BREAK_LIMIT 2 -#define TARGET_HW_WATCH_LIMIT 2 - -/* Enable watchpoint macro's */ - -#define TARGET_HAS_HARDWARE_WATCHPOINTS - -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ - sparclite_check_watch_resources (type, cnt, ot) - -/* When a hardware watchpoint fires off the PC will be left at the - instruction which caused the watchpoint. It will be necessary for - GDB to step over the watchpoint. *** - - #define STOPPED_BY_WATCHPOINT(W) \ - ((W).kind == TARGET_WAITKIND_STOPPED \ - && (W).value.sig == TARGET_SIGNAL_TRAP \ - && ((int) read_register (IPSW_REGNUM) & 0x00100000)) - */ - -/* Use these macros for watchpoint insertion/deletion. */ -#define target_insert_watchpoint(addr, len, type) sparclite_insert_watchpoint (addr, len, type) -#define target_remove_watchpoint(addr, len, type) sparclite_remove_watchpoint (addr, len, type) -#define target_insert_hw_breakpoint(addr, len) sparclite_insert_hw_breakpoint (addr, len) -#define target_remove_hw_breakpoint(addr, len) sparclite_remove_hw_breakpoint (addr, len) -#define target_stopped_data_address() sparclite_stopped_data_address() +// OBSOLETE /* Macro definitions for GDB for a Fujitsu SPARClite. +// OBSOLETE Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #define TARGET_SPARCLITE 1 /* Still needed for non-multi-arch case */ +// OBSOLETE +// OBSOLETE #include "sparc/tm-sparc.h" +// OBSOLETE +// OBSOLETE /* Note: we are not defining GDB_MULTI_ARCH for the sparclet target +// OBSOLETE at this time, because we have not figured out how to detect the +// OBSOLETE sparclet target from the bfd structure. */ +// OBSOLETE +// OBSOLETE /* Sparclite regs, for debugging purposes */ +// OBSOLETE +// OBSOLETE enum { +// OBSOLETE DIA1_REGNUM = 72, /* debug instr address register 1 */ +// OBSOLETE DIA2_REGNUM = 73, /* debug instr address register 2 */ +// OBSOLETE DDA1_REGNUM = 74, /* debug data address register 1 */ +// OBSOLETE DDA2_REGNUM = 75, /* debug data address register 2 */ +// OBSOLETE DDV1_REGNUM = 76, /* debug data value register 1 */ +// OBSOLETE DDV2_REGNUM = 77, /* debug data value register 2 */ +// OBSOLETE DCR_REGNUM = 78, /* debug control register */ +// OBSOLETE DSR_REGNUM = 79 /* debug status regsiter */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* overrides of tm-sparc.h */ +// OBSOLETE +// OBSOLETE #undef TARGET_BYTE_ORDER +// OBSOLETE +// OBSOLETE /* Select the sparclite disassembler. Slightly different instruction set from +// OBSOLETE the V8 sparc. */ +// OBSOLETE +// OBSOLETE #undef TM_PRINT_INSN_MACH +// OBSOLETE #define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclite +// OBSOLETE +// OBSOLETE /* Amount PC must be decremented by after a hardware instruction breakpoint. +// OBSOLETE This is often the number of bytes in BREAKPOINT +// OBSOLETE but not always. */ +// OBSOLETE +// OBSOLETE #define DECR_PC_AFTER_HW_BREAK 4 +// OBSOLETE +// OBSOLETE #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0) +// OBSOLETE /* +// OBSOLETE * The following defines must go away for MULTI_ARCH. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #undef NUM_REGS +// OBSOLETE #define NUM_REGS 80 +// OBSOLETE +// OBSOLETE #undef REGISTER_BYTES +// OBSOLETE #define REGISTER_BYTES (32*4+32*4+8*4+8*4) +// OBSOLETE +// OBSOLETE #undef REGISTER_NAMES +// OBSOLETE #define REGISTER_NAMES \ +// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \ +// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \ +// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ +// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \ +// OBSOLETE \ +// OBSOLETE "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ +// OBSOLETE "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ +// OBSOLETE "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ +// OBSOLETE "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ +// OBSOLETE \ +// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", \ +// OBSOLETE "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" } +// OBSOLETE +// OBSOLETE #define DIA1_REGNUM 72 /* debug instr address register 1 */ +// OBSOLETE #define DIA2_REGNUM 73 /* debug instr address register 2 */ +// OBSOLETE #define DDA1_REGNUM 74 /* debug data address register 1 */ +// OBSOLETE #define DDA2_REGNUM 75 /* debug data address register 2 */ +// OBSOLETE #define DDV1_REGNUM 76 /* debug data value register 1 */ +// OBSOLETE #define DDV2_REGNUM 77 /* debug data value register 2 */ +// OBSOLETE #define DCR_REGNUM 78 /* debug control register */ +// OBSOLETE #define DSR_REGNUM 79 /* debug status regsiter */ +// OBSOLETE +// OBSOLETE #endif /* GDB_MULTI_ARCH */ +// OBSOLETE +// OBSOLETE #define TARGET_HW_BREAK_LIMIT 2 +// OBSOLETE #define TARGET_HW_WATCH_LIMIT 2 +// OBSOLETE +// OBSOLETE /* Enable watchpoint macro's */ +// OBSOLETE +// OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS +// OBSOLETE +// OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \ +// OBSOLETE sparclite_check_watch_resources (type, cnt, ot) +// OBSOLETE +// OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the +// OBSOLETE instruction which caused the watchpoint. It will be necessary for +// OBSOLETE GDB to step over the watchpoint. *** +// OBSOLETE +// OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \ +// OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \ +// OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \ +// OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000)) +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Use these macros for watchpoint insertion/deletion. */ +// OBSOLETE #define target_insert_watchpoint(addr, len, type) sparclite_insert_watchpoint (addr, len, type) +// OBSOLETE #define target_remove_watchpoint(addr, len, type) sparclite_remove_watchpoint (addr, len, type) +// OBSOLETE #define target_insert_hw_breakpoint(addr, len) sparclite_insert_hw_breakpoint (addr, len) +// OBSOLETE #define target_remove_hw_breakpoint(addr, len) sparclite_remove_hw_breakpoint (addr, len) +// OBSOLETE #define target_stopped_data_address() sparclite_stopped_data_address() diff --git a/gdb/configure.host b/gdb/configure.host index b309a33..8f96b0a 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -40,18 +40,18 @@ arm*-*-linux*) gdb_host=linux ;; arm*-*-netbsdelf*) gdb_host=nbsdelf ;; arm*-*-netbsd*) gdb_host=nbsdaout ;; -hppa*-*-bsd*) gdb_host=hppabsd ;; +# OBSOLETE hppa*-*-bsd*) gdb_host=hppabsd ;; hppa*-*-hiux*) gdb_host=hppahpux ;; hppa*-*-hpux10.20) gdb_host=hpux1020 ;; hppa*64*-*-hpux11*) gdb_host=hpux11w ;; hppa*-*-hpux11*) gdb_host=hpux11 ;; hppa*-*-hpux*) gdb_host=hppahpux ;; -hppa*-*-osf*) gdb_host=hppaosf ;; +# OBSOLETE hppa*-*-osf*) gdb_host=hppaosf ;; i[3456]86-ncr-*) gdb_host=ncr3000 ;; -i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix -i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;; -i[3456]86-sequent-sysv*) gdb_host=ptx ;; +# OBSOLETE i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix +# OBSOLETE i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;; +# OBSOLETE i[3456]86-sequent-sysv*) gdb_host=ptx ;; i[3456]86-*-bsd*) gdb_host=i386bsd ;; i[3456]86-*-dgux*) gdb_host=i386v4 ;; i[3456]86-*-freebsd*) gdb_host=fbsd ;; @@ -94,7 +94,7 @@ m68*-sun-sunos3*) gdb_host=sun3os3 ;; m68*-sun-sunos4*) gdb_host=sun3os4 ;; m68*-sun-*) gdb_host=sun3os4 ;; -mips-dec-mach3*) gdb_host=mipsm3 ;; +# OBSOLETE mips-dec-mach3*) gdb_host=mipsm3 ;; mips-dec-*) gdb_host=decstation ;; mips-little-*) gdb_host=littlemips ;; mips-sgi-irix3*) gdb_host=irix3 ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 17ac70f..aeb9e271 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -73,17 +73,17 @@ h8300-*-*) gdb_target=h8300 ;; frv-*-*) gdb_target=frv ;; -hppa*-*-bsd*) gdb_target=hppabsd ;; -hppa*-*-pro*) gdb_target=hppapro ;; +# OBSOLETE hppa*-*-bsd*) gdb_target=hppabsd ;; +# OBSOLETE hppa*-*-pro*) gdb_target=hppapro ;; hppa*64*-*-hpux11*) gdb_target=hppa64 ;; hppa*-*-hpux*) gdb_target=hppahpux ;; hppa*-*-hiux*) gdb_target=hppahpux ;; -hppa*-*-osf*) gdb_target=hppaosf ;; +# OBSOLETE hppa*-*-osf*) gdb_target=hppaosf ;; hppa*-*-*) gdb_target=hppa ;; -i[3456]86-sequent-bsd*) gdb_target=symmetry ;; -i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;; -i[3456]86-sequent-sysv*) gdb_target=ptx ;; +# OBSOLETE i[3456]86-sequent-bsd*) gdb_target=symmetry ;; +# OBSOLETE i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;; +# OBSOLETE i[3456]86-sequent-sysv*) gdb_target=ptx ;; i[3456]86-ncr-*) gdb_target=ncr3000 ;; i[3456]86-*-bsd*) gdb_target=i386bsd ;; i[3456]86-*-netbsd*) gdb_target=nbsd ;; @@ -172,7 +172,7 @@ mips*-*-linux*) gdb_target=linux build_gdbserver=yes ;; mips*-*-netbsd*) gdb_target=nbsd ;; -mips*-*-mach3*) gdb_target=mipsm3 ;; +# OBSOLETE mips*-*-mach3*) gdb_target=mipsm3 ;; mips*-*-sysv4*) gdb_target=mipsv4 ;; mips*-*-sysv*) gdb_target=bigmips ;; mips*-*-riscos*) gdb_target=bigmips ;; @@ -229,9 +229,9 @@ sparc-*-sunos4*) gdb_target=sun4os4 ;; sparc-*-sunos5*) gdb_target=sun4sol2 ;; sparc-*-vxworks*) gdb_target=vxsparc ;; sparc-*-*) gdb_target=sun4os4 ;; -sparclet-*-*) gdb_target=sparclet;; -sparclite-*-*) gdb_target=sparclite ;; -sparc86x-*-*) gdb_target=sparclite ;; +# OBSOLETE sparclet-*-*) gdb_target=sparclet;; +# OBSOLETE sparclite-*-*) gdb_target=sparclite ;; +# OBSOLETE sparc86x-*-*) gdb_target=sparclite ;; # It's not clear what the right solution for "v8plus" systems is yet. # For now, stick with sparc-sun-solaris2 since that's what config.guess # should return. Work is still needed to get gdb to print the 64 bit diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h index e119514..0413aba 100644 --- a/gdb/cp-abi.h +++ b/gdb/cp-abi.h @@ -25,6 +25,8 @@ #ifndef CP_ABI_H_ #define CP_ABI_H_ 1 +struct fn_field; +struct type; struct value; /* The functions here that attempt to determine what sort of thing a diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 7205cf7..24741c3 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -38,7 +38,7 @@ unsigned char processing_has_namespace_info; contain the name of the current namespace. The string is temporary; copy it if you need it. */ -const char *processing_current_namespace; +const char *processing_current_prefix; /* List of using directives that are active in the current file. */ @@ -175,8 +175,8 @@ cp_set_block_scope (const struct symbol *symbol, if (processing_has_namespace_info) { block_set_scope - (block, obsavestring (processing_current_namespace, - strlen (processing_current_namespace), + (block, obsavestring (processing_current_prefix, + strlen (processing_current_prefix), obstack), obstack); } diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 07c1928..784826b 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include <ctype.h> #include "cp-support.h" #include "gdb_string.h" #include "demangle.h" @@ -34,7 +35,14 @@ #include "dictionary.h" #include "gdbcmd.h" -static char *xstrndup (const char *string, size_t len); +/* The list of "maint cplus" commands. */ + +static struct cmd_list_element *maint_cplus_cmd_list = NULL; + +/* The actual commands. */ + +static void maint_cplus_command (char *arg, int from_tty); +static void first_component_command (char *arg, int from_tty); static const char *find_last_component (const char *name); @@ -92,14 +100,15 @@ static void maintenance_print_namespace (char *args, int from_tty); fairly restrictive set of locations (in particular, they have be at depth 0, don't they?). */ -/* NOTE: carlton/2002-10-25: Daniel Jacobowitz came up with an example +/* 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. */ -/* FIXME: carlton/2002-10-09: Do all the functions here handle all the - above considerations correctly? */ +/* FIXME: carlton/2003-03-13: We have several functions here with + overlapping functionality; can we combine them? Also, do they + handle all the above considerations correctly? */ /* Find the last component of the demangled C++ name NAME. NAME must be a method name including arguments, in order to correctly @@ -226,6 +235,11 @@ method_name_from_physname (const char *physname) the recursion easier, it also stops if it reaches an unexpected ')' or '>'. */ +/* NOTE: carlton/2003-03-13: This function is currently only intended + for internal use: it's probably not entirely safe when called on + user-generated input, because some of the 'index += 2' lines might + go past the end of malformed input. */ + /* Let's optimize away calls to strlen("operator"). */ #define LENGTH_OF_OPERATOR 8 @@ -242,6 +256,8 @@ cp_find_first_component (const char *name) if (strncmp (name, "operator", LENGTH_OF_OPERATOR) == 0) { index += LENGTH_OF_OPERATOR; + while (isspace(name[index])) + ++index; switch (name[index]) { case '<': @@ -312,7 +328,8 @@ cp_find_first_component (const char *name) name. Given 'A::foo', it returns 1, given 'A::B::foo', it returns 4, given 'foo', it returns 0. */ -unsigned int cp_entire_prefix_len (const char *name) +unsigned int +cp_entire_prefix_len (const char *name) { unsigned int current_len = cp_find_first_component (name); unsigned int previous_len = 0; @@ -329,61 +346,6 @@ unsigned int cp_entire_prefix_len (const char *name) return previous_len; } -/* Create a new struct using direct whose inner namespace is the - initial substring of NAME of leng INNER_LEN and whose outer - namespace is the initial substring of NAME of length OUTER_LENGTH. - Set its next member in the linked list to NEXT; allocate all memory - using xmalloc. It copies the strings, so NAME can be a temporary - string. */ - -struct using_direct * -cp_add_using (const char *name, - unsigned int inner_len, - unsigned int outer_len, - struct using_direct *next) -{ - struct using_direct *retval; - - gdb_assert (outer_len < inner_len); - - retval = xmalloc (sizeof (struct using_direct)); - retval->inner = xstrndup (name, inner_len); - retval->outer = xstrndup (name, outer_len); - retval->next = next; - - return retval; -} - -/* Make a copy of the using directives in the list pointed to by - USING, using OBSTACK to allocate memory. Free all memory pointed - to by USING via xfree. */ - -extern struct using_direct * -cp_copy_usings (struct using_direct *using, - struct obstack *obstack) -{ - if (using == NULL) - { - return NULL; - } - else - { - struct using_direct *retval - = obstack_alloc (obstack, sizeof (struct using_direct)); - retval->inner = obsavestring (using->inner, strlen (using->inner), - obstack); - retval->outer = obsavestring (using->outer, strlen (using->outer), - obstack); - retval->next = cp_copy_usings (using->next, obstack); - - xfree (using->inner); - xfree (using->outer); - xfree (using); - - return retval; - } -} - /* Allocate everything necessary for namespace_block and possible_namespace_block. */ @@ -646,35 +608,6 @@ maintenance_print_namespace (char *args, int from_tty) } } -/* Test whether or not NAMESPACE looks like it mentions an anonymous - namespace; return 1 if it mentions "(anonymous namespace)", 2 if it - mentions "{anonymous}", and 0 otherwise. */ - -int -cp_is_anonymous (const char *namespace) -{ - if (strstr (namespace, "(anonymous namespace)") != NULL) - return 1; - else if (strstr (namespace, "{anonymous}") != NULL) - return 2; - else - return 0; -} - -/* Create a copy of the initial substring of STRING of length LEN. - Allocate memory via xmalloc. */ - -static char * -xstrndup (const char *string, size_t len) -{ - char *retval = xmalloc (len + 1); - - strncpy (retval, string, len); - retval[len] = '\0'; - - return retval; -} - /* If FULL_NAME is the demangled name of a C++ function (including an arg list, possibly including namespace/class qualifications), return a new string containing only the function name (without the @@ -703,9 +636,42 @@ cp_func_name (const char *full_name) return remove_params (previous_component); } +/* Don't allow just "maintenance cplus". */ + +static void +maint_cplus_command (char *arg, int from_tty) +{ + printf_unfiltered ("\"maintenance cplus\" must be followed by the name of a command.\n"); + help_list (maint_cplus_cmd_list, "maintenance cplus ", -1, gdb_stdout); +} + +/* This is a front end for cp_find_first_component, for unit testing. + Be careful when using it: see the NOTE above + cp_find_first_component. */ + +static void +first_component_command (char *arg, int from_tty) +{ + int len = cp_find_first_component (arg); + char *prefix = alloca (len + 1); + + memcpy (prefix, arg, len); + prefix[len] = '\0'; + + printf_unfiltered ("%s\n", prefix); +} + void _initialize_cp_support (void) { + add_prefix_cmd ("cplus", class_maintenance, maint_cplus_command, + "C++ maintenance commands.", &maint_cplus_cmd_list, + "maintenance cplus ", 0, &maintenancelist); + add_alias_cmd ("cp", "cplus", class_maintenance, 1, &maintenancelist); + + add_cmd ("first_component", class_maintenance, first_component_command, + "Print the first class/namespace component of NAME.", + &maint_cplus_cmd_list); add_cmd ("namespace", class_maintenance, maintenance_print_namespace, "Print the list of current known C++ namespaces.", &maintenanceprintlist); diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 7aca377..1bf1c72 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -1,7 +1,8 @@ /* Helper routines for C++ support in GDB. Copyright 2002, 2003 Free Software Foundation, Inc. - Contributed by MontaVista Software and Stanford University. + Contributed by MontaVista Software. + Namespace support contributed by David Carlton. This file is part of GDB. @@ -26,6 +27,7 @@ /* Opaque declarations. */ struct obstack; +struct block; struct symbol; /* This struct is designed to store data from using directives. It @@ -41,6 +43,9 @@ struct using_direct struct using_direct *next; }; + +/* Functions from cp-support.c. */ + extern char *class_name_from_physname (const char *physname); extern char *method_name_from_physname (const char *physname); @@ -49,14 +54,6 @@ extern unsigned int cp_find_first_component (const char *name); extern unsigned int cp_entire_prefix_len (const char *name); -extern struct using_direct *cp_add_using (const char *name, - unsigned int inner_len, - unsigned int outer_len, - struct using_direct *next); - -extern struct using_direct *cp_copy_usings (struct using_direct *using, - struct obstack *obstack); - extern struct symbol *cp_check_namespace_symbol (const char *name, int len); extern struct symbol *cp_lookup_namespace_symbol (const char *name); @@ -65,8 +62,30 @@ extern void cp_check_possible_namespace_symbols (const char *name); extern struct symbol *cp_lookup_possible_namespace_symbol (const char *name); +extern char *cp_func_name (const char *full_name); + + +/* Functions/variables from cp-namespace.c. */ + +extern unsigned char processing_has_namespace_info; + +extern const char *processing_current_prefix; + extern int cp_is_anonymous (const char *namespace); -extern char *cp_func_name (const char *full_name); +extern void cp_add_using_directive (const char *name, + unsigned int outer_length, + unsigned int inner_length); + +extern void cp_initialize_namespace (); + +extern void cp_finalize_namespace (struct block *static_block, + struct obstack *obstack); + +extern void cp_set_block_scope (const struct symbol *symbol, + struct block *block, + struct obstack *obstack); + +extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol); #endif /* CP_SUPPORT_H */ diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index f1f64f8..3cb1653 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -87,7 +87,7 @@ cp_print_class_method (char *valaddr, fprintf_filtered (stream, "<unknown>"); return; } - addr = unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr); + addr = unpack_pointer (type, valaddr); if (METHOD_PTR_IS_VIRTUAL (addr)) { offset = METHOD_PTR_TO_VOFFSET (addr); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index a51f98c..f03cd14 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) } else { - ip = get_pc_function_start (get_frame_pc (fi)); + ip = get_frame_func (fi); sal = find_pc_line (ip, 0); /* If there is no symbol information then sal.end == 0, and we end up @@ -1204,7 +1204,7 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi) if (get_next_frame (fi)) { /* Called from get_prev_frame. */ - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); } frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); @@ -4154,7 +4154,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) if (tdep->cris_abi == CRIS_ABI_ORIGINAL) { set_gdbarch_double_bit (gdbarch, 32); - set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_original_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_original_store_return_value); set_gdbarch_deprecated_extract_return_value @@ -4165,7 +4165,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else if (tdep->cris_abi == CRIS_ABI_V2) { set_gdbarch_double_bit (gdbarch, 64); - set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_v2_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_v2_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, cris_abi_v2_extract_return_value); @@ -4255,39 +4255,23 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Use generic dummy frames. */ - /* Where to execute the call in the memory segments. */ - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - - /* Start execution at the beginning of dummy. */ - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - - /* Set to 1 since call_dummy_breakpoint_offset was defined. */ - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - /* Read all about dummy frames in blockframe.c. */ - set_gdbarch_call_dummy_length (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); /* Defined to 1 to indicate that the target supports inferior function calls. */ - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, 0); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - /* No stack adjustment needed when peforming an inferior function call. */ - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - - set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); + set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); /* No register requires conversion from raw format to virtual format. */ set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not); - set_gdbarch_push_return_address (gdbarch, cris_push_return_address); - set_gdbarch_pop_frame (gdbarch, cris_pop_frame); + set_gdbarch_deprecated_push_return_address (gdbarch, cris_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame); - set_gdbarch_store_struct_return (gdbarch, cris_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, cris_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention); @@ -4314,19 +4298,19 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, cris_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, cris_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, cris_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, cris_frame_saved_pc); - set_gdbarch_saved_pc_after_call (gdbarch, cris_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - /* No extra stack alignment needed. Set to 1 by default. */ - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); - /* Helpful for backtracing and returning in a call dummy. */ set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* Use target_specific function to define link map offsets. */ set_solib_svr4_fetch_link_map_offsets (gdbarch, cris_linux_svr4_fetch_link_map_offsets); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index f37f191..45ac682 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -25,6 +25,7 @@ #include "defs.h" #include "frame.h" #include "frame-unwind.h" +#include "frame-base.h" #include "symtab.h" #include "gdbtypes.h" #include "gdbcmd.h" @@ -38,7 +39,7 @@ #include "language.h" #include "arch-utils.h" #include "regcache.h" - +#include "remote.h" #include "floatformat.h" #include "gdb/sim-d10v.h" #include "sim-regno.h" @@ -68,7 +69,7 @@ enum { R0_REGNUM = 0, R3_REGNUM = 3, - _FP_REGNUM = 11, + D10V_FP_REGNUM = 11, LR_REGNUM = 13, _SP_REGNUM = 15, PSW_REGNUM = 16, @@ -276,8 +277,8 @@ d10v_imap_register (int reg_nr) static int d10v_ts2_register_sim_regno (int nr) { - if (legacy_register_sim_regno (nr) < 0) - return legacy_register_sim_regno (nr); + /* Only makes sense to supply raw registers. */ + gdb_assert (nr >= 0 && nr < NUM_REGS); if (nr >= TS2_IMAP0_REGNUM && nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS) return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM; @@ -292,8 +293,8 @@ d10v_ts2_register_sim_regno (int nr) static int d10v_ts3_register_sim_regno (int nr) { - if (legacy_register_sim_regno (nr) < 0) - return legacy_register_sim_regno (nr); + /* Only makes sense to supply raw registers. */ + gdb_assert (nr >= 0 && nr < NUM_REGS); if (nr >= TS3_IMAP0_REGNUM && nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS) return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM; @@ -345,7 +346,7 @@ d10v_register_type (struct gdbarch *gdbarch, int reg_nr) { if (reg_nr == PC_REGNUM) return builtin_type_void_func_ptr; - if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM) + if (reg_nr == _SP_REGNUM || reg_nr == D10V_FP_REGNUM) return builtin_type_void_data_ptr; else if (reg_nr >= A0_REGNUM && reg_nr < (A0_REGNUM + NR_A_REGS)) @@ -437,18 +438,6 @@ d10v_integer_to_address (struct type *type, void *buf) return val; } -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. - - We store structs through a pointer passed in the first Argument - register. */ - -static void -d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -{ - write_register (ARG1_REGNUM, (addr)); -} - /* Write into appropriate registers a function return value of type TYPE, given in virtual format. @@ -499,17 +488,6 @@ d10v_extract_struct_value_address (struct regcache *regcache) return (addr | DMEM_START); } -/* Immediately after a function call, return the saved pc. We can't - use frame->return_pc beause that is determined by reading R13 off - the stack and that may not be written yet. */ - -static CORE_ADDR -d10v_saved_pc_after_call (struct frame_info *frame) -{ - return ((read_register (LR_REGNUM) << 2) - | IMEM_START); -} - static int check_prologue (unsigned short op) { @@ -610,6 +588,11 @@ d10v_skip_prologue (CORE_ADDR pc) struct d10v_unwind_cache { CORE_ADDR return_pc; + /* The previous frame's inner most stack address. Used as this + frame ID's stack_addr. */ + CORE_ADDR prev_sp; + /* The frame's base, optionally used by the high-level debug info. */ + CORE_ADDR base; int size; CORE_ADDR *saved_regs; /* How far the SP and r11 (FP) have been offset from the start of @@ -703,32 +686,32 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op, for it IS the sp for the next frame. */ struct d10v_unwind_cache * -d10v_frame_unwind_cache (struct frame_info *fi, - void **cache) +d10v_frame_unwind_cache (struct frame_info *next_frame, + void **this_prologue_cache) { - CORE_ADDR fp, pc; + CORE_ADDR pc; + ULONGEST prev_sp; + ULONGEST this_base; unsigned long op; unsigned short op1, op2; int i; struct d10v_unwind_cache *info; - if ((*cache)) - return (*cache); + if ((*this_prologue_cache)) + return (*this_prologue_cache); info = FRAME_OBSTACK_ZALLOC (struct d10v_unwind_cache); - (*cache) = info; + (*this_prologue_cache) = info; info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); info->size = 0; info->return_pc = 0; - - fp = get_frame_base (fi); info->sp_offset = 0; - pc = get_pc_function_start (get_frame_pc (fi)); - info->uses_frame = 0; - while (1) + for (pc = frame_func_unwind (next_frame); + pc > 0 && pc < frame_pc_unwind (next_frame); + pc += 4) { op = (unsigned long) read_memory_integer (pc, 4); if ((op & 0xC0000000) == 0xC0000000) @@ -775,18 +758,47 @@ d10v_frame_unwind_cache (struct frame_info *fi, || !prologue_find_regs (info, op2, pc)) break; } - pc += 4; } info->size = -info->sp_offset; - if (!(fp & 0xffff)) - fp = d10v_read_sp (); + /* Compute the frame's base, and the previous frame's SP. */ + if (info->uses_frame) + { + /* The SP was moved to the FP. This indicates that a new frame + was created. Get THIS frame's FP value by unwinding it from + the next frame. */ + frame_unwind_unsigned_register (next_frame, D10V_FP_REGNUM, &this_base); + /* The FP points at the last saved register. Adjust the FP back + to before the first saved register giving the SP. */ + prev_sp = this_base + info->size; + } + else if (info->saved_regs[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], + register_size (current_gdbarch, + 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); + prev_sp = this_base + info->size; + } + + info->base = d10v_make_daddr (this_base); + info->prev_sp = d10v_make_daddr (prev_sp); + /* Adjust all the saved registers so that they contain addresses and + not offsets. */ for (i = 0; i < NUM_REGS - 1; i++) if (info->saved_regs[i]) { - info->saved_regs[i] = fp - (info->sp_offset - info->saved_regs[i]); + info->saved_regs[i] = (info->prev_sp + info->saved_regs[i]); } if (info->saved_regs[LR_REGNUM]) @@ -799,24 +811,13 @@ d10v_frame_unwind_cache (struct frame_info *fi, else { ULONGEST return_pc; - frame_read_unsigned_register (fi, LR_REGNUM, &return_pc); + frame_unwind_unsigned_register (next_frame, LR_REGNUM, &return_pc); info->return_pc = d10v_make_iaddr (return_pc); } - /* The SP is not normally (ever?) saved, but check anyway */ - if (!info->saved_regs[SP_REGNUM]) - { - /* if the FP was saved, that means the current FP is valid, */ - /* otherwise, it isn't being used, so we use the SP instead */ - if (info->uses_frame) - info->saved_regs[SP_REGNUM] - = d10v_read_fp () + info->size; - else - { - info->saved_regs[SP_REGNUM] = fp + info->size; - info->saved_regs[FP_REGNUM] = 0; - } - } + /* The SP_REGNUM is special. Instead of the address of the SP, the + previous frame's SP value is saved. */ + info->saved_regs[SP_REGNUM] = info->prev_sp; return info; } @@ -940,30 +941,12 @@ d10v_read_sp (void) return (d10v_make_daddr (read_register (SP_REGNUM))); } -static void -d10v_write_sp (CORE_ADDR val) -{ - write_register (SP_REGNUM, d10v_convert_daddr_to_raw (val)); -} - static CORE_ADDR d10v_read_fp (void) { - return (d10v_make_daddr (read_register (FP_REGNUM))); + return (d10v_make_daddr (read_register (D10V_FP_REGNUM))); } -/* Function: push_return_address (pc) - Set up the return address for the inferior function call. - Needed for targets where we don't actually execute a JSR/BSR instruction */ - -static CORE_ADDR -d10v_push_return_address (CORE_ADDR pc, CORE_ADDR sp) -{ - write_register (LR_REGNUM, d10v_convert_iaddr_to_raw (CALL_DUMMY_ADDRESS ())); - return sp; -} - - /* When arguments must be pushed onto the stack, they go on in reverse order. The below implements a FILO (stack) to do this. */ @@ -1001,21 +984,28 @@ pop_stack_item (struct stack_item *si) static CORE_ADDR -d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) +d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, + CORE_ADDR dummy_addr, int nargs, struct value **args, + CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { int i; int regnum = ARG1_REGNUM; struct stack_item *si = NULL; long val; - /* If struct_return is true, then the struct return address will - consume one argument-passing register. No need to actually - write the value to the register -- that's done by - d10v_store_struct_return(). */ + /* Set the return address. For the d10v, the return breakpoint is + always at DUMMY_ADDR. */ + regcache_cooked_write_unsigned (regcache, LR_REGNUM, + d10v_convert_iaddr_to_raw (dummy_addr)); + /* If STRUCT_RETURN is true, then the struct return address (in + STRUCT_ADDR) will consume the first argument-passing register. + Both adjust the register count and store that value. */ if (struct_return) - regnum++; + { + regcache_cooked_write_unsigned (regcache, regnum, struct_addr); + regnum++; + } /* Fill in registers and arg lists */ for (i = 0; i < nargs; i++) @@ -1031,7 +1021,7 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* fits in a single register, do not align */ { val = extract_unsigned_integer (contents, len); - write_register (regnum++, val); + regcache_cooked_write_unsigned (regcache, regnum++, val); } else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2) /* value fits in remaining registers, store keeping left @@ -1042,12 +1032,12 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, for (b = 0; b < (len & ~1); b += 2) { val = extract_unsigned_integer (&contents[b], 2); - write_register (regnum++, val); + regcache_cooked_write_unsigned (regcache, regnum++, val); } if (b < len) { val = extract_unsigned_integer (&contents[b], 1); - write_register (regnum++, (val << 8)); + regcache_cooked_write_unsigned (regcache, regnum++, (val << 8)); } } else @@ -1065,6 +1055,10 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, si = pop_stack_item (si); } + /* Finally, update the SP register. */ + regcache_cooked_write_unsigned (regcache, SP_REGNUM, + d10v_convert_daddr_to_raw (sp)); + return sp; } @@ -1337,26 +1331,29 @@ tdisassemble_command (char *arg, int from_tty) { int i, count; CORE_ADDR low, high; - char *space_index; if (!arg) { low = 0; high = trace_data.size; } - else if (!(space_index = (char *) strchr (arg, ' '))) - { - low = parse_and_eval_address (arg); - high = low + 5; - } else - { - /* Two arguments. */ - *space_index = '\0'; - low = parse_and_eval_address (arg); - high = parse_and_eval_address (space_index + 1); - if (high < low) - high = low; + { + char *space_index = strchr (arg, ' '); + if (space_index == NULL) + { + low = parse_and_eval_address (arg); + high = low + 5; + } + else + { + /* Two arguments. */ + *space_index = '\0'; + low = parse_and_eval_address (arg); + high = parse_and_eval_address (space_index + 1); + if (high < low) + high = low; + } } printf_filtered ("Dump of trace from %s to %s:\n", paddr_u (low), paddr_u (high)); @@ -1424,71 +1421,65 @@ display_trace (int low, int high) } } - static CORE_ADDR -d10v_frame_pc_unwind (struct frame_info *frame, - void **cache) +d10v_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache); - return info->return_pc; + ULONGEST pc; + frame_unwind_unsigned_register (next_frame, PC_REGNUM, &pc); + return d10v_make_iaddr (pc); } /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct. */ static void -d10v_frame_id_unwind (struct frame_info *frame, - void **cache, - struct frame_id *id) -{ - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache); - CORE_ADDR addr; - - /* Start with a NULL frame ID. */ - (*id) = null_frame_id; - - if (info->return_pc == IMEM_START - || info->return_pc <= IMEM_START - || inside_entry_file (info->return_pc)) - { - /* This is meant to halt the backtrace at "_start". - Make sure we don't halt it at a generic dummy frame. */ - return; - } +d10v_frame_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id) +{ + struct d10v_unwind_cache *info + = d10v_frame_unwind_cache (next_frame, this_prologue_cache); + CORE_ADDR base; + CORE_ADDR func; + struct frame_id id; + + /* The FUNC is easy. */ + func = frame_func_unwind (next_frame); + + /* This is meant to halt the backtrace at "_start". Make sure we + don't halt it at a generic dummy frame. */ + if (func <= IMEM_START || inside_entry_file (func)) + return; - if (!info->saved_regs[FP_REGNUM]) - { - if (!info->saved_regs[SP_REGNUM] - || info->saved_regs[SP_REGNUM] == STACK_START) - return; + /* Hopefully the prologue analysis either correctly determined the + frame's base (which is the SP from the previous frame), or set + that base to "NULL". */ + base = info->prev_sp; + if (base == STACK_START || base == 0) + return; - id->base = info->saved_regs[SP_REGNUM]; - id->pc = info->return_pc; - } + id = frame_id_build (base, func); - addr = read_memory_unsigned_integer (info->saved_regs[FP_REGNUM], - register_size (current_gdbarch, FP_REGNUM)); - if (addr == 0) + /* Check that we're not going round in circles with the same frame + ID (but avoid applying the test to sentinel frames which do go + round in circles). Can't use frame_id_eq() as that doesn't yet + compare the frame's PC value. */ + if (frame_relative_level (next_frame) >= 0 + && get_frame_type (next_frame) != DUMMY_FRAME + && frame_id_eq (get_frame_id (next_frame), id)) return; - id->base = d10v_make_daddr (addr); - id->pc = info->return_pc; + (*this_id) = id; } static void -saved_regs_unwinder (struct frame_info *frame, - CORE_ADDR *saved_regs, +saved_regs_unwinder (struct frame_info *next_frame, + CORE_ADDR *this_saved_regs, int regnum, int *optimizedp, enum lval_type *lvalp, CORE_ADDR *addrp, int *realnump, void *bufferp) { - /* If we're using generic dummy frames, we'd better not be in a call - dummy. (generic_call_dummy_register_unwind ought to have been called - instead.) */ - gdb_assert (!(DEPRECATED_USE_GENERIC_DUMMY_FRAMES - && (get_frame_type (frame) == DUMMY_FRAME))); - - if (saved_regs[regnum] != 0) + if (this_saved_regs[regnum] != 0) { if (regnum == SP_REGNUM) { @@ -1499,7 +1490,7 @@ saved_regs_unwinder (struct frame_info *frame, *realnump = -1; if (bufferp != NULL) store_address (bufferp, register_size (current_gdbarch, regnum), - saved_regs[regnum]); + this_saved_regs[regnum]); } else { @@ -1507,12 +1498,12 @@ saved_regs_unwinder (struct frame_info *frame, a local copy of its value. */ *optimizedp = 0; *lvalp = lval_memory; - *addrp = saved_regs[regnum]; + *addrp = this_saved_regs[regnum]; *realnump = -1; if (bufferp != NULL) { /* Read the value in from memory. */ - read_memory (saved_regs[regnum], bufferp, + read_memory (this_saved_regs[regnum], bufferp, register_size (current_gdbarch, regnum)); } } @@ -1523,66 +1514,39 @@ saved_regs_unwinder (struct frame_info *frame, value. If a value is needed, pass the request on down the chain; otherwise just return an indication that the value is in the same register as the next frame. */ - frame_register (frame, regnum, optimizedp, lvalp, addrp, - realnump, bufferp); -} - - -static void -d10v_frame_register_unwind (struct frame_info *frame, - void **cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *bufferp) -{ - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache); - saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp, - lvalp, addrp, realnump, bufferp); + frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp, + realnump, bufferp); } static void -d10v_frame_pop (struct frame_info *fi, void **unwind_cache, - struct regcache *regcache) -{ - struct d10v_unwind_cache *info = d10v_frame_unwind_cache (fi, unwind_cache); - CORE_ADDR fp; - int regnum; - char raw_buffer[8]; - - fp = get_frame_base (fi); - - /* now update the current registers with the old values */ - for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++) +d10v_frame_prev_register (struct frame_info *next_frame, + void **this_prologue_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp) +{ + struct d10v_unwind_cache *info + = d10v_frame_unwind_cache (next_frame, this_prologue_cache); + if (regnum == PC_REGNUM) { - frame_unwind_register (fi, regnum, raw_buffer); - regcache_cooked_write (regcache, regnum, raw_buffer); + /* The call instruction saves the caller's PC in LR. The + function prologue of the callee may then save the LR on the + stack. Find that possibly saved LR value and return it. */ + saved_regs_unwinder (next_frame, info->saved_regs, LR_REGNUM, optimizedp, + lvalp, addrp, realnump, bufferp); } - for (regnum = 0; regnum < SP_REGNUM; regnum++) + else { - frame_unwind_register (fi, regnum, raw_buffer); - regcache_cooked_write (regcache, regnum, raw_buffer); + saved_regs_unwinder (next_frame, info->saved_regs, regnum, optimizedp, + lvalp, addrp, realnump, bufferp); } - frame_unwind_register (fi, PSW_REGNUM, raw_buffer); - regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer); - - frame_unwind_register (fi, LR_REGNUM, raw_buffer); - regcache_cooked_write (regcache, PC_REGNUM, raw_buffer); - - store_unsigned_integer (raw_buffer, - register_size (current_gdbarch, SP_REGNUM), - fp + info->size); - regcache_cooked_write (regcache, SP_REGNUM, raw_buffer); - - target_store_registers (-1); - flush_cached_frames (); } -static struct frame_unwind d10v_frame_unwind = { - d10v_frame_pop, - d10v_frame_pc_unwind, - d10v_frame_id_unwind, - d10v_frame_register_unwind +static const struct frame_unwind d10v_frame_unwind = { + NORMAL_FRAME, + d10v_frame_this_id, + d10v_frame_prev_register }; const struct frame_unwind * @@ -1591,13 +1555,39 @@ d10v_frame_p (CORE_ADDR pc) return &d10v_frame_unwind; } +static CORE_ADDR +d10v_frame_base_address (struct frame_info *next_frame, void **this_cache) +{ + struct d10v_unwind_cache *info + = d10v_frame_unwind_cache (next_frame, this_cache); + return info->base; +} + +static const struct frame_base d10v_frame_base = { + &d10v_frame_unwind, + d10v_frame_base_address, + d10v_frame_base_address, + d10v_frame_base_address +}; + +/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that + dummy frame. The frame ID's base needs to match the TOS value + saved by save_dummy_frame_tos(), and the PC match the dummy frame's + breakpoint. */ + +static struct frame_id +d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) +{ + ULONGEST base; + frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base); + return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame)); +} + static gdbarch_init_ftype d10v_gdbarch_init; static struct gdbarch * d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { - static LONGEST d10v_call_dummy_words[] = - {0}; struct gdbarch *gdbarch; int d10v_num_regs; struct gdbarch_tdep *tdep; @@ -1641,11 +1631,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, d10v_write_pc); set_gdbarch_read_fp (gdbarch, d10v_read_fp); set_gdbarch_read_sp (gdbarch, d10v_read_sp); - set_gdbarch_write_sp (gdbarch, d10v_write_sp); set_gdbarch_num_regs (gdbarch, d10v_num_regs); set_gdbarch_sp_regnum (gdbarch, 15); - set_gdbarch_fp_regnum (gdbarch, 11); set_gdbarch_pc_regnum (gdbarch, 18); set_gdbarch_register_name (gdbarch, d10v_register_name); set_gdbarch_register_size (gdbarch, 2); @@ -1686,22 +1674,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) "d10v_gdbarch_init: bad byte order for float format"); } - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_words (gdbarch, d10v_call_dummy_words); - set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words)); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); - set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); - set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); - - set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return); + set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call); set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention); @@ -1717,23 +1691,25 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_saved_pc_after_call (gdbarch, d10v_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_stack_align (gdbarch, d10v_stack_align); set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_print_registers_info (gdbarch, d10v_print_registers_info); frame_unwind_append_predicate (gdbarch, d10v_frame_p); + frame_base_set_default (gdbarch, &d10v_frame_base); - return gdbarch; -} + /* Methods for saving / extracting a dummy frame's ID. */ + set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id); + set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); + /* Return the unwound PC value. */ + set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc); -extern void (*target_resume_hook) (void); -extern void (*target_wait_loop_hook) (void); + return gdbarch; +} void _initialize_d10v_tdep (void) @@ -1012,6 +1012,8 @@ enum gdb_osabi GDB_OSABI_ARM_APCS, GDB_OSABI_QNXNTO, + GDB_OSABI_CYGWIN, + GDB_OSABI_INVALID /* keep this last */ }; diff --git a/gdb/disasm.c b/gdb/disasm.c index 75d1783..511855b 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -93,14 +93,15 @@ dump_insns (struct ui_out *uiout, disassemble_info * di, /* parts of the symbolic representation of the address */ int unmapped; - char *filename = NULL; - char *name = NULL; int offset; int line; struct cleanup *ui_out_chain; for (pc = low; pc < high;) { + char *filename = NULL; + char *name = NULL; + QUIT; if (how_many >= 0) { @@ -338,11 +339,8 @@ gdb_disassembly (struct ui_out *uiout, di_initialized = 1; } - di.mach = TARGET_PRINT_INSN_INFO->mach; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - di.endian = BFD_ENDIAN_BIG; - else - di.endian = BFD_ENDIAN_LITTLE; + di.mach = gdbarch_bfd_arch_info (current_gdbarch)->mach; + di.endian = gdbarch_byte_order (current_gdbarch); /* If gdb_disassemble_from_exec == -1, then we use the following heuristic to determine whether or not to do disassembly from target memory or from the @@ -361,7 +359,8 @@ gdb_disassembly (struct ui_out *uiout, if (strcmp (target_shortname, "child") == 0 || strcmp (target_shortname, "procfs") == 0 || strcmp (target_shortname, "vxprocess") == 0 - || strstr (target_shortname, "-threads") != NULL) + || strcmp (target_shortname, "core") == 0 + || strstr (target_shortname, "-thread") != NULL) gdb_disassemble_from_exec = 0; /* It's a child process, read inferior mem */ else gdb_disassemble_from_exec = 1; /* It's remote, read the exec file */ diff --git a/gdb/disasm.h b/gdb/disasm.h index beaaf4a..6a6df7e 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -21,6 +21,8 @@ #ifndef DISASM_H #define DISASM_H +struct ui_out; + extern void gdb_disassembly (struct ui_out *uiout, char *file_string, int line_num, diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index dbdd1ba..473eb15 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,120 @@ +2003-04-09 Jim Blandy <jimb@redhat.com> + + * gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint + list psymtabs'. + +2003-04-08 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + references to EXTRA_FRAME_INFO. + +2003-04-08 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + PRINT_TYPELESS_INTEGER. + +2003-04-02 J. Brobecker <brobecker@gnat.com> + + * observer.texi (GDB Observers): Adjust the documentation for the + normal_stop notification to better describe reality. Fix a couple + of minor typos. + +2003-04-02 Bob Rossi <bob_rossi@cox.net> + + * gdb.texinfo (GDB/MI Program Control): Add + '-file-list-exec-source-file' + +2003-03-31 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + references to CALL_DUMMY_P. + +2003-03-30 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Remove + reference to TARGET_WRITE_SP. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Remove + references to write_sp. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * gdb.texinfo (GDB/MI Variable Objects): Replace @include with + chapter body. Use @smallexample instead of @example. + (Annotations): Ditto. + * Makefile.in (GDB_DOC_SOURCE_INCLUDES): Remove gdbmi.texinfo and + annotate.texi. + +2003-03-26 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Replace + PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and + dummy_addr parameters. + +2003-03-25 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + reference to CALL_DUMMY_STACK_ADJUST_P. Rename + CALL_DUMMY_STACK_ADJUST to DEPRECATED_CALL_DUMMY_STACK_ADJUST. + Add reference to PUSH_ARGUMENTS. + +2003-03-23 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Algorithms, Target Architecture Definition): + Deprecate FRAME_CHAIN and FRAME_CHAIN_VALID. + +2003-03-18 J. Brobecker <brobecker@gnat.com> + + * gdbint.texinfo (Algorithms): Add new section describing the + Observer paradigm. + (Top): Add menu entry to new observer appendix. + * observer.texi: New file. + * Makefile.in (GDBINT_DOC_SOURCE_INCLUDES): Add dependency on + new observer.texi file. + +2003-03-17 Andrew Cagney <cagney@redhat.com> + + * gdb.texinfo (DATE): Delete. Remove date from titles. Mention + that GNU Press update the manual version number. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Delete + references to get_saved_register. Rename GET_SAVED_REGISTER to + DEPRECATED_GET_SAVED_REGISTER. + +2003-03-13 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Replace + POP_FRAME with DEPRECATED_POP_FRAME. Update description. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Rename + FRAME_SAVED_PC to DEPRECATED_FRAME_SAVED_PC. + +2003-03-10 Corinna Vinschen <vinschen@redhat.com> + + * gdb.texinfo: Add File-I/O documentation. + +2003-03-10 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Cross reference + FRAME_SAVED_PC to unwind_pc. Document unwind_pc. + +2003-03-07 Andrew Cagney <cagney@redhat.com> + + * gdb.texinfo (Debugging Output): Mention the "set/show debug + frame" command. + +2003-03-05 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo (Target Architecture Definition): Document + unwind_dummy_id. Cross reference unwind_dummy_id and + SAVE_DUMMY_FRAME_TOS. + 2003-03-05 James Ingham <jingham@apple.com> Daniel Jacobowitz <drow@mvista.com> diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index 1d5ad3e..5221314 100644 --- a/gdb/doc/Makefile.in +++ b/gdb/doc/Makefile.in @@ -98,10 +98,8 @@ DVIPS = dvips # Main GDB manual GDB_DOC_SOURCE_INCLUDES = \ - $(srcdir)/annotate.texi \ $(srcdir)/fdl.texi \ $(srcdir)/gpl.texi \ - $(GDBMI_DIR)/gdbmi.texinfo \ $(READLINE_DIR)/rluser.texinfo \ $(READLINE_DIR)/inc-hist.texinfo GDB_DOC_BUILD_INCLUDES = \ @@ -114,7 +112,8 @@ GDB_DOC_FILES = \ # Internals Manual GDBINT_DOC_SOURCE_INCLUDES = \ - $(srcdir)/fdl.texi + $(srcdir)/fdl.texi \ + $(srcdir)/observer.texi GDBINT_DOC_BUILD_INCLUDES = \ gdb-cfg.texi \ GDBvn.texi diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 25c0a93..00a4ac7 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -28,11 +28,9 @@ @syncodeindex fn cp @c !!set GDB manual's edition---not the same as GDB version! +@c This is updated by GNU Press. @set EDITION Ninth -@c !!set GDB manual's revision date -@set DATE June 2002 - @c !!set GDB edit command default editor @set EDITOR /bin/ex @@ -49,9 +47,9 @@ This file documents the @sc{gnu} debugger @value{GDBN}. -This is the @value{EDITION} Edition, @value{DATE}, -of @cite{Debugging with @value{GDBN}: the @sc{gnu} Source-Level Debugger} -for @value{GDBN} Version @value{GDBVN}. +This is the @value{EDITION} Edition, of @cite{Debugging with +@value{GDBN}: the @sc{gnu} Source-Level Debugger} for @value{GDBN} +Version @value{GDBVN}. Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,@* 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -74,7 +72,6 @@ development.'' @subtitle The @sc{gnu} Source-Level Debugger @sp 1 @subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN} -@subtitle @value{DATE} @author Richard Stallman, Roland Pesch, Stan Shebs, et al. @page @tex @@ -115,7 +112,7 @@ development.'' This file describes @value{GDBN}, the @sc{gnu} symbolic debugger. -This is the @value{EDITION} Edition, @value{DATE}, for @value{GDBN} Version +This is the @value{EDITION} Edition, for @value{GDBN} Version @value{GDBVN}. Copyright (C) 1988-2003 Free Software Foundation, Inc. @@ -9036,8 +9033,66 @@ files that @value{GDBN} has skimmed, but not yet read completely. Finally, required for each object file from which @value{GDBN} has read some symbols. @xref{Files, ,Commands to specify files}, for a discussion of how @value{GDBN} reads symbols (in the description of @code{symbol-file}). + +@kindex maint list symtabs +@kindex maint list psymtabs +@cindex listing @value{GDBN}'s internal symbol tables +@cindex symbol tables, listing @value{GDBN}'s internal +@cindex full symbol tables, listing @value{GDBN}'s internal +@cindex partial symbol tables, listing @value{GDBN}'s internal +@item maint list symtabs @r{[} @var{regexp} @r{]} +@itemx maint list psymtabs @r{[} @var{regexp} @r{]} + +List the @code{struct symtab} or @code{struct partial_symtab} +structures whose names match @var{regexp}. If @var{regexp} is not +given, list them all. The output includes expressions which you can +copy into a @value{GDBN} debugging this one to examine a particular +structure in more detail. For example: + +@smallexample +(@value{GDBP}) maint list psymtabs dwarf2read +@{ objfile /home/gnu/build/gdb/gdb + ((struct objfile *) 0x82e69d0) + @{ psymtab /home/gnu/src/gdb/dwarf2read.c + ((struct partial_symtab *) 0x8474b10) + readin no + fullname (null) + text addresses 0x814d3c8 -- 0x8158074 + globals (* (struct partial_symbol **) 0x8507a08 @@ 9) + statics (* (struct partial_symbol **) 0x40e95b78 @@ 2882) + dependencies (none) + @} +@} +(@value{GDBP}) maint list symtabs +(@value{GDBP}) +@end smallexample +@noindent +We see that there is one partial symbol table whose filename contains +the string @samp{dwarf2read}, belonging to the @samp{gdb} executable; +and we see that @value{GDBN} has not read in any symtabs yet at all. +If we set a breakpoint on a function, that will cause @value{GDBN} to +read the symtab for the compilation unit containing that function: + +@smallexample +(@value{GDBP}) break dwarf2_psymtab_to_symtab +Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c, +line 1574. +(@value{GDBP}) maint list symtabs +@{ objfile /home/gnu/build/gdb/gdb + ((struct objfile *) 0x82e69d0) + @{ symtab /home/gnu/src/gdb/dwarf2read.c + ((struct symtab *) 0x86c1f38) + dirname (null) + fullname (null) + blockvector ((struct blockvector *) 0x86c1bd0) (primary) + debugformat DWARF 2 + @} +@} +(@value{GDBP}) +@end smallexample @end table + @node Altering @chapter Altering Execution @@ -12973,6 +13028,14 @@ default is off. @item show debug expression Displays the current state of displaying @value{GDBN} expression debugging info. +@kindex set debug frame +@item set debug frame +Turns on or off display of @value{GDBN} frame debugging info. The +default is off. +@kindex show debug frame +@item show debug frame +Displays the current state of displaying @value{GDBN} frame debugging +info. @kindex set debug overload @item set debug overload Turns on or off display of @value{GDBN} C@t{++} overload debugging @@ -14040,8 +14103,4570 @@ environment. Users of this environment can use a new command, each value is printed in its own window. @end ignore -@include annotate.texi -@include gdbmi.texinfo + +@node GDB/MI +@chapter The @sc{gdb/mi} Interface + +@unnumberedsec Function and Purpose + +@cindex @sc{gdb/mi}, its purpose +@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is +specifically intended to support the development of systems which use +the debugger as just one small component of a larger system. + +This chapter is a specification of the @sc{gdb/mi} interface. It is written +in the form of a reference manual. + +Note that @sc{gdb/mi} is still under construction, so some of the +features described below are incomplete and subject to change. + +@unnumberedsec Notation and Terminology + +@cindex notational conventions, for @sc{gdb/mi} +This chapter uses the following notation: + +@itemize @bullet +@item +@code{|} separates two alternatives. + +@item +@code{[ @var{something} ]} indicates that @var{something} is optional: +it may or may not be given. + +@item +@code{( @var{group} )*} means that @var{group} inside the parentheses +may repeat zero or more times. + +@item +@code{( @var{group} )+} means that @var{group} inside the parentheses +may repeat one or more times. + +@item +@code{"@var{string}"} means a literal @var{string}. +@end itemize + +@ignore +@heading Dependencies +@end ignore + +@heading Acknowledgments + +In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and +Elena Zannoni. + +@menu +* GDB/MI Command Syntax:: +* GDB/MI Compatibility with CLI:: +* GDB/MI Output Records:: +* GDB/MI Command Description Format:: +* GDB/MI Breakpoint Table Commands:: +* GDB/MI Data Manipulation:: +* GDB/MI Program Control:: +* GDB/MI Miscellaneous Commands:: +@ignore +* GDB/MI Kod Commands:: +* GDB/MI Memory Overlay Commands:: +* GDB/MI Signal Handling Commands:: +@end ignore +* GDB/MI Stack Manipulation:: +* GDB/MI Symbol Query:: +* GDB/MI Target Manipulation:: +* GDB/MI Thread Commands:: +* GDB/MI Tracepoint Commands:: +* GDB/MI Variable Objects:: +@end menu + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Command Syntax +@section @sc{gdb/mi} Command Syntax + +@menu +* GDB/MI Input Syntax:: +* GDB/MI Output Syntax:: +* GDB/MI Simple Examples:: +@end menu + +@node GDB/MI Input Syntax +@subsection @sc{gdb/mi} Input Syntax + +@cindex input syntax for @sc{gdb/mi} +@cindex @sc{gdb/mi}, input syntax +@table @code +@item @var{command} @expansion{} +@code{@var{cli-command} | @var{mi-command}} + +@item @var{cli-command} @expansion{} +@code{[ @var{token} ] @var{cli-command} @var{nl}}, where +@var{cli-command} is any existing @value{GDBN} CLI command. + +@item @var{mi-command} @expansion{} +@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )* +@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}} + +@item @var{token} @expansion{} +"any sequence of digits" + +@item @var{option} @expansion{} +@code{"-" @var{parameter} [ " " @var{parameter} ]} + +@item @var{parameter} @expansion{} +@code{@var{non-blank-sequence} | @var{c-string}} + +@item @var{operation} @expansion{} +@emph{any of the operations described in this chapter} + +@item @var{non-blank-sequence} @expansion{} +@emph{anything, provided it doesn't contain special characters such as +"-", @var{nl}, """ and of course " "} + +@item @var{c-string} @expansion{} +@code{""" @var{seven-bit-iso-c-string-content} """} + +@item @var{nl} @expansion{} +@code{CR | CR-LF} +@end table + +@noindent +Notes: + +@itemize @bullet +@item +The CLI commands are still handled by the @sc{mi} interpreter; their +output is described below. + +@item +The @code{@var{token}}, when present, is passed back when the command +finishes. + +@item +Some @sc{mi} commands accept optional arguments as part of the parameter +list. Each option is identified by a leading @samp{-} (dash) and may be +followed by an optional argument parameter. Options occur first in the +parameter list and can be delimited from normal parameters using +@samp{--} (this is useful when some parameters begin with a dash). +@end itemize + +Pragmatics: + +@itemize @bullet +@item +We want easy access to the existing CLI syntax (for debugging). + +@item +We want it to be easy to spot a @sc{mi} operation. +@end itemize + +@node GDB/MI Output Syntax +@subsection @sc{gdb/mi} Output Syntax + +@cindex output syntax of @sc{gdb/mi} +@cindex @sc{gdb/mi}, output syntax +The output from @sc{gdb/mi} consists of zero or more out-of-band records +followed, optionally, by a single result record. This result record +is for the most recent command. The sequence of output records is +terminated by @samp{(@value{GDBP})}. + +If an input command was prefixed with a @code{@var{token}} then the +corresponding output for that command will also be prefixed by that same +@var{token}. + +@table @code +@item @var{output} @expansion{} +@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}} + +@item @var{result-record} @expansion{} +@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}} + +@item @var{out-of-band-record} @expansion{} +@code{@var{async-record} | @var{stream-record}} + +@item @var{async-record} @expansion{} +@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}} + +@item @var{exec-async-output} @expansion{} +@code{[ @var{token} ] "*" @var{async-output}} + +@item @var{status-async-output} @expansion{} +@code{[ @var{token} ] "+" @var{async-output}} + +@item @var{notify-async-output} @expansion{} +@code{[ @var{token} ] "=" @var{async-output}} + +@item @var{async-output} @expansion{} +@code{@var{async-class} ( "," @var{result} )* @var{nl}} + +@item @var{result-class} @expansion{} +@code{"done" | "running" | "connected" | "error" | "exit"} + +@item @var{async-class} @expansion{} +@code{"stopped" | @var{others}} (where @var{others} will be added +depending on the needs---this is still in development). + +@item @var{result} @expansion{} +@code{ @var{variable} "=" @var{value}} + +@item @var{variable} @expansion{} +@code{ @var{string} } + +@item @var{value} @expansion{} +@code{ @var{const} | @var{tuple} | @var{list} } + +@item @var{const} @expansion{} +@code{@var{c-string}} + +@item @var{tuple} @expansion{} +@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" } + +@item @var{list} @expansion{} +@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "[" +@var{result} ( "," @var{result} )* "]" } + +@item @var{stream-record} @expansion{} +@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}} + +@item @var{console-stream-output} @expansion{} +@code{"~" @var{c-string}} + +@item @var{target-stream-output} @expansion{} +@code{"@@" @var{c-string}} + +@item @var{log-stream-output} @expansion{} +@code{"&" @var{c-string}} + +@item @var{nl} @expansion{} +@code{CR | CR-LF} + +@item @var{token} @expansion{} +@emph{any sequence of digits}. +@end table + +@noindent +Notes: + +@itemize @bullet +@item +All output sequences end in a single line containing a period. + +@item +The @code{@var{token}} is from the corresponding request. If an execution +command is interrupted by the @samp{-exec-interrupt} command, the +@var{token} associated with the @samp{*stopped} message is the one of the +original execution command, not the one of the interrupt command. + +@item +@cindex status output in @sc{gdb/mi} +@var{status-async-output} contains on-going status information about the +progress of a slow operation. It can be discarded. All status output is +prefixed by @samp{+}. + +@item +@cindex async output in @sc{gdb/mi} +@var{exec-async-output} contains asynchronous state change on the target +(stopped, started, disappeared). All async output is prefixed by +@samp{*}. + +@item +@cindex notify output in @sc{gdb/mi} +@var{notify-async-output} contains supplementary information that the +client should handle (e.g., a new breakpoint information). All notify +output is prefixed by @samp{=}. + +@item +@cindex console output in @sc{gdb/mi} +@var{console-stream-output} is output that should be displayed as is in the +console. It is the textual response to a CLI command. All the console +output is prefixed by @samp{~}. + +@item +@cindex target output in @sc{gdb/mi} +@var{target-stream-output} is the output produced by the target program. +All the target output is prefixed by @samp{@@}. + +@item +@cindex log output in @sc{gdb/mi} +@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for +instance messages that should be displayed as part of an error log. All +the log output is prefixed by @samp{&}. + +@item +@cindex list output in @sc{gdb/mi} +New @sc{gdb/mi} commands should only output @var{lists} containing +@var{values}. + + +@end itemize + +@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more +details about the various output records. + +@node GDB/MI Simple Examples +@subsection Simple Examples of @sc{gdb/mi} Interaction +@cindex @sc{gdb/mi}, simple examples + +This subsection presents several simple examples of interaction using +the @sc{gdb/mi} interface. In these examples, @samp{->} means that the +following line is passed to @sc{gdb/mi} as input, while @samp{<-} means +the output received from @sc{gdb/mi}. + +@subsubheading Target Stop +@c Ummm... There is no "-stop" command. This assumes async, no? +Here's an example of stopping the inferior process: + +@smallexample +-> -stop +<- (@value{GDBP}) +@end smallexample + +@noindent +and later: + +@smallexample +<- *stop,reason="stop",address="0x123",source="a.c:123" +<- (@value{GDBP}) +@end smallexample + +@subsubheading Simple CLI Command + +Here's an example of a simple CLI command being passed through +@sc{gdb/mi} and on to the CLI. + +@smallexample +-> print 1+2 +<- &"print 1+2\n" +<- ~"$1 = 3\n" +<- ^done +<- (@value{GDBP}) +@end smallexample + +@subsubheading Command With Side Effects + +@smallexample +-> -symbol-file xyz.exe +<- *breakpoint,nr="3",address="0x123",source="a.c:123" +<- (@value{GDBP}) +@end smallexample + +@subsubheading A Bad Command + +Here's what happens if you pass a non-existent command: + +@smallexample +-> -rubbish +<- ^error,msg="Undefined MI command: rubbish" +<- (@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Compatibility with CLI +@section @sc{gdb/mi} Compatibility with CLI + +@cindex compatibility, @sc{gdb/mi} and CLI +@cindex @sc{gdb/mi}, compatibility with CLI +To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi} +accepts existing CLI commands. As specified by the syntax, such +commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will +respond. + +This mechanism is provided as an aid to developers of @sc{gdb/mi} +clients and not as a reliable interface into the CLI. Since the command +is being interpreteted in an environment that assumes @sc{gdb/mi} +behaviour, the exact output of such commands is likely to end up being +an un-supported hybrid of @sc{gdb/mi} and CLI output. + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Output Records +@section @sc{gdb/mi} Output Records + +@menu +* GDB/MI Result Records:: +* GDB/MI Stream Records:: +* GDB/MI Out-of-band Records:: +@end menu + +@node GDB/MI Result Records +@subsection @sc{gdb/mi} Result Records + +@cindex result records in @sc{gdb/mi} +@cindex @sc{gdb/mi}, result records +In addition to a number of out-of-band notifications, the response to a +@sc{gdb/mi} command includes one of the following result indications: + +@table @code +@findex ^done +@item "^done" [ "," @var{results} ] +The synchronous operation was successful, @code{@var{results}} are the return +values. + +@item "^running" +@findex ^running +@c Is this one correct? Should it be an out-of-band notification? +The asynchronous operation was successfully started. The target is +running. + +@item "^error" "," @var{c-string} +@findex ^error +The operation failed. The @code{@var{c-string}} contains the corresponding +error message. +@end table + +@node GDB/MI Stream Records +@subsection @sc{gdb/mi} Stream Records + +@cindex @sc{gdb/mi}, stream records +@cindex stream records in @sc{gdb/mi} +@value{GDBN} internally maintains a number of output streams: the console, the +target, and the log. The output intended for each of these streams is +funneled through the @sc{gdb/mi} interface using @dfn{stream records}. + +Each stream record begins with a unique @dfn{prefix character} which +identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output +Syntax}). In addition to the prefix, each stream record contains a +@code{@var{string-output}}. This is either raw text (with an implicit new +line) or a quoted C string (which does not contain an implicit newline). + +@table @code +@item "~" @var{string-output} +The console output stream contains text that should be displayed in the +CLI console window. It contains the textual responses to CLI commands. + +@item "@@" @var{string-output} +The target output stream contains any textual output from the running +target. + +@item "&" @var{string-output} +The log stream contains debugging messages being produced by @value{GDBN}'s +internals. +@end table + +@node GDB/MI Out-of-band Records +@subsection @sc{gdb/mi} Out-of-band Records + +@cindex out-of-band records in @sc{gdb/mi} +@cindex @sc{gdb/mi}, out-of-band records +@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of +additional changes that have occurred. Those changes can either be a +consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of +target activity (e.g., target stopped). + +The following is a preliminary list of possible out-of-band records. + +@table @code +@item "*" "stop" +@end table + + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Command Description Format +@section @sc{gdb/mi} Command Description Format + +The remaining sections describe blocks of commands. Each block of +commands is laid out in a fashion similar to this section. + +Note the the line breaks shown in the examples are here only for +readability. They don't appear in the real output. +Also note that the commands with a non-available example (N.A.@:) are +not yet implemented. + +@subheading Motivation + +The motivation for this collection of commands. + +@subheading Introduction + +A brief introduction to this collection of commands as a whole. + +@subheading Commands + +For each command in the block, the following is described: + +@subsubheading Synopsis + +@smallexample + -command @var{args}@dots{} +@end smallexample + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} CLI command. + +@subsubheading Result + +@subsubheading Out-of-band + +@subsubheading Notes + +@subsubheading Example + + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Breakpoint Table Commands +@section @sc{gdb/mi} Breakpoint table commands + +@cindex breakpoint commands for @sc{gdb/mi} +@cindex @sc{gdb/mi}, breakpoint commands +This section documents @sc{gdb/mi} commands for manipulating +breakpoints. + +@subheading The @code{-break-after} Command +@findex -break-after + +@subsubheading Synopsis + +@smallexample + -break-after @var{number} @var{count} +@end smallexample + +The breakpoint number @var{number} is not in effect until it has been +hit @var{count} times. To see how this is reflected in the output of +the @samp{-break-list} command, see the description of the +@samp{-break-list} command below. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{ignore}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-insert main +^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@} +(@value{GDBP}) +-break-after 1 3 +~ +^done +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="1",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x000100d0",func="main",file="hello.c",line="5",times="0", +ignore="3"@}]@} +(@value{GDBP}) +@end smallexample + +@ignore +@subheading The @code{-break-catch} Command +@findex -break-catch + +@subheading The @code{-break-commands} Command +@findex -break-commands +@end ignore + + +@subheading The @code{-break-condition} Command +@findex -break-condition + +@subsubheading Synopsis + +@smallexample + -break-condition @var{number} @var{expr} +@end smallexample + +Breakpoint @var{number} will stop the program only if the condition in +@var{expr} is true. The condition becomes part of the +@samp{-break-list} output (see the description of the @samp{-break-list} +command below). + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{condition}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-condition 1 1 +^done +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="1",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x000100d0",func="main",file="hello.c",line="5",cond="1", +times="0",ignore="3"@}]@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-delete} Command +@findex -break-delete + +@subsubheading Synopsis + +@smallexample + -break-delete ( @var{breakpoint} )+ +@end smallexample + +Delete the breakpoint(s) whose number(s) are specified in the argument +list. This is obviously reflected in the breakpoint list. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{delete}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-delete 1 +^done +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="0",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[]@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-disable} Command +@findex -break-disable + +@subsubheading Synopsis + +@smallexample + -break-disable ( @var{breakpoint} )+ +@end smallexample + +Disable the named @var{breakpoint}(s). The field @samp{enabled} in the +break list is now set to @samp{n} for the named @var{breakpoint}(s). + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{disable}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-disable 2 +^done +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="1",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n", +addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-enable} Command +@findex -break-enable + +@subsubheading Synopsis + +@smallexample + -break-enable ( @var{breakpoint} )+ +@end smallexample + +Enable (previously disabled) @var{breakpoint}(s). + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{enable}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-enable 2 +^done +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="1",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y", +addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-info} Command +@findex -break-info + +@subsubheading Synopsis + +@smallexample + -break-info @var{breakpoint} +@end smallexample + +@c REDUNDANT??? +Get information about a single breakpoint. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}. + +@subsubheading Example +N.A. + +@subheading The @code{-break-insert} Command +@findex -break-insert + +@subsubheading Synopsis + +@smallexample + -break-insert [ -t ] [ -h ] [ -r ] + [ -c @var{condition} ] [ -i @var{ignore-count} ] + [ -p @var{thread} ] [ @var{line} | @var{addr} ] +@end smallexample + +@noindent +If specified, @var{line}, can be one of: + +@itemize @bullet +@item function +@c @item +offset +@c @item -offset +@c @item linenum +@item filename:linenum +@item filename:function +@item *address +@end itemize + +The possible optional parameters of this command are: + +@table @samp +@item -t +Insert a tempoary breakpoint. +@item -h +Insert a hardware breakpoint. +@item -c @var{condition} +Make the breakpoint conditional on @var{condition}. +@item -i @var{ignore-count} +Initialize the @var{ignore-count}. +@item -r +Insert a regular breakpoint in all the functions whose names match the +given regular expression. Other flags are not applicable to regular +expresson. +@end table + +@subsubheading Result + +The result is in the form: + +@smallexample + ^done,bkptno="@var{number}",func="@var{funcname}", + file="@var{filename}",line="@var{lineno}" +@end smallexample + +@noindent +where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname} +is the name of the function where the breakpoint was inserted, +@var{filename} is the name of the source file which contains this +function, and @var{lineno} is the source line number within that file. + +Note: this format is open to change. +@c An out-of-band breakpoint instead of part of the result? + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak}, +@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-insert main +^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@} +(@value{GDBP}) +-break-insert -t foo +^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@} +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="2",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@}, +bkpt=@{number="2",type="breakpoint",disp="del",enabled="y", +addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@} +(@value{GDBP}) +-break-insert -r foo.* +~int foo(int, int); +^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-list} Command +@findex -break-list + +@subsubheading Synopsis + +@smallexample + -break-list +@end smallexample + +Displays the list of inserted breakpoints, showing the following fields: + +@table @samp +@item Number +number of the breakpoint +@item Type +type of the breakpoint: @samp{breakpoint} or @samp{watchpoint} +@item Disposition +should the breakpoint be deleted or disabled when it is hit: @samp{keep} +or @samp{nokeep} +@item Enabled +is the breakpoint enabled or no: @samp{y} or @samp{n} +@item Address +memory location at which the breakpoint is set +@item What +logical location of the breakpoint, expressed by function name, file +name, line number +@item Times +number of times the breakpoint has been hit +@end table + +If there are no breakpoints or watchpoints, the @code{BreakpointTable} +@code{body} field is an empty list. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info break}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="2",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}, +bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y", +addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@} +(@value{GDBP}) +@end smallexample + +Here's an example of the result when there are no breakpoints: + +@smallexample +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="0",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[]@} +(@value{GDBP}) +@end smallexample + +@subheading The @code{-break-watch} Command +@findex -break-watch + +@subsubheading Synopsis + +@smallexample + -break-watch [ -a | -r ] +@end smallexample + +Create a watchpoint. With the @samp{-a} option it will create an +@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a +read from or on a write to the memory location. With the @samp{-r} +option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will +trigger only when the memory location is accessed for reading. Without +either of the options, the watchpoint created is a regular watchpoint, +i.e. it will trigger when the memory location is accessed for writing. +@xref{Set Watchpoints, , Setting watchpoints}. + +Note that @samp{-break-list} will report a single list of watchpoints and +breakpoints inserted. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and +@samp{rwatch}. + +@subsubheading Example + +Setting a watchpoint on a variable in the @code{main} function: + +@smallexample +(@value{GDBP}) +-break-watch x +^done,wpt=@{number="2",exp="x"@} +(@value{GDBP}) +-exec-continue +^running +^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@}, +value=@{old="-268439212",new="55"@}, +frame=@{func="main",args=[],file="recursive2.c",line="5"@} +(@value{GDBP}) +@end smallexample + +Setting a watchpoint on a variable local to a function. @value{GDBN} will stop +the program execution twice: first for the variable changing value, then +for the watchpoint going out of scope. + +@smallexample +(@value{GDBP}) +-break-watch C +^done,wpt=@{number="5",exp="C"@} +(@value{GDBP}) +-exec-continue +^running +^done,reason="watchpoint-trigger", +wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@}, +frame=@{func="callee4",args=[], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@} +(@value{GDBP}) +-exec-continue +^running +^done,reason="watchpoint-scope",wpnum="5", +frame=@{func="callee3",args=[@{name="strarg", +value="0x11940 \"A string argument.\""@}], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} +(@value{GDBP}) +@end smallexample + +Listing breakpoints and watchpoints, at different points in the program +execution. Note that once the watchpoint goes out of scope, it is +deleted. + +@smallexample +(@value{GDBP}) +-break-watch C +^done,wpt=@{number="2",exp="C"@} +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="2",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x00010734",func="callee4", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}, +bkpt=@{number="2",type="watchpoint",disp="keep", +enabled="y",addr="",what="C",times="0"@}]@} +(@value{GDBP}) +-exec-continue +^running +^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@}, +value=@{old="-276895068",new="3"@}, +frame=@{func="callee4",args=[], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@} +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="2",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x00010734",func="callee4", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}, +bkpt=@{number="2",type="watchpoint",disp="keep", +enabled="y",addr="",what="C",times="-5"@}]@} +(@value{GDBP}) +-exec-continue +^running +^done,reason="watchpoint-scope",wpnum="2", +frame=@{func="callee3",args=[@{name="strarg", +value="0x11940 \"A string argument.\""@}], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} +(@value{GDBP}) +-break-list +^done,BreakpointTable=@{nr_rows="1",nr_cols="6", +hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, +@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, +@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, +@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, +@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, +@{width="40",alignment="2",col_name="what",colhdr="What"@}], +body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", +addr="0x00010734",func="callee4", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@} +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Data Manipulation +@section @sc{gdb/mi} Data Manipulation + +@cindex data manipulation, in @sc{gdb/mi} +@cindex @sc{gdb/mi}, data manipulation +This section describes the @sc{gdb/mi} commands that manipulate data: +examine memory and registers, evaluate expressions, etc. + +@c REMOVED FROM THE INTERFACE. +@c @subheading -data-assign +@c Change the value of a program variable. Plenty of side effects. +@c @subsubheading GDB command +@c set variable +@c @subsubheading Example +@c N.A. + +@subheading The @code{-data-disassemble} Command +@findex -data-disassemble + +@subsubheading Synopsis + +@smallexample + -data-disassemble + [ -s @var{start-addr} -e @var{end-addr} ] + | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ] + -- @var{mode} +@end smallexample + +@noindent +Where: + +@table @samp +@item @var{start-addr} +is the beginning address (or @code{$pc}) +@item @var{end-addr} +is the end address +@item @var{filename} +is the name of the file to disassemble +@item @var{linenum} +is the line number to disassemble around +@item @var{lines} +is the the number of disassembly lines to be produced. If it is -1, +the whole function will be disassembled, in case no @var{end-addr} is +specified. If @var{end-addr} is specified as a non-zero value, and +@var{lines} is lower than the number of disassembly lines between +@var{start-addr} and @var{end-addr}, only @var{lines} lines are +displayed; if @var{lines} is higher than the number of lines between +@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr} +are displayed. +@item @var{mode} +is either 0 (meaning only disassembly) or 1 (meaning mixed source and +disassembly). +@end table + +@subsubheading Result + +The output for each instruction is composed of four fields: + +@itemize @bullet +@item Address +@item Func-name +@item Offset +@item Instruction +@end itemize + +Note that whatever included in the instruction field, is not manipulated +directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format. + +@subsubheading @value{GDBN} Command + +There's no direct mapping from this command to the CLI. + +@subsubheading Example + +Disassemble from the current value of @code{$pc} to @code{$pc + 20}: + +@smallexample +(@value{GDBP}) +-data-disassemble -s $pc -e "$pc + 20" -- 0 +^done, +asm_insns=[ +@{address="0x000107c0",func-name="main",offset="4", +inst="mov 2, %o0"@}, +@{address="0x000107c4",func-name="main",offset="8", +inst="sethi %hi(0x11800), %o2"@}, +@{address="0x000107c8",func-name="main",offset="12", +inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@}, +@{address="0x000107cc",func-name="main",offset="16", +inst="sethi %hi(0x11800), %o2"@}, +@{address="0x000107d0",func-name="main",offset="20", +inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}] +(@value{GDBP}) +@end smallexample + +Disassemble the whole @code{main} function. Line 32 is part of +@code{main}. + +@smallexample +-data-disassemble -f basics.c -l 32 -- 0 +^done,asm_insns=[ +@{address="0x000107bc",func-name="main",offset="0", +inst="save %sp, -112, %sp"@}, +@{address="0x000107c0",func-name="main",offset="4", +inst="mov 2, %o0"@}, +@{address="0x000107c4",func-name="main",offset="8", +inst="sethi %hi(0x11800), %o2"@}, +[@dots{}] +@{address="0x0001081c",func-name="main",offset="96",inst="ret "@}, +@{address="0x00010820",func-name="main",offset="100",inst="restore "@}] +(@value{GDBP}) +@end smallexample + +Disassemble 3 instructions from the start of @code{main}: + +@smallexample +(@value{GDBP}) +-data-disassemble -f basics.c -l 32 -n 3 -- 0 +^done,asm_insns=[ +@{address="0x000107bc",func-name="main",offset="0", +inst="save %sp, -112, %sp"@}, +@{address="0x000107c0",func-name="main",offset="4", +inst="mov 2, %o0"@}, +@{address="0x000107c4",func-name="main",offset="8", +inst="sethi %hi(0x11800), %o2"@}] +(@value{GDBP}) +@end smallexample + +Disassemble 3 instructions from the start of @code{main} in mixed mode: + +@smallexample +(@value{GDBP}) +-data-disassemble -f basics.c -l 32 -n 3 -- 1 +^done,asm_insns=[ +src_and_asm_line=@{line="31", +file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ + testsuite/gdb.mi/basics.c",line_asm_insn=[ +@{address="0x000107bc",func-name="main",offset="0", +inst="save %sp, -112, %sp"@}]@}, +src_and_asm_line=@{line="32", +file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ + testsuite/gdb.mi/basics.c",line_asm_insn=[ +@{address="0x000107c0",func-name="main",offset="4", +inst="mov 2, %o0"@}, +@{address="0x000107c4",func-name="main",offset="8", +inst="sethi %hi(0x11800), %o2"@}]@}] +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-data-evaluate-expression} Command +@findex -data-evaluate-expression + +@subsubheading Synopsis + +@smallexample + -data-evaluate-expression @var{expr} +@end smallexample + +Evaluate @var{expr} as an expression. The expression could contain an +inferior function call. The function call will execute synchronously. +If the expression contains spaces, it must be enclosed in double quotes. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and +@samp{call}. In @code{gdbtk} only, there's a corresponding +@samp{gdb_eval} command. + +@subsubheading Example + +In the following example, the numbers that precede the commands are the +@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi} +Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its +output. + +@smallexample +211-data-evaluate-expression A +211^done,value="1" +(@value{GDBP}) +311-data-evaluate-expression &A +311^done,value="0xefffeb7c" +(@value{GDBP}) +411-data-evaluate-expression A+3 +411^done,value="4" +(@value{GDBP}) +511-data-evaluate-expression "A + 3" +511^done,value="4" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-data-list-changed-registers} Command +@findex -data-list-changed-registers + +@subsubheading Synopsis + +@smallexample + -data-list-changed-registers +@end smallexample + +Display a list of the registers that have changed. + +@subsubheading @value{GDBN} Command + +@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk} +has the corresponding command @samp{gdb_changed_register_list}. + +@subsubheading Example + +On a PPC MBX board: + +@smallexample +(@value{GDBP}) +-exec-continue +^running + +(@value{GDBP}) +*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main", +args=[],file="try.c",line="5"@} +(@value{GDBP}) +-data-list-changed-registers +^done,changed-registers=["0","1","2","4","5","6","7","8","9", +"10","11","13","14","15","16","17","18","19","20","21","22","23", +"24","25","26","27","28","30","31","64","65","66","67","69"] +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-data-list-register-names} Command +@findex -data-list-register-names + +@subsubheading Synopsis + +@smallexample + -data-list-register-names [ ( @var{regno} )+ ] +@end smallexample + +Show a list of register names for the current target. If no arguments +are given, it shows a list of the names of all the registers. If +integer numbers are given as arguments, it will print a list of the +names of the registers corresponding to the arguments. To ensure +consistency between a register name and its number, the output list may +include empty register names. + +@subsubheading @value{GDBN} Command + +@value{GDBN} does not have a command which corresponds to +@samp{-data-list-register-names}. In @code{gdbtk} there is a +corresponding command @samp{gdb_regnames}. + +@subsubheading Example + +For the PPC MBX board: +@smallexample +(@value{GDBP}) +-data-list-register-names +^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7", +"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18", +"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", +"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", +"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20", +"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31", +"", "pc","ps","cr","lr","ctr","xer"] +(@value{GDBP}) +-data-list-register-names 1 2 3 +^done,register-names=["r1","r2","r3"] +(@value{GDBP}) +@end smallexample + +@subheading The @code{-data-list-register-values} Command +@findex -data-list-register-values + +@subsubheading Synopsis + +@smallexample + -data-list-register-values @var{fmt} [ ( @var{regno} )*] +@end smallexample + +Display the registers' contents. @var{fmt} is the format according to +which the registers' contents are to be returned, followed by an optional +list of numbers specifying the registers to display. A missing list of +numbers indicates that the contents of all the registers must be returned. + +Allowed formats for @var{fmt} are: + +@table @code +@item x +Hexadecimal +@item o +Octal +@item t +Binary +@item d +Decimal +@item r +Raw +@item N +Natural +@end table + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info +all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}. + +@subsubheading Example + +For a PPC MBX board (note: line breaks are for readability only, they +don't appear in the actual output): + +@smallexample +(@value{GDBP}) +-data-list-register-values r 64 65 +^done,register-values=[@{number="64",value="0xfe00a300"@}, +@{number="65",value="0x00029002"@}] +(@value{GDBP}) +-data-list-register-values x +^done,register-values=[@{number="0",value="0xfe0043c8"@}, +@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@}, +@{number="3",value="0x0"@},@{number="4",value="0xa"@}, +@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@}, +@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@}, +@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@}, +@{number="11",value="0x1"@},@{number="12",value="0x0"@}, +@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@}, +@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@}, +@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@}, +@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@}, +@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@}, +@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@}, +@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@}, +@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@}, +@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@}, +@{number="31",value="0x0"@},@{number="32",value="0x0"@}, +@{number="33",value="0x0"@},@{number="34",value="0x0"@}, +@{number="35",value="0x0"@},@{number="36",value="0x0"@}, +@{number="37",value="0x0"@},@{number="38",value="0x0"@}, +@{number="39",value="0x0"@},@{number="40",value="0x0"@}, +@{number="41",value="0x0"@},@{number="42",value="0x0"@}, +@{number="43",value="0x0"@},@{number="44",value="0x0"@}, +@{number="45",value="0x0"@},@{number="46",value="0x0"@}, +@{number="47",value="0x0"@},@{number="48",value="0x0"@}, +@{number="49",value="0x0"@},@{number="50",value="0x0"@}, +@{number="51",value="0x0"@},@{number="52",value="0x0"@}, +@{number="53",value="0x0"@},@{number="54",value="0x0"@}, +@{number="55",value="0x0"@},@{number="56",value="0x0"@}, +@{number="57",value="0x0"@},@{number="58",value="0x0"@}, +@{number="59",value="0x0"@},@{number="60",value="0x0"@}, +@{number="61",value="0x0"@},@{number="62",value="0x0"@}, +@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@}, +@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@}, +@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@}, +@{number="69",value="0x20002b03"@}] +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-data-read-memory} Command +@findex -data-read-memory + +@subsubheading Synopsis + +@smallexample + -data-read-memory [ -o @var{byte-offset} ] + @var{address} @var{word-format} @var{word-size} + @var{nr-rows} @var{nr-cols} [ @var{aschar} ] +@end smallexample + +@noindent +where: + +@table @samp +@item @var{address} +An expression specifying the address of the first memory word to be +read. Complex expressions containing embedded white space should be +quoted using the C convention. + +@item @var{word-format} +The format to be used to print the memory words. The notation is the +same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats, +,Output formats}). + +@item @var{word-size} +The size of each memory word in bytes. + +@item @var{nr-rows} +The number of rows in the output table. + +@item @var{nr-cols} +The number of columns in the output table. + +@item @var{aschar} +If present, indicates that each row should include an @sc{ascii} dump. The +value of @var{aschar} is used as a padding character when a byte is not a +member of the printable @sc{ascii} character set (printable @sc{ascii} +characters are those whose code is between 32 and 126, inclusively). + +@item @var{byte-offset} +An offset to add to the @var{address} before fetching memory. +@end table + +This command displays memory contents as a table of @var{nr-rows} by +@var{nr-cols} words, each word being @var{word-size} bytes. In total, +@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read +(returned as @samp{total-bytes}). Should less than the requested number +of bytes be returned by the target, the missing words are identified +using @samp{N/A}. The number of bytes read from the target is returned +in @samp{nr-bytes} and the starting address used to read memory in +@samp{addr}. + +The address of the next/previous row or page is available in +@samp{next-row} and @samp{prev-row}, @samp{next-page} and +@samp{prev-page}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has +@samp{gdb_get_mem} memory read command. + +@subsubheading Example + +Read six bytes of memory starting at @code{bytes+6} but then offset by +@code{-6} bytes. Format as three rows of two columns. One byte per +word. Display each word in hex. + +@smallexample +(@value{GDBP}) +9-data-read-memory -o -6 -- bytes+6 x 1 3 2 +9^done,addr="0x00001390",nr-bytes="6",total-bytes="6", +next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396", +prev-page="0x0000138a",memory=[ +@{addr="0x00001390",data=["0x00","0x01"]@}, +@{addr="0x00001392",data=["0x02","0x03"]@}, +@{addr="0x00001394",data=["0x04","0x05"]@}] +(@value{GDBP}) +@end smallexample + +Read two bytes of memory starting at address @code{shorts + 64} and +display as a single word formatted in decimal. + +@smallexample +(@value{GDBP}) +5-data-read-memory shorts+64 d 2 1 1 +5^done,addr="0x00001510",nr-bytes="2",total-bytes="2", +next-row="0x00001512",prev-row="0x0000150e", +next-page="0x00001512",prev-page="0x0000150e",memory=[ +@{addr="0x00001510",data=["128"]@}] +(@value{GDBP}) +@end smallexample + +Read thirty two bytes of memory starting at @code{bytes+16} and format +as eight rows of four columns. Include a string encoding with @samp{x} +used as the non-printable character. + +@smallexample +(@value{GDBP}) +4-data-read-memory bytes+16 x 1 8 4 x +4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32", +next-row="0x000013c0",prev-row="0x0000139c", +next-page="0x000013c0",prev-page="0x00001380",memory=[ +@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@}, +@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@}, +@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@}, +@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@}, +@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@}, +@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@}, +@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@}, +@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}] +(@value{GDBP}) +@end smallexample + +@subheading The @code{-display-delete} Command +@findex -display-delete + +@subsubheading Synopsis + +@smallexample + -display-delete @var{number} +@end smallexample + +Delete the display @var{number}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{delete display}. + +@subsubheading Example +N.A. + + +@subheading The @code{-display-disable} Command +@findex -display-disable + +@subsubheading Synopsis + +@smallexample + -display-disable @var{number} +@end smallexample + +Disable display @var{number}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{disable display}. + +@subsubheading Example +N.A. + + +@subheading The @code{-display-enable} Command +@findex -display-enable + +@subsubheading Synopsis + +@smallexample + -display-enable @var{number} +@end smallexample + +Enable display @var{number}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{enable display}. + +@subsubheading Example +N.A. + + +@subheading The @code{-display-insert} Command +@findex -display-insert + +@subsubheading Synopsis + +@smallexample + -display-insert @var{expression} +@end smallexample + +Display @var{expression} every time the program stops. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{display}. + +@subsubheading Example +N.A. + + +@subheading The @code{-display-list} Command +@findex -display-list + +@subsubheading Synopsis + +@smallexample + -display-list +@end smallexample + +List the displays. Do not show the current values. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info display}. + +@subsubheading Example +N.A. + + +@subheading The @code{-environment-cd} Command +@findex -environment-cd + +@subsubheading Synopsis + +@smallexample + -environment-cd @var{pathdir} +@end smallexample + +Set @value{GDBN}'s working directory. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{cd}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb +^done +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-environment-directory} Command +@findex -environment-directory + +@subsubheading Synopsis + +@smallexample + -environment-directory [ -r ] [ @var{pathdir} ]+ +@end smallexample + +Add directories @var{pathdir} to beginning of search path for source files. +If the @samp{-r} option is used, the search path is reset to the default +search path. If directories @var{pathdir} are supplied in addition to the +@samp{-r} option, the search path is first reset and then addition +occurs as normal. +Multiple directories may be specified, separated by blanks. Specifying +multiple directories in a single command +results in the directories added to the beginning of the +search path in the same order they were presented in the command. +If blanks are needed as +part of a directory name, double-quotes should be used around +the name. In the command output, the path will show up separated +by the system directory-separator character. The directory-seperator +character must not be used +in any directory name. +If no directories are specified, the current search path is displayed. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{dir}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb +^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" +(@value{GDBP}) +-environment-directory "" +^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" +(@value{GDBP}) +-environment-directory -r /home/jjohnstn/src/gdb /usr/src +^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd" +(@value{GDBP}) +-environment-directory -r +^done,source-path="$cdir:$cwd" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-environment-path} Command +@findex -environment-path + +@subsubheading Synopsis + +@smallexample + -environment-path [ -r ] [ @var{pathdir} ]+ +@end smallexample + +Add directories @var{pathdir} to beginning of search path for object files. +If the @samp{-r} option is used, the search path is reset to the original +search path that existed at gdb start-up. If directories @var{pathdir} are +supplied in addition to the +@samp{-r} option, the search path is first reset and then addition +occurs as normal. +Multiple directories may be specified, separated by blanks. Specifying +multiple directories in a single command +results in the directories added to the beginning of the +search path in the same order they were presented in the command. +If blanks are needed as +part of a directory name, double-quotes should be used around +the name. In the command output, the path will show up separated +by the system directory-separator character. The directory-seperator +character must not be used +in any directory name. +If no directories are specified, the current path is displayed. + + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{path}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-environment-path +^done,path="/usr/bin" +(@value{GDBP}) +-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin +^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin" +(@value{GDBP}) +-environment-path -r /usr/local/bin +^done,path="/usr/local/bin:/usr/bin" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-environment-pwd} Command +@findex -environment-pwd + +@subsubheading Synopsis + +@smallexample + -environment-pwd +@end smallexample + +Show the current working directory. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{pwd}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-environment-pwd +^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb" +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Program Control +@section @sc{gdb/mi} Program control + +@subsubheading Program termination + +As a result of execution, the inferior program can run to completion, if +it doesn't encounter any breakpoints. In this case the output will +include an exit code, if the program has exited exceptionally. + +@subsubheading Examples + +@noindent +Program exited normally: + +@smallexample +(@value{GDBP}) +-exec-run +^running +(@value{GDBP}) +x = 55 +*stopped,reason="exited-normally" +(@value{GDBP}) +@end smallexample + +@noindent +Program exited exceptionally: + +@smallexample +(@value{GDBP}) +-exec-run +^running +(@value{GDBP}) +x = 55 +*stopped,reason="exited",exit-code="01" +(@value{GDBP}) +@end smallexample + +Another way the program can terminate is if it receives a signal such as +@code{SIGINT}. In this case, @sc{gdb/mi} displays this: + +@smallexample +(@value{GDBP}) +*stopped,reason="exited-signalled",signal-name="SIGINT", +signal-meaning="Interrupt" +@end smallexample + + +@subheading The @code{-exec-abort} Command +@findex -exec-abort + +@subsubheading Synopsis + +@smallexample + -exec-abort +@end smallexample + +Kill the inferior running program. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{kill}. + +@subsubheading Example +N.A. + + +@subheading The @code{-exec-arguments} Command +@findex -exec-arguments + +@subsubheading Synopsis + +@smallexample + -exec-arguments @var{args} +@end smallexample + +Set the inferior program arguments, to be used in the next +@samp{-exec-run}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{set args}. + +@subsubheading Example + +@c FIXME! +Don't have one around. + + +@subheading The @code{-exec-continue} Command +@findex -exec-continue + +@subsubheading Synopsis + +@smallexample + -exec-continue +@end smallexample + +Asynchronous command. Resumes the execution of the inferior program +until a breakpoint is encountered, or until the inferior exits. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} corresponding is @samp{continue}. + +@subsubheading Example + +@smallexample +-exec-continue +^running +(@value{GDBP}) +@@Hello world +*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[], +file="hello.c",line="13"@} +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-finish} Command +@findex -exec-finish + +@subsubheading Synopsis + +@smallexample + -exec-finish +@end smallexample + +Asynchronous command. Resumes the execution of the inferior program +until the current function is exited. Displays the results returned by +the function. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{finish}. + +@subsubheading Example + +Function returning @code{void}. + +@smallexample +-exec-finish +^running +(@value{GDBP}) +@@hello from foo +*stopped,reason="function-finished",frame=@{func="main",args=[], +file="hello.c",line="7"@} +(@value{GDBP}) +@end smallexample + +Function returning other than @code{void}. The name of the internal +@value{GDBN} variable storing the result is printed, together with the +value itself. + +@smallexample +-exec-finish +^running +(@value{GDBP}) +*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo", +args=[@{name="a",value="1"],@{name="b",value="9"@}@}, +file="recursive2.c",line="14"@}, +gdb-result-var="$1",return-value="0" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-interrupt} Command +@findex -exec-interrupt + +@subsubheading Synopsis + +@smallexample + -exec-interrupt +@end smallexample + +Asynchronous command. Interrupts the background execution of the target. +Note how the token associated with the stop message is the one for the +execution command that has been interrupted. The token for the interrupt +itself only appears in the @samp{^done} output. If the user is trying to +interrupt a non-running program, an error message will be printed. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{interrupt}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +111-exec-continue +111^running + +(@value{GDBP}) +222-exec-interrupt +222^done +(@value{GDBP}) +111*stopped,signal-name="SIGINT",signal-meaning="Interrupt", +frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@} +(@value{GDBP}) + +(@value{GDBP}) +-exec-interrupt +^error,msg="mi_cmd_exec_interrupt: Inferior not executing." +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-next} Command +@findex -exec-next + +@subsubheading Synopsis + +@smallexample + -exec-next +@end smallexample + +Asynchronous command. Resumes execution of the inferior program, stopping +when the beginning of the next source line is reached. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{next}. + +@subsubheading Example + +@smallexample +-exec-next +^running +(@value{GDBP}) +*stopped,reason="end-stepping-range",line="8",file="hello.c" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-next-instruction} Command +@findex -exec-next-instruction + +@subsubheading Synopsis + +@smallexample + -exec-next-instruction +@end smallexample + +Asynchronous command. Executes one machine instruction. If the +instruction is a function call continues until the function returns. If +the program stops at an instruction in the middle of a source line, the +address will be printed as well. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{nexti}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-exec-next-instruction +^running + +(@value{GDBP}) +*stopped,reason="end-stepping-range", +addr="0x000100d4",line="5",file="hello.c" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-return} Command +@findex -exec-return + +@subsubheading Synopsis + +@smallexample + -exec-return +@end smallexample + +Makes current function return immediately. Doesn't execute the inferior. +Displays the new current frame. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{return}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +200-break-insert callee4 +200^done,bkpt=@{number="1",addr="0x00010734", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@} +(@value{GDBP}) +000-exec-run +000^running +(@value{GDBP}) +000*stopped,reason="breakpoint-hit",bkptno="1", +frame=@{func="callee4",args=[], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@} +(@value{GDBP}) +205-break-delete +205^done +(@value{GDBP}) +111-exec-return +111^done,frame=@{level="0",func="callee3", +args=[@{name="strarg", +value="0x11940 \"A string argument.\""@}], +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-run} Command +@findex -exec-run + +@subsubheading Synopsis + +@smallexample + -exec-run +@end smallexample + +Asynchronous command. Starts execution of the inferior from the +beginning. The inferior executes until either a breakpoint is +encountered or the program exits. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{run}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-break-insert main +^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@} +(@value{GDBP}) +-exec-run +^running +(@value{GDBP}) +*stopped,reason="breakpoint-hit",bkptno="1", +frame=@{func="main",args=[],file="recursive2.c",line="4"@} +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-show-arguments} Command +@findex -exec-show-arguments + +@subsubheading Synopsis + +@smallexample + -exec-show-arguments +@end smallexample + +Print the arguments of the program. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{show args}. + +@subsubheading Example +N.A. + +@c @subheading -exec-signal + +@subheading The @code{-exec-step} Command +@findex -exec-step + +@subsubheading Synopsis + +@smallexample + -exec-step +@end smallexample + +Asynchronous command. Resumes execution of the inferior program, stopping +when the beginning of the next source line is reached, if the next +source line is not a function call. If it is, stop at the first +instruction of the called function. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{step}. + +@subsubheading Example + +Stepping into a function: + +@smallexample +-exec-step +^running +(@value{GDBP}) +*stopped,reason="end-stepping-range", +frame=@{func="foo",args=[@{name="a",value="10"@}, +@{name="b",value="0"@}],file="recursive2.c",line="11"@} +(@value{GDBP}) +@end smallexample + +Regular stepping: + +@smallexample +-exec-step +^running +(@value{GDBP}) +*stopped,reason="end-stepping-range",line="14",file="recursive2.c" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-step-instruction} Command +@findex -exec-step-instruction + +@subsubheading Synopsis + +@smallexample + -exec-step-instruction +@end smallexample + +Asynchronous command. Resumes the inferior which executes one machine +instruction. The output, once @value{GDBN} has stopped, will vary depending on +whether we have stopped in the middle of a source line or not. In the +former case, the address at which the program stopped will be printed as +well. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{stepi}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-exec-step-instruction +^running + +(@value{GDBP}) +*stopped,reason="end-stepping-range", +frame=@{func="foo",args=[],file="try.c",line="10"@} +(@value{GDBP}) +-exec-step-instruction +^running + +(@value{GDBP}) +*stopped,reason="end-stepping-range", +frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@} +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-exec-until} Command +@findex -exec-until + +@subsubheading Synopsis + +@smallexample + -exec-until [ @var{location} ] +@end smallexample + +Asynchronous command. Executes the inferior until the @var{location} +specified in the argument is reached. If there is no argument, the inferior +executes until a source line greater than the current one is reached. +The reason for stopping in this case will be @samp{location-reached}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{until}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-exec-until recursive2.c:6 +^running +(@value{GDBP}) +x = 55 +*stopped,reason="location-reached",frame=@{func="main",args=[], +file="recursive2.c",line="6"@} +(@value{GDBP}) +@end smallexample + +@ignore +@subheading -file-clear +Is this going away???? +@end ignore + + +@subheading The @code{-file-exec-and-symbols} Command +@findex -file-exec-and-symbols + +@subsubheading Synopsis + +@smallexample + -file-exec-and-symbols @var{file} +@end smallexample + +Specify the executable file to be debugged. This file is the one from +which the symbol table is also read. If no file is specified, the +command clears the executable and symbol information. If breakpoints +are set when using this command with no arguments, @value{GDBN} will produce +error messages. Otherwise, no output is produced, except a completion +notification. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{file}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx +^done +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-file-exec-file} Command +@findex -file-exec-file + +@subsubheading Synopsis + +@smallexample + -file-exec-file @var{file} +@end smallexample + +Specify the executable file to be debugged. Unlike +@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read +from this file. If used without argument, @value{GDBN} clears the information +about the executable file. No output is produced, except a completion +notification. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{exec-file}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx +^done +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-file-list-exec-sections} Command +@findex -file-list-exec-sections + +@subsubheading Synopsis + +@smallexample + -file-list-exec-sections +@end smallexample + +List the sections of the current executable file. + +@subsubheading @value{GDBN} Command + +The @value{GDBN} command @samp{info file} shows, among the rest, the same +information as this command. @code{gdbtk} has a corresponding command +@samp{gdb_load_info}. + +@subsubheading Example +N.A. + + +@subheading The @code{-file-list-exec-source-file} Command +@findex -file-list-exec-source-file + +@subsubheading Synopsis + +@smallexample + -file-list-exec-source-file +@end smallexample + +List the line number, the current source file, and the absolute path +to the current source file for the current executable. + +@subsubheading @value{GDBN} Command + +There's no @value{GDBN} command which directly corresponds to this one. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +123-file-list-exec-source-file +123^done,line="1",file="foo.c",fullname="/home/bar/foo.c" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-file-list-exec-source-files} Command +@findex -file-list-exec-source-files + +@subsubheading Synopsis + +@smallexample + -file-list-exec-source-files +@end smallexample + +List the source files for the current executable. + +@subsubheading @value{GDBN} Command + +There's no @value{GDBN} command which directly corresponds to this one. +@code{gdbtk} has an analogous command @samp{gdb_listfiles}. + +@subsubheading Example +N.A. + + +@subheading The @code{-file-list-shared-libraries} Command +@findex -file-list-shared-libraries + +@subsubheading Synopsis + +@smallexample + -file-list-shared-libraries +@end smallexample + +List the shared libraries in the program. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info shared}. + +@subsubheading Example +N.A. + + +@subheading The @code{-file-list-symbol-files} Command +@findex -file-list-symbol-files + +@subsubheading Synopsis + +@smallexample + -file-list-symbol-files +@end smallexample + +List symbol files. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info file} (part of it). + +@subsubheading Example +N.A. + + +@subheading The @code{-file-symbol-file} Command +@findex -file-symbol-file + +@subsubheading Synopsis + +@smallexample + -file-symbol-file @var{file} +@end smallexample + +Read symbol table info from the specified @var{file} argument. When +used without arguments, clears @value{GDBN}'s symbol table info. No output is +produced, except for a completion notification. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{symbol-file}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx +^done +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Miscellaneous Commands +@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi} + +@c @subheading -gdb-complete + +@subheading The @code{-gdb-exit} Command +@findex -gdb-exit + +@subsubheading Synopsis + +@smallexample + -gdb-exit +@end smallexample + +Exit @value{GDBN} immediately. + +@subsubheading @value{GDBN} Command + +Approximately corresponds to @samp{quit}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-gdb-exit +@end smallexample + +@subheading The @code{-gdb-set} Command +@findex -gdb-set + +@subsubheading Synopsis + +@smallexample + -gdb-set +@end smallexample + +Set an internal @value{GDBN} variable. +@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ????? + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{set}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-gdb-set $foo=3 +^done +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-gdb-show} Command +@findex -gdb-show + +@subsubheading Synopsis + +@smallexample + -gdb-show +@end smallexample + +Show the current value of a @value{GDBN} variable. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{show}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-gdb-show annotate +^done,value="0" +(@value{GDBP}) +@end smallexample + +@c @subheading -gdb-source + + +@subheading The @code{-gdb-version} Command +@findex -gdb-version + +@subsubheading Synopsis + +@smallexample + -gdb-version +@end smallexample + +Show version information for @value{GDBN}. Used mostly in testing. + +@subsubheading @value{GDBN} Command + +There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this +information when you start an interactive session. + +@subsubheading Example + +@c This example modifies the actual output from GDB to avoid overfull +@c box in TeX. +@smallexample +(@value{GDBP}) +-gdb-version +~GNU gdb 5.2.1 +~Copyright 2000 Free Software Foundation, Inc. +~GDB is free software, covered by the GNU General Public License, and +~you are welcome to change it and/or distribute copies of it under +~ certain conditions. +~Type "show copying" to see the conditions. +~There is absolutely no warranty for GDB. Type "show warranty" for +~ details. +~This GDB was configured as + "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi". +^done +(@value{GDBP}) +@end smallexample + +@subheading The @code{-interpreter-exec} Command +@findex -interpreter-exec + +@subheading Synopsis + +@smallexample +-interpreter-exec @var{interpreter} @var{command} +@end smallexample + +Execute the specified @var{command} in the given @var{interpreter}. + +@subheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{interpreter-exec}. + +@subheading Example + +@smallexample +(@value{GDBP}) +-interpreter-exec console "break main" +&"During symbol reading, couldn't parse type; debugger out of date?.\n" +&"During symbol reading, bad structure-type format.\n" +~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n" +^done +(@value{GDBP}) +@end smallexample + +@ignore +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Kod Commands +@section @sc{gdb/mi} Kod Commands + +The Kod commands are not implemented. + +@c @subheading -kod-info + +@c @subheading -kod-list + +@c @subheading -kod-list-object-types + +@c @subheading -kod-show + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Memory Overlay Commands +@section @sc{gdb/mi} Memory Overlay Commands + +The memory overlay commands are not implemented. + +@c @subheading -overlay-auto + +@c @subheading -overlay-list-mapping-state + +@c @subheading -overlay-list-overlays + +@c @subheading -overlay-map + +@c @subheading -overlay-off + +@c @subheading -overlay-on + +@c @subheading -overlay-unmap + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Signal Handling Commands +@section @sc{gdb/mi} Signal Handling Commands + +Signal handling commands are not implemented. + +@c @subheading -signal-handle + +@c @subheading -signal-list-handle-actions + +@c @subheading -signal-list-signal-types +@end ignore + + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Stack Manipulation +@section @sc{gdb/mi} Stack Manipulation Commands + + +@subheading The @code{-stack-info-frame} Command +@findex -stack-info-frame + +@subsubheading Synopsis + +@smallexample + -stack-info-frame +@end smallexample + +Get info on the current frame. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame} +(without arguments). + +@subsubheading Example +N.A. + +@subheading The @code{-stack-info-depth} Command +@findex -stack-info-depth + +@subsubheading Synopsis + +@smallexample + -stack-info-depth [ @var{max-depth} ] +@end smallexample + +Return the depth of the stack. If the integer argument @var{max-depth} +is specified, do not count beyond @var{max-depth} frames. + +@subsubheading @value{GDBN} Command + +There's no equivalent @value{GDBN} command. + +@subsubheading Example + +For a stack with frame levels 0 through 11: + +@smallexample +(@value{GDBP}) +-stack-info-depth +^done,depth="12" +(@value{GDBP}) +-stack-info-depth 4 +^done,depth="4" +(@value{GDBP}) +-stack-info-depth 12 +^done,depth="12" +(@value{GDBP}) +-stack-info-depth 11 +^done,depth="11" +(@value{GDBP}) +-stack-info-depth 13 +^done,depth="12" +(@value{GDBP}) +@end smallexample + +@subheading The @code{-stack-list-arguments} Command +@findex -stack-list-arguments + +@subsubheading Synopsis + +@smallexample + -stack-list-arguments @var{show-values} + [ @var{low-frame} @var{high-frame} ] +@end smallexample + +Display a list of the arguments for the frames between @var{low-frame} +and @var{high-frame} (inclusive). If @var{low-frame} and +@var{high-frame} are not provided, list the arguments for the whole call +stack. + +The @var{show-values} argument must have a value of 0 or 1. A value of +0 means that only the names of the arguments are listed, a value of 1 +means that both names and values of the arguments are printed. + +@subsubheading @value{GDBN} Command + +@value{GDBN} does not have an equivalent command. @code{gdbtk} has a +@samp{gdb_get_args} command which partially overlaps with the +functionality of @samp{-stack-list-arguments}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-stack-list-frames +^done, +stack=[ +frame=@{level="0",addr="0x00010734",func="callee4", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}, +frame=@{level="1",addr="0x0001076c",func="callee3", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}, +frame=@{level="2",addr="0x0001078c",func="callee2", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@}, +frame=@{level="3",addr="0x000107b4",func="callee1", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@}, +frame=@{level="4",addr="0x000107e0",func="main", +file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}] +(@value{GDBP}) +-stack-list-arguments 0 +^done, +stack-args=[ +frame=@{level="0",args=[]@}, +frame=@{level="1",args=[name="strarg"]@}, +frame=@{level="2",args=[name="intarg",name="strarg"]@}, +frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@}, +frame=@{level="4",args=[]@}] +(@value{GDBP}) +-stack-list-arguments 1 +^done, +stack-args=[ +frame=@{level="0",args=[]@}, +frame=@{level="1", + args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@}, +frame=@{level="2",args=[ +@{name="intarg",value="2"@}, +@{name="strarg",value="0x11940 \"A string argument.\""@}]@}, +@{frame=@{level="3",args=[ +@{name="intarg",value="2"@}, +@{name="strarg",value="0x11940 \"A string argument.\""@}, +@{name="fltarg",value="3.5"@}]@}, +frame=@{level="4",args=[]@}] +(@value{GDBP}) +-stack-list-arguments 0 2 2 +^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}] +(@value{GDBP}) +-stack-list-arguments 1 2 2 +^done,stack-args=[frame=@{level="2", +args=[@{name="intarg",value="2"@}, +@{name="strarg",value="0x11940 \"A string argument.\""@}]@}] +(@value{GDBP}) +@end smallexample + +@c @subheading -stack-list-exception-handlers + + +@subheading The @code{-stack-list-frames} Command +@findex -stack-list-frames + +@subsubheading Synopsis + +@smallexample + -stack-list-frames [ @var{low-frame} @var{high-frame} ] +@end smallexample + +List the frames currently on the stack. For each frame it displays the +following info: + +@table @samp +@item @var{level} +The frame number, 0 being the topmost frame, i.e. the innermost function. +@item @var{addr} +The @code{$pc} value for that frame. +@item @var{func} +Function name. +@item @var{file} +File name of the source file where the function lives. +@item @var{line} +Line number corresponding to the @code{$pc}. +@end table + +If invoked without arguments, this command prints a backtrace for the +whole stack. If given two integer arguments, it shows the frames whose +levels are between the two arguments (inclusive). If the two arguments +are equal, it shows the single frame at the corresponding level. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}. + +@subsubheading Example + +Full stack backtrace: + +@smallexample +(@value{GDBP}) +-stack-list-frames +^done,stack= +[frame=@{level="0",addr="0x0001076c",func="foo", + file="recursive2.c",line="11"@}, +frame=@{level="1",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="2",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="3",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="4",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="5",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="6",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="7",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="8",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="9",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="10",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="11",addr="0x00010738",func="main", + file="recursive2.c",line="4"@}] +(@value{GDBP}) +@end smallexample + +Show frames between @var{low_frame} and @var{high_frame}: + +@smallexample +(@value{GDBP}) +-stack-list-frames 3 5 +^done,stack= +[frame=@{level="3",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="4",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}, +frame=@{level="5",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}] +(@value{GDBP}) +@end smallexample + +Show a single frame: + +@smallexample +(@value{GDBP}) +-stack-list-frames 3 3 +^done,stack= +[frame=@{level="3",addr="0x000107a4",func="foo", + file="recursive2.c",line="14"@}] +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-stack-list-locals} Command +@findex -stack-list-locals + +@subsubheading Synopsis + +@smallexample + -stack-list-locals @var{print-values} +@end smallexample + +Display the local variable names for the current frame. With an +argument of 0 prints only the names of the variables, with argument of 1 +prints also their values. + +@subsubheading @value{GDBN} Command + +@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-stack-list-locals 0 +^done,locals=[name="A",name="B",name="C"] +(@value{GDBP}) +-stack-list-locals 1 +^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@}, + @{name="C",value="3"@}] +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-stack-select-frame} Command +@findex -stack-select-frame + +@subsubheading Synopsis + +@smallexample + -stack-select-frame @var{framenum} +@end smallexample + +Change the current frame. Select a different frame @var{framenum} on +the stack. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} commands are @samp{frame}, @samp{up}, +@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-stack-select-frame 2 +^done +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Symbol Query +@section @sc{gdb/mi} Symbol Query Commands + + +@subheading The @code{-symbol-info-address} Command +@findex -symbol-info-address + +@subsubheading Synopsis + +@smallexample + -symbol-info-address @var{symbol} +@end smallexample + +Describe where @var{symbol} is stored. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info address}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-info-file} Command +@findex -symbol-info-file + +@subsubheading Synopsis + +@smallexample + -symbol-info-file +@end smallexample + +Show the file for the symbol. + +@subsubheading @value{GDBN} Command + +There's no equivalent @value{GDBN} command. @code{gdbtk} has +@samp{gdb_find_file}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-info-function} Command +@findex -symbol-info-function + +@subsubheading Synopsis + +@smallexample + -symbol-info-function +@end smallexample + +Show which function the symbol lives in. + +@subsubheading @value{GDBN} Command + +@samp{gdb_get_function} in @code{gdbtk}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-info-line} Command +@findex -symbol-info-line + +@subsubheading Synopsis + +@smallexample + -symbol-info-line +@end smallexample + +Show the core addresses of the code for a source line. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} comamnd is @samp{info line}. +@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-info-symbol} Command +@findex -symbol-info-symbol + +@subsubheading Synopsis + +@smallexample + -symbol-info-symbol @var{addr} +@end smallexample + +Describe what symbol is at location @var{addr}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{info symbol}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-list-functions} Command +@findex -symbol-list-functions + +@subsubheading Synopsis + +@smallexample + -symbol-list-functions +@end smallexample + +List the functions in the executable. + +@subsubheading @value{GDBN} Command + +@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and +@samp{gdb_search} in @code{gdbtk}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-list-types} Command +@findex -symbol-list-types + +@subsubheading Synopsis + +@smallexample + -symbol-list-types +@end smallexample + +List all the type names. + +@subsubheading @value{GDBN} Command + +The corresponding commands are @samp{info types} in @value{GDBN}, +@samp{gdb_search} in @code{gdbtk}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-list-variables} Command +@findex -symbol-list-variables + +@subsubheading Synopsis + +@smallexample + -symbol-list-variables +@end smallexample + +List all the global and static variable names. + +@subsubheading @value{GDBN} Command + +@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-locate} Command +@findex -symbol-locate + +@subsubheading Synopsis + +@smallexample + -symbol-locate +@end smallexample + +@subsubheading @value{GDBN} Command + +@samp{gdb_loc} in @code{gdbtk}. + +@subsubheading Example +N.A. + + +@subheading The @code{-symbol-type} Command +@findex -symbol-type + +@subsubheading Synopsis + +@smallexample + -symbol-type @var{variable} +@end smallexample + +Show type of @var{variable}. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has +@samp{gdb_obj_variable}. + +@subsubheading Example +N.A. + + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Target Manipulation +@section @sc{gdb/mi} Target Manipulation Commands + + +@subheading The @code{-target-attach} Command +@findex -target-attach + +@subsubheading Synopsis + +@smallexample + -target-attach @var{pid} | @var{file} +@end smallexample + +Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{attach}. + +@subsubheading Example +N.A. + + +@subheading The @code{-target-compare-sections} Command +@findex -target-compare-sections + +@subsubheading Synopsis + +@smallexample + -target-compare-sections [ @var{section} ] +@end smallexample + +Compare data of section @var{section} on target to the exec file. +Without the argument, all sections are compared. + +@subsubheading @value{GDBN} Command + +The @value{GDBN} equivalent is @samp{compare-sections}. + +@subsubheading Example +N.A. + + +@subheading The @code{-target-detach} Command +@findex -target-detach + +@subsubheading Synopsis + +@smallexample + -target-detach +@end smallexample + +Disconnect from the remote target. There's no output. + +@subsubheading @value{GDBN} command + +The corresponding @value{GDBN} command is @samp{detach}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-target-detach +^done +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-target-download} Command +@findex -target-download + +@subsubheading Synopsis + +@smallexample + -target-download +@end smallexample + +Loads the executable onto the remote target. +It prints out an update message every half second, which includes the fields: + +@table @samp +@item section +The name of the section. +@item section-sent +The size of what has been sent so far for that section. +@item section-size +The size of the section. +@item total-sent +The total size of what was sent so far (the current and the previous sections). +@item total-size +The size of the overall executable to download. +@end table + +@noindent +Each message is sent as status record (@pxref{GDB/MI Output Syntax, , +@sc{gdb/mi} Output Syntax}). + +In addition, it prints the name and size of the sections, as they are +downloaded. These messages include the following fields: + +@table @samp +@item section +The name of the section. +@item section-size +The size of the section. +@item total-size +The size of the overall executable to download. +@end table + +@noindent +At the end, a summary is printed. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{load}. + +@subsubheading Example + +Note: each status message appears on a single line. Here the messages +have been broken down so that they can fit onto a page. + +@smallexample +(@value{GDBP}) +-target-download ++download,@{section=".text",section-size="6668",total-size="9880"@} ++download,@{section=".text",section-sent="512",section-size="6668", +total-sent="512",total-size="9880"@} ++download,@{section=".text",section-sent="1024",section-size="6668", +total-sent="1024",total-size="9880"@} ++download,@{section=".text",section-sent="1536",section-size="6668", +total-sent="1536",total-size="9880"@} ++download,@{section=".text",section-sent="2048",section-size="6668", +total-sent="2048",total-size="9880"@} ++download,@{section=".text",section-sent="2560",section-size="6668", +total-sent="2560",total-size="9880"@} ++download,@{section=".text",section-sent="3072",section-size="6668", +total-sent="3072",total-size="9880"@} ++download,@{section=".text",section-sent="3584",section-size="6668", +total-sent="3584",total-size="9880"@} ++download,@{section=".text",section-sent="4096",section-size="6668", +total-sent="4096",total-size="9880"@} ++download,@{section=".text",section-sent="4608",section-size="6668", +total-sent="4608",total-size="9880"@} ++download,@{section=".text",section-sent="5120",section-size="6668", +total-sent="5120",total-size="9880"@} ++download,@{section=".text",section-sent="5632",section-size="6668", +total-sent="5632",total-size="9880"@} ++download,@{section=".text",section-sent="6144",section-size="6668", +total-sent="6144",total-size="9880"@} ++download,@{section=".text",section-sent="6656",section-size="6668", +total-sent="6656",total-size="9880"@} ++download,@{section=".init",section-size="28",total-size="9880"@} ++download,@{section=".fini",section-size="28",total-size="9880"@} ++download,@{section=".data",section-size="3156",total-size="9880"@} ++download,@{section=".data",section-sent="512",section-size="3156", +total-sent="7236",total-size="9880"@} ++download,@{section=".data",section-sent="1024",section-size="3156", +total-sent="7748",total-size="9880"@} ++download,@{section=".data",section-sent="1536",section-size="3156", +total-sent="8260",total-size="9880"@} ++download,@{section=".data",section-sent="2048",section-size="3156", +total-sent="8772",total-size="9880"@} ++download,@{section=".data",section-sent="2560",section-size="3156", +total-sent="9284",total-size="9880"@} ++download,@{section=".data",section-sent="3072",section-size="3156", +total-sent="9796",total-size="9880"@} +^done,address="0x10004",load-size="9880",transfer-rate="6586", +write-rate="429" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-target-exec-status} Command +@findex -target-exec-status + +@subsubheading Synopsis + +@smallexample + -target-exec-status +@end smallexample + +Provide information on the state of the target (whether it is running or +not, for instance). + +@subsubheading @value{GDBN} Command + +There's no equivalent @value{GDBN} command. + +@subsubheading Example +N.A. + + +@subheading The @code{-target-list-available-targets} Command +@findex -target-list-available-targets + +@subsubheading Synopsis + +@smallexample + -target-list-available-targets +@end smallexample + +List the possible targets to connect to. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{help target}. + +@subsubheading Example +N.A. + + +@subheading The @code{-target-list-current-targets} Command +@findex -target-list-current-targets + +@subsubheading Synopsis + +@smallexample + -target-list-current-targets +@end smallexample + +Describe the current target. + +@subsubheading @value{GDBN} Command + +The corresponding information is printed by @samp{info file} (among +other things). + +@subsubheading Example +N.A. + + +@subheading The @code{-target-list-parameters} Command +@findex -target-list-parameters + +@subsubheading Synopsis + +@smallexample + -target-list-parameters +@end smallexample + +@c ???? + +@subsubheading @value{GDBN} Command + +No equivalent. + +@subsubheading Example +N.A. + + +@subheading The @code{-target-select} Command +@findex -target-select + +@subsubheading Synopsis + +@smallexample + -target-select @var{type} @var{parameters @dots{}} +@end smallexample + +Connect @value{GDBN} to the remote target. This command takes two args: + +@table @samp +@item @var{type} +The type of target, for instance @samp{async}, @samp{remote}, etc. +@item @var{parameters} +Device names, host names and the like. @xref{Target Commands, , +Commands for managing targets}, for more details. +@end table + +The output is a connection notification, followed by the address at +which the target program is, in the following form: + +@smallexample +^connected,addr="@var{address}",func="@var{function name}", + args=[@var{arg list}] +@end smallexample + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{target}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-target-select async /dev/ttya +^connected,addr="0xfe00a300",func="??",args=[] +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Thread Commands +@section @sc{gdb/mi} Thread Commands + + +@subheading The @code{-thread-info} Command +@findex -thread-info + +@subsubheading Synopsis + +@smallexample + -thread-info +@end smallexample + +@subsubheading @value{GDBN} command + +No equivalent. + +@subsubheading Example +N.A. + + +@subheading The @code{-thread-list-all-threads} Command +@findex -thread-list-all-threads + +@subsubheading Synopsis + +@smallexample + -thread-list-all-threads +@end smallexample + +@subsubheading @value{GDBN} Command + +The equivalent @value{GDBN} command is @samp{info threads}. + +@subsubheading Example +N.A. + + +@subheading The @code{-thread-list-ids} Command +@findex -thread-list-ids + +@subsubheading Synopsis + +@smallexample + -thread-list-ids +@end smallexample + +Produces a list of the currently known @value{GDBN} thread ids. At the +end of the list it also prints the total number of such threads. + +@subsubheading @value{GDBN} Command + +Part of @samp{info threads} supplies the same information. + +@subsubheading Example + +No threads present, besides the main process: + +@smallexample +(@value{GDBP}) +-thread-list-ids +^done,thread-ids=@{@},number-of-threads="0" +(@value{GDBP}) +@end smallexample + + +Several threads: + +@smallexample +(@value{GDBP}) +-thread-list-ids +^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@}, +number-of-threads="3" +(@value{GDBP}) +@end smallexample + + +@subheading The @code{-thread-select} Command +@findex -thread-select + +@subsubheading Synopsis + +@smallexample + -thread-select @var{threadnum} +@end smallexample + +Make @var{threadnum} the current thread. It prints the number of the new +current thread, and the topmost frame for that thread. + +@subsubheading @value{GDBN} Command + +The corresponding @value{GDBN} command is @samp{thread}. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-exec-next +^running +(@value{GDBP}) +*stopped,reason="end-stepping-range",thread-id="2",line="187", +file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c" +(@value{GDBP}) +-thread-list-ids +^done, +thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@}, +number-of-threads="3" +(@value{GDBP}) +-thread-select 3 +^done,new-thread-id="3", +frame=@{level="0",func="vprintf", +args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@}, +@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@} +(@value{GDBP}) +@end smallexample + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Tracepoint Commands +@section @sc{gdb/mi} Tracepoint Commands + +The tracepoint commands are not yet implemented. + +@c @subheading -trace-actions + +@c @subheading -trace-delete + +@c @subheading -trace-disable + +@c @subheading -trace-dump + +@c @subheading -trace-enable + +@c @subheading -trace-exists + +@c @subheading -trace-find + +@c @subheading -trace-frame-number + +@c @subheading -trace-info + +@c @subheading -trace-insert + +@c @subheading -trace-list + +@c @subheading -trace-pass-count + +@c @subheading -trace-save + +@c @subheading -trace-start + +@c @subheading -trace-stop + + +@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@node GDB/MI Variable Objects +@section @sc{gdb/mi} Variable Objects + + +@subheading Motivation for Variable Objects in @sc{gdb/mi} + +For the implementation of a variable debugger window (locals, watched +expressions, etc.), we are proposing the adaptation of the existing code +used by @code{Insight}. + +The two main reasons for that are: + +@enumerate 1 +@item +It has been proven in practice (it is already on its second generation). + +@item +It will shorten development time (needless to say how important it is +now). +@end enumerate + +The original interface was designed to be used by Tcl code, so it was +slightly changed so it could be used through @sc{gdb/mi}. This section +describes the @sc{gdb/mi} operations that will be available and gives some +hints about their use. + +@emph{Note}: In addition to the set of operations described here, we +expect the @sc{gui} implementation of a variable window to require, at +least, the following operations: + +@itemize @bullet +@item @code{-gdb-show} @code{output-radix} +@item @code{-stack-list-arguments} +@item @code{-stack-list-locals} +@item @code{-stack-select-frame} +@end itemize + +@subheading Introduction to Variable Objects in @sc{gdb/mi} + +@cindex variable objects in @sc{gdb/mi} +The basic idea behind variable objects is the creation of a named object +to represent a variable, an expression, a memory location or even a CPU +register. For each object created, a set of operations is available for +examining or changing its properties. + +Furthermore, complex data types, such as C structures, are represented +in a tree format. For instance, the @code{struct} type variable is the +root and the children will represent the struct members. If a child +is itself of a complex type, it will also have children of its own. +Appropriate language differences are handled for C, C@t{++} and Java. + +When returning the actual values of the objects, this facility allows +for the individual selection of the display format used in the result +creation. It can be chosen among: binary, decimal, hexadecimal, octal +and natural. Natural refers to a default format automatically +chosen based on the variable type (like decimal for an @code{int}, hex +for pointers, etc.). + +The following is the complete set of @sc{gdb/mi} operations defined to +access this functionality: + +@multitable @columnfractions .4 .6 +@item @strong{Operation} +@tab @strong{Description} + +@item @code{-var-create} +@tab create a variable object +@item @code{-var-delete} +@tab delete the variable object and its children +@item @code{-var-set-format} +@tab set the display format of this variable +@item @code{-var-show-format} +@tab show the display format of this variable +@item @code{-var-info-num-children} +@tab tells how many children this object has +@item @code{-var-list-children} +@tab return a list of the object's children +@item @code{-var-info-type} +@tab show the type of this variable object +@item @code{-var-info-expression} +@tab print what this variable object represents +@item @code{-var-show-attributes} +@tab is this variable editable? does it exist here? +@item @code{-var-evaluate-expression} +@tab get the value of this variable +@item @code{-var-assign} +@tab set the value of this variable +@item @code{-var-update} +@tab update the variable and its children +@end multitable + +In the next subsection we describe each operation in detail and suggest +how it can be used. + +@subheading Description And Use of Operations on Variable Objects + +@subheading The @code{-var-create} Command +@findex -var-create + +@subsubheading Synopsis + +@smallexample + -var-create @{@var{name} | "-"@} + @{@var{frame-addr} | "*"@} @var{expression} +@end smallexample + +This operation creates a variable object, which allows the monitoring of +a variable, the result of an expression, a memory cell or a CPU +register. + +The @var{name} parameter is the string by which the object can be +referenced. It must be unique. If @samp{-} is specified, the varobj +system will generate a string ``varNNNNNN'' automatically. It will be +unique provided that one does not specify @var{name} on that format. +The command fails if a duplicate name is found. + +The frame under which the expression should be evaluated can be +specified by @var{frame-addr}. A @samp{*} indicates that the current +frame should be used. + +@var{expression} is any expression valid on the current language set (must not +begin with a @samp{*}), or one of the following: + +@itemize @bullet +@item +@samp{*@var{addr}}, where @var{addr} is the address of a memory cell + +@item +@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD) + +@item +@samp{$@var{regname}} --- a CPU register name +@end itemize + +@subsubheading Result + +This operation returns the name, number of children and the type of the +object created. Type is returned as a string as the ones generated by +the @value{GDBN} CLI: + +@smallexample + name="@var{name}",numchild="N",type="@var{type}" +@end smallexample + + +@subheading The @code{-var-delete} Command +@findex -var-delete + +@subsubheading Synopsis + +@smallexample + -var-delete @var{name} +@end smallexample + +Deletes a previously created variable object and all of its children. + +Returns an error if the object @var{name} is not found. + + +@subheading The @code{-var-set-format} Command +@findex -var-set-format + +@subsubheading Synopsis + +@smallexample + -var-set-format @var{name} @var{format-spec} +@end smallexample + +Sets the output format for the value of the object @var{name} to be +@var{format-spec}. + +The syntax for the @var{format-spec} is as follows: + +@smallexample + @var{format-spec} @expansion{} + @{binary | decimal | hexadecimal | octal | natural@} +@end smallexample + + +@subheading The @code{-var-show-format} Command +@findex -var-show-format + +@subsubheading Synopsis + +@smallexample + -var-show-format @var{name} +@end smallexample + +Returns the format used to display the value of the object @var{name}. + +@smallexample + @var{format} @expansion{} + @var{format-spec} +@end smallexample + + +@subheading The @code{-var-info-num-children} Command +@findex -var-info-num-children + +@subsubheading Synopsis + +@smallexample + -var-info-num-children @var{name} +@end smallexample + +Returns the number of children of a variable object @var{name}: + +@smallexample + numchild=@var{n} +@end smallexample + + +@subheading The @code{-var-list-children} Command +@findex -var-list-children + +@subsubheading Synopsis + +@smallexample + -var-list-children @var{name} +@end smallexample + +Returns a list of the children of the specified variable object: + +@smallexample + numchild=@var{n},children=[@{name=@var{name}, + numchild=@var{n},type=@var{type}@},@r{(repeats N times)}] +@end smallexample + + +@subheading The @code{-var-info-type} Command +@findex -var-info-type + +@subsubheading Synopsis + +@smallexample + -var-info-type @var{name} +@end smallexample + +Returns the type of the specified variable @var{name}. The type is +returned as a string in the same format as it is output by the +@value{GDBN} CLI: + +@smallexample + type=@var{typename} +@end smallexample + + +@subheading The @code{-var-info-expression} Command +@findex -var-info-expression + +@subsubheading Synopsis + +@smallexample + -var-info-expression @var{name} +@end smallexample + +Returns what is represented by the variable object @var{name}: + +@smallexample + lang=@var{lang-spec},exp=@var{expression} +@end smallexample + +@noindent +where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}. + +@subheading The @code{-var-show-attributes} Command +@findex -var-show-attributes + +@subsubheading Synopsis + +@smallexample + -var-show-attributes @var{name} +@end smallexample + +List attributes of the specified variable object @var{name}: + +@smallexample + status=@var{attr} [ ( ,@var{attr} )* ] +@end smallexample + +@noindent +where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}. + +@subheading The @code{-var-evaluate-expression} Command +@findex -var-evaluate-expression + +@subsubheading Synopsis + +@smallexample + -var-evaluate-expression @var{name} +@end smallexample + +Evaluates the expression that is represented by the specified variable +object and returns its value as a string in the current format specified +for the object: + +@smallexample + value=@var{value} +@end smallexample + +Note that one must invoke @code{-var-list-children} for a variable +before the value of a child variable can be evaluated. + +@subheading The @code{-var-assign} Command +@findex -var-assign + +@subsubheading Synopsis + +@smallexample + -var-assign @var{name} @var{expression} +@end smallexample + +Assigns the value of @var{expression} to the variable object specified +by @var{name}. The object must be @samp{editable}. If the variable's +value is altered by the assign, the variable will show up in any +subsequent @code{-var-update} list. + +@subsubheading Example + +@smallexample +(@value{GDBP}) +-var-assign var1 3 +^done,value="3" +(@value{GDBP}) +-var-update * +^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}] +(@value{GDBP}) +@end smallexample + +@subheading The @code{-var-update} Command +@findex -var-update + +@subsubheading Synopsis + +@smallexample + -var-update @{@var{name} | "*"@} +@end smallexample + +Update the value of the variable object @var{name} by evaluating its +expression after fetching all the new values from memory or registers. +A @samp{*} causes all existing variable objects to be updated. + + +@node Annotations +@chapter @value{GDBN} Annotations + +This chapter describes annotations in @value{GDBN}. Annotations are +designed to interface @value{GDBN} to graphical user interfaces or +other similar programs which want to interact with @value{GDBN} at a +relatively high level. + +@ignore +This is Edition @value{EDITION}, @value{DATE}. +@end ignore + +@menu +* Annotations Overview:: What annotations are; the general syntax. +* Server Prefix:: Issuing a command without affecting user state. +* Value Annotations:: Values are marked as such. +* Frame Annotations:: Stack frames are annotated. +* Displays:: @value{GDBN} can be told to display something periodically. +* Prompting:: Annotations marking @value{GDBN}'s need for input. +* Errors:: Annotations for error messages. +* Breakpoint Info:: Information on breakpoints. +* Invalidation:: Some annotations describe things now invalid. +* Annotations for Running:: + Whether the program is running, how it stopped, etc. +* Source Annotations:: Annotations describing source code. +* TODO:: Annotations which might be added in the future. +@end menu + +@node Annotations Overview +@section What is an Annotation? +@cindex annotations + +To produce annotations, start @value{GDBN} with the @code{--annotate=2} option. + +Annotations start with a newline character, two @samp{control-z} +characters, and the name of the annotation. If there is no additional +information associated with this annotation, the name of the annotation +is followed immediately by a newline. If there is additional +information, the name of the annotation is followed by a space, the +additional information, and a newline. The additional information +cannot contain newline characters. + +Any output not beginning with a newline and two @samp{control-z} +characters denotes literal output from @value{GDBN}. Currently there is +no need for @value{GDBN} to output a newline followed by two +@samp{control-z} characters, but if there was such a need, the +annotations could be extended with an @samp{escape} annotation which +means those three characters as output. + +A simple example of starting up @value{GDBN} with annotations is: + +@smallexample +$ gdb --annotate=2 +GNU GDB 5.0 +Copyright 2000 Free Software Foundation, Inc. +GDB is free software, covered by the GNU General Public License, +and you are welcome to change it and/or distribute copies of it +under certain conditions. +Type "show copying" to see the conditions. +There is absolutely no warranty for GDB. Type "show warranty" +for details. +This GDB was configured as "sparc-sun-sunos4.1.3" + +^Z^Zpre-prompt +(gdb) +^Z^Zprompt +quit + +^Z^Zpost-prompt +$ +@end smallexample + +Here @samp{quit} is input to @value{GDBN}; the rest is output from +@value{GDBN}. The three lines beginning @samp{^Z^Z} (where @samp{^Z} +denotes a @samp{control-z} character) are annotations; the rest is +output from @value{GDBN}. + +@node Server Prefix +@section The Server Prefix +@cindex server prefix for annotations + +To issue a command to @value{GDBN} without affecting certain aspects of +the state which is seen by users, prefix it with @samp{server }. This +means that this command will not affect the command history, nor will it +affect @value{GDBN}'s notion of which command to repeat if @key{RET} is +pressed on a line by itself. + +The server prefix does not affect the recording of values into the value +history; to print a value without recording it into the value history, +use the @code{output} command instead of the @code{print} command. + +@node Value Annotations +@section Values + +@cindex annotations for values +When a value is printed in various contexts, @value{GDBN} uses +annotations to delimit the value from the surrounding text. + +@findex value-history-begin +@findex value-history-value +@findex value-history-end +If a value is printed using @code{print} and added to the value history, +the annotation looks like + +@smallexample +^Z^Zvalue-history-begin @var{history-number} @var{value-flags} +@var{history-string} +^Z^Zvalue-history-value +@var{the-value} +^Z^Zvalue-history-end +@end smallexample + +@noindent +where @var{history-number} is the number it is getting in the value +history, @var{history-string} is a string, such as @samp{$5 = }, which +introduces the value to the user, @var{the-value} is the output +corresponding to the value itself, and @var{value-flags} is @samp{*} for +a value which can be dereferenced and @samp{-} for a value which cannot. + +@findex value-begin +@findex value-end +If the value is not added to the value history (it is an invalid float +or it is printed with the @code{output} command), the annotation is similar: + +@smallexample +^Z^Zvalue-begin @var{value-flags} +@var{the-value} +^Z^Zvalue-end +@end smallexample + +@findex arg-begin +@findex arg-name-end +@findex arg-value +@findex arg-end +When @value{GDBN} prints an argument to a function (for example, in the output +from the @code{backtrace} command), it annotates it as follows: + +@smallexample +^Z^Zarg-begin +@var{argument-name} +^Z^Zarg-name-end +@var{separator-string} +^Z^Zarg-value @var{value-flags} +@var{the-value} +^Z^Zarg-end +@end smallexample + +@noindent +where @var{argument-name} is the name of the argument, +@var{separator-string} is text which separates the name from the value +for the user's benefit (such as @samp{=}), and @var{value-flags} and +@var{the-value} have the same meanings as in a +@code{value-history-begin} annotation. + +@findex field-begin +@findex field-name-end +@findex field-value +@findex field-end +When printing a structure, @value{GDBN} annotates it as follows: + +@smallexample +^Z^Zfield-begin @var{value-flags} +@var{field-name} +^Z^Zfield-name-end +@var{separator-string} +^Z^Zfield-value +@var{the-value} +^Z^Zfield-end +@end smallexample + +@noindent +where @var{field-name} is the name of the field, @var{separator-string} +is text which separates the name from the value for the user's benefit +(such as @samp{=}), and @var{value-flags} and @var{the-value} have the +same meanings as in a @code{value-history-begin} annotation. + +When printing an array, @value{GDBN} annotates it as follows: + +@smallexample +^Z^Zarray-section-begin @var{array-index} @var{value-flags} +@end smallexample + +@noindent +where @var{array-index} is the index of the first element being +annotated and @var{value-flags} has the same meaning as in a +@code{value-history-begin} annotation. This is followed by any number +of elements, where is element can be either a single element: + +@findex elt +@smallexample +@samp{,} @var{whitespace} ; @r{omitted for the first element} +@var{the-value} +^Z^Zelt +@end smallexample + +or a repeated element + +@findex elt-rep +@findex elt-rep-end +@smallexample +@samp{,} @var{whitespace} ; @r{omitted for the first element} +@var{the-value} +^Z^Zelt-rep @var{number-of-repetitions} +@var{repetition-string} +^Z^Zelt-rep-end +@end smallexample + +In both cases, @var{the-value} is the output for the value of the +element and @var{whitespace} can contain spaces, tabs, and newlines. In +the repeated case, @var{number-of-repetitions} is the number of +consecutive array elements which contain that value, and +@var{repetition-string} is a string which is designed to convey to the +user that repetition is being depicted. + +@findex array-section-end +Once all the array elements have been output, the array annotation is +ended with + +@smallexample +^Z^Zarray-section-end +@end smallexample + +@node Frame Annotations +@section Frames + +@cindex annotations for frames +Whenever @value{GDBN} prints a frame, it annotates it. For example, this applies +to frames printed when @value{GDBN} stops, output from commands such as +@code{backtrace} or @code{up}, etc. + +@findex frame-begin +The frame annotation begins with + +@smallexample +^Z^Zframe-begin @var{level} @var{address} +@var{level-string} +@end smallexample + +@noindent +where @var{level} is the number of the frame (0 is the innermost frame, +and other frames have positive numbers), @var{address} is the address of +the code executing in that frame, and @var{level-string} is a string +designed to convey the level to the user. @var{address} is in the form +@samp{0x} followed by one or more lowercase hex digits (note that this +does not depend on the language). The frame ends with + +@findex frame-end +@smallexample +^Z^Zframe-end +@end smallexample + +Between these annotations is the main body of the frame, which can +consist of + +@itemize @bullet +@item +@findex function-call +@smallexample +^Z^Zfunction-call +@var{function-call-string} +@end smallexample + +where @var{function-call-string} is text designed to convey to the user +that this frame is associated with a function call made by @value{GDBN} to a +function in the program being debugged. + +@item +@findex signal-handler-caller +@smallexample +^Z^Zsignal-handler-caller +@var{signal-handler-caller-string} +@end smallexample + +where @var{signal-handler-caller-string} is text designed to convey to +the user that this frame is associated with whatever mechanism is used +by this operating system to call a signal handler (it is the frame which +calls the signal handler, not the frame for the signal handler itself). + +@item +A normal frame. + +@findex frame-address +@findex frame-address-end +This can optionally (depending on whether this is thought of as +interesting information for the user to see) begin with + +@smallexample +^Z^Zframe-address +@var{address} +^Z^Zframe-address-end +@var{separator-string} +@end smallexample + +where @var{address} is the address executing in the frame (the same +address as in the @code{frame-begin} annotation, but printed in a form +which is intended for user consumption---in particular, the syntax varies +depending on the language), and @var{separator-string} is a string +intended to separate this address from what follows for the user's +benefit. + +@findex frame-function-name +@findex frame-args +Then comes + +@smallexample +^Z^Zframe-function-name +@var{function-name} +^Z^Zframe-args +@var{arguments} +@end smallexample + +where @var{function-name} is the name of the function executing in the +frame, or @samp{??} if not known, and @var{arguments} are the arguments +to the frame, with parentheses around them (each argument is annotated +individually as well, @pxref{Value Annotations}). + +@findex frame-source-begin +@findex frame-source-file +@findex frame-source-file-end +@findex frame-source-line +@findex frame-source-end +If source information is available, a reference to it is then printed: + +@smallexample +^Z^Zframe-source-begin +@var{source-intro-string} +^Z^Zframe-source-file +@var{filename} +^Z^Zframe-source-file-end +: +^Z^Zframe-source-line +@var{line-number} +^Z^Zframe-source-end +@end smallexample + +where @var{source-intro-string} separates for the user's benefit the +reference from the text which precedes it, @var{filename} is the name of +the source file, and @var{line-number} is the line number within that +file (the first line is line 1). + +@findex frame-where +If @value{GDBN} prints some information about where the frame is from (which +library, which load segment, etc.; currently only done on the RS/6000), +it is annotated with + +@smallexample +^Z^Zframe-where +@var{information} +@end smallexample + +Then, if source is to actually be displayed for this frame (for example, +this is not true for output from the @code{backtrace} command), then a +@code{source} annotation (@pxref{Source Annotations}) is displayed. Unlike +most annotations, this is output instead of the normal text which would be +output, not in addition. +@end itemize + +@node Displays +@section Displays + +@findex display-begin +@findex display-number-end +@findex display-format +@findex display-expression +@findex display-expression-end +@findex display-value +@findex display-end +@cindex annotations for display +When @value{GDBN} is told to display something using the @code{display} command, +the results of the display are annotated: + +@smallexample +^Z^Zdisplay-begin +@var{number} +^Z^Zdisplay-number-end +@var{number-separator} +^Z^Zdisplay-format +@var{format} +^Z^Zdisplay-expression +@var{expression} +^Z^Zdisplay-expression-end +@var{expression-separator} +^Z^Zdisplay-value +@var{value} +^Z^Zdisplay-end +@end smallexample + +@noindent +where @var{number} is the number of the display, @var{number-separator} +is intended to separate the number from what follows for the user, +@var{format} includes information such as the size, format, or other +information about how the value is being displayed, @var{expression} is +the expression being displayed, @var{expression-separator} is intended +to separate the expression from the text that follows for the user, +and @var{value} is the actual value being displayed. + +@node Prompting +@section Annotation for @value{GDBN} Input + +@cindex annotations for prompts +When @value{GDBN} prompts for input, it annotates this fact so it is possible +to know when to send output, when the output from a given command is +over, etc. + +Different kinds of input each have a different @dfn{input type}. Each +input type has three annotations: a @code{pre-} annotation, which +denotes the beginning of any prompt which is being output, a plain +annotation, which denotes the end of the prompt, and then a @code{post-} +annotation which denotes the end of any echo which may (or may not) be +associated with the input. For example, the @code{prompt} input type +features the following annotations: + +@smallexample +^Z^Zpre-prompt +^Z^Zprompt +^Z^Zpost-prompt +@end smallexample + +The input types are + +@table @code +@findex pre-prompt +@findex prompt +@findex post-prompt +@item prompt +When @value{GDBN} is prompting for a command (the main @value{GDBN} prompt). + +@findex pre-commands +@findex commands +@findex post-commands +@item commands +When @value{GDBN} prompts for a set of commands, like in the @code{commands} +command. The annotations are repeated for each command which is input. + +@findex pre-overload-choice +@findex overload-choice +@findex post-overload-choice +@item overload-choice +When @value{GDBN} wants the user to select between various overloaded functions. + +@findex pre-query +@findex query +@findex post-query +@item query +When @value{GDBN} wants the user to confirm a potentially dangerous operation. + +@findex pre-prompt-for-continue +@findex prompt-for-continue +@findex post-prompt-for-continue +@item prompt-for-continue +When @value{GDBN} is asking the user to press return to continue. Note: Don't +expect this to work well; instead use @code{set height 0} to disable +prompting. This is because the counting of lines is buggy in the +presence of annotations. +@end table + +@node Errors +@section Errors +@cindex annotations for errors, warnings and interrupts + +@findex quit +@smallexample +^Z^Zquit +@end smallexample + +This annotation occurs right before @value{GDBN} responds to an interrupt. + +@findex error +@smallexample +^Z^Zerror +@end smallexample + +This annotation occurs right before @value{GDBN} responds to an error. + +Quit and error annotations indicate that any annotations which @value{GDBN} was +in the middle of may end abruptly. For example, if a +@code{value-history-begin} annotation is followed by a @code{error}, one +cannot expect to receive the matching @code{value-history-end}. One +cannot expect not to receive it either, however; an error annotation +does not necessarily mean that @value{GDBN} is immediately returning all the way +to the top level. + +@findex error-begin +A quit or error annotation may be preceded by + +@smallexample +^Z^Zerror-begin +@end smallexample + +Any output between that and the quit or error annotation is the error +message. + +Warning messages are not yet annotated. +@c If we want to change that, need to fix warning(), type_error(), +@c range_error(), and possibly other places. + +@node Breakpoint Info +@section Information on Breakpoints + +@cindex annotations for breakpoints +The output from the @code{info breakpoints} command is annotated as follows: + +@findex breakpoints-headers +@findex breakpoints-table +@smallexample +^Z^Zbreakpoints-headers +@var{header-entry} +^Z^Zbreakpoints-table +@end smallexample + +@noindent +where @var{header-entry} has the same syntax as an entry (see below) but +instead of containing data, it contains strings which are intended to +convey the meaning of each field to the user. This is followed by any +number of entries. If a field does not apply for this entry, it is +omitted. Fields may contain trailing whitespace. Each entry consists +of: + +@findex record +@findex field +@smallexample +^Z^Zrecord +^Z^Zfield 0 +@var{number} +^Z^Zfield 1 +@var{type} +^Z^Zfield 2 +@var{disposition} +^Z^Zfield 3 +@var{enable} +^Z^Zfield 4 +@var{address} +^Z^Zfield 5 +@var{what} +^Z^Zfield 6 +@var{frame} +^Z^Zfield 7 +@var{condition} +^Z^Zfield 8 +@var{ignore-count} +^Z^Zfield 9 +@var{commands} +@end smallexample + +Note that @var{address} is intended for user consumption---the syntax +varies depending on the language. + +The output ends with + +@findex breakpoints-table-end +@smallexample +^Z^Zbreakpoints-table-end +@end smallexample + +@node Invalidation +@section Invalidation Notices + +@cindex annotations for invalidation messages +The following annotations say that certain pieces of state may have +changed. + +@table @code +@findex frames-invalid +@item ^Z^Zframes-invalid + +The frames (for example, output from the @code{backtrace} command) may +have changed. + +@findex breakpoints-invalid +@item ^Z^Zbreakpoints-invalid + +The breakpoints may have changed. For example, the user just added or +deleted a breakpoint. +@end table + +@node Annotations for Running +@section Running the Program +@cindex annotations for running programs + +@findex starting +@findex stopping +When the program starts executing due to a @value{GDBN} command such as +@code{step} or @code{continue}, + +@smallexample +^Z^Zstarting +@end smallexample + +is output. When the program stops, + +@smallexample +^Z^Zstopped +@end smallexample + +is output. Before the @code{stopped} annotation, a variety of +annotations describe how the program stopped. + +@table @code +@findex exited +@item ^Z^Zexited @var{exit-status} +The program exited, and @var{exit-status} is the exit status (zero for +successful exit, otherwise nonzero). + +@findex signalled +@findex signal-name +@findex signal-name-end +@findex signal-string +@findex signal-string-end +@item ^Z^Zsignalled +The program exited with a signal. After the @code{^Z^Zsignalled}, the +annotation continues: + +@smallexample +@var{intro-text} +^Z^Zsignal-name +@var{name} +^Z^Zsignal-name-end +@var{middle-text} +^Z^Zsignal-string +@var{string} +^Z^Zsignal-string-end +@var{end-text} +@end smallexample + +@noindent +where @var{name} is the name of the signal, such as @code{SIGILL} or +@code{SIGSEGV}, and @var{string} is the explanation of the signal, such +as @code{Illegal Instruction} or @code{Segmentation fault}. +@var{intro-text}, @var{middle-text}, and @var{end-text} are for the +user's benefit and have no particular format. + +@findex signal +@item ^Z^Zsignal +The syntax of this annotation is just like @code{signalled}, but @value{GDBN} is +just saying that the program received the signal, not that it was +terminated with it. + +@findex breakpoint +@item ^Z^Zbreakpoint @var{number} +The program hit breakpoint number @var{number}. + +@findex watchpoint +@item ^Z^Zwatchpoint @var{number} +The program hit watchpoint number @var{number}. +@end table + +@node Source Annotations +@section Displaying Source +@cindex annotations for source display + +@findex source +The following annotation is used instead of displaying source code: + +@smallexample +^Z^Zsource @var{filename}:@var{line}:@var{character}:@var{middle}:@var{addr} +@end smallexample + +where @var{filename} is an absolute file name indicating which source +file, @var{line} is the line number within that file (where 1 is the +first line in the file), @var{character} is the character position +within the file (where 0 is the first character in the file) (for most +debug formats this will necessarily point to the beginning of a line), +@var{middle} is @samp{middle} if @var{addr} is in the middle of the +line, or @samp{beg} if @var{addr} is at the beginning of the line, and +@var{addr} is the address in the target program associated with the +source which is being displayed. @var{addr} is in the form @samp{0x} +followed by one or more lowercase hex digits (note that this does not +depend on the language). + +@node TODO +@section Annotations We Might Want in the Future + +@format + - target-invalid + the target might have changed (registers, heap contents, or + execution status). For performance, we might eventually want + to hit `registers-invalid' and `all-registers-invalid' with + greater precision + + - systematic annotation for set/show parameters (including + invalidation notices). + + - similarly, `info' returns a list of candidates for invalidation + notices. +@end format @node GDB Bugs @chapter Reporting Bugs in @value{GDBN} @@ -14793,6 +19418,7 @@ compiled with the @samp{-pg} compiler option. * General Query Packets:: * Register Packet Format:: * Examples:: +* File-I/O remote protocol extension:: @end menu @node Overview @@ -15017,9 +19643,12 @@ Reserved for future use. Reserved for future use. -@item @code{F} --- reserved +@item @code{F}@var{RC}@code{,}@var{EE}@code{,}@var{CF}@code{;}@var{XX} --- Reply to target's F packet. +@cindex @code{F} packet -Reserved for future use. +This packet is send by @value{GDBN} as reply to a @code{F} request packet +sent by the target. This is part of the File-I/O protocol extension. +@xref{File-I/O remote protocol extension}, for the specification. @item @code{g} --- read registers @anchor{read registers packet} @@ -15518,6 +20147,24 @@ is a query initiated by the host debugger.} any time while the program is running and the debugger should continue to wait for @samp{W}, @samp{T}, etc. +@item F@var{call-id}@code{,}@var{parameter@dots{}} + +@var{call-id} is the identifier which says which host system call should +be called. This is just the name of the function. Translation into the +correct system call is only applicable as it's defined in @value{GDBN}. +@xref{File-I/O remote protocol extension}, for a list of implemented +system calls. + +@var{parameter@dots{}} is a list of parameters as defined for this very +system call. + +The target replies with this packet when it expects @value{GDBN} to call +a host system call on behalf of the target. @value{GDBN} replies with +an appropriate @code{F} packet and keeps up waiting for the next reply +packet from the target. The latest @samp{C}, @samp{c}, @samp{S} or +@samp{s} action is expected to be continued. +@xref{File-I/O remote protocol extension}, for more details. + @end table @node General Query Packets @@ -15760,6 +20407,1149 @@ Example sequence of a target being stepped by a single instruction: -> @code{+} @end smallexample +@node File-I/O remote protocol extension +@section File-I/O remote protocol extension +@cindex File-I/O remote protocol extension + +@menu +* File-I/O Overview:: +* Protocol basics:: +* The `F' request packet:: +* The `F' reply packet:: +* Memory transfer:: +* The Ctrl-C message:: +* Console I/O:: +* The isatty call:: +* The system call:: +* List of supported calls:: +* Protocol specific representation of datatypes:: +* Constants:: +* File-I/O Examples:: +@end menu + +@node File-I/O Overview +@subsection File-I/O Overview +@cindex file-i/o overview + +The File I/O remote protocol extension (short: File-I/O) allows the +target to use the hosts file system and console I/O when calling various +system calls. System calls on the target system are translated into a +remote protocol packet to the host system which then performs the needed +actions and returns with an adequate response packet to the target system. +This simulates file system operations even on targets that lack file systems. + +The protocol is defined host- and target-system independent. It uses +it's own independent representation of datatypes and values. Both, +@value{GDBN} and the target's @value{GDBN} stub are responsible for +translating the system dependent values into the unified protocol values +when data is transmitted. + +The communication is synchronous. A system call is possible only +when GDB is waiting for the @samp{C}, @samp{c}, @samp{S} or @samp{s} +packets. While @value{GDBN} handles the request for a system call, +the target is stopped to allow deterministic access to the target's +memory. Therefore File-I/O is not interuptible by target signals. It +is possible to interrupt File-I/O by a user interrupt (Ctrl-C), though. + +The target's request to perform a host system call does not finish +the latest @samp{C}, @samp{c}, @samp{S} or @samp{s} action. That means, +after finishing the system call, the target returns to continuing the +previous activity (continue, step). No additional continue or step +request from @value{GDBN} is required. + +@smallexample +(gdb) continue + <- target requests 'system call X' + target is stopped, @value{GDBN} executes system call + -> GDB returns result + ... target continues, GDB returns to wait for the target + <- target hits breakpoint and sends a Txx packet +@end smallexample + +The protocol is only used for files on the host file system and +for I/O on the console. Character or block special devices, pipes, +named pipes or sockets or any other communication method on the host +system are not supported by this protocol. + +@node Protocol basics +@subsection Protocol basics +@cindex protocol basics, file-i/o + +The File-I/O protocol uses the @code{F} packet, as request as well +as as reply packet. Since a File-I/O system call can only occur when +@value{GDBN} is waiting for the continuing or stepping target, the +File-I/O request is a reply that @value{GDBN} has to expect as a result +of a former @samp{C}, @samp{c}, @samp{S} or @samp{s} packet. +This @code{F} packet contains all information needed to allow @value{GDBN} +to call the appropriate host system call: + +@itemize @bullet +@item +A unique identifier for the requested system call. + +@item +All parameters to the system call. Pointers are given as addresses +in the target memory address space. Pointers to strings are given as +pointer/length pair. Numerical values are given as they are. +Numerical control values are given in a protocol specific representation. + +@end itemize + +At that point @value{GDBN} has to perform the following actions. + +@itemize @bullet +@item +If parameter pointer values are given, which point to data needed as input +to a system call, @value{GDBN} requests this data from the target with a +standard @code{m} packet request. This additional communication has to be +expected by the target implementation and is handled as any other @code{m} +packet. + +@item +@value{GDBN} translates all value from protocol representation to host +representation as needed. Datatypes are coerced into the host types. + +@item +@value{GDBN} calls the system call + +@item +It then coerces datatypes back to protocol representation. + +@item +If pointer parameters in the request packet point to buffer space in which +a system call is expected to copy data to, the data is transmitted to the +target using a @code{M} or @code{X} packet. This packet has to be expected +by the target implementation and is handled as any other @code{M} or @code{X} +packet. + +@end itemize + +Eventually @value{GDBN} replies with another @code{F} packet which contains all +necessary information for the target to continue. This at least contains + +@itemize @bullet +@item +Return value. + +@item +@code{errno}, if has been changed by the system call. + +@item +``Ctrl-C'' flag. + +@end itemize + +After having done the needed type and value coercion, the target continues +the latest continue or step action. + +@node The `F' request packet +@subsection The @code{F} request packet +@cindex file-i/o request packet +@cindex @code{F} request packet + +The @code{F} request packet has the following format: + +@table @samp + +@smallexample +@code{F}@var{call-id}@code{,}@var{parameter@dots{}} +@end smallexample + +@var{call-id} is the identifier to indicate the host system call to be called. +This is just the name of the function. + +@var{parameter@dots{}} are the parameters to the system call. + +@end table + +Parameters are hexadecimal integer values, either the real values in case +of scalar datatypes, as pointers to target buffer space in case of compound +datatypes and unspecified memory areas or as pointer/length pairs in case +of string parameters. These are appended to the call-id, each separated +from its predecessor by a comma. All values are transmitted in ASCII +string representation, pointer/length pairs separated by a slash. + +@node The `F' reply packet +@subsection The @code{F} reply packet +@cindex file-i/o reply packet +@cindex @code{F} reply packet + +The @code{F} reply packet has the following format: + +@table @samp + +@smallexample +@code{F}@var{retcode}@code{,}@var{errno}@code{,}@var{Ctrl-C flag}@code{;}@var{call specific attachment} +@end smallexample + +@var{retcode} is the return code of the system call as hexadecimal value. + +@var{errno} is the errno set by the call, in protocol specific representation. +This parameter can be omitted if the call was successful. + +@var{Ctrl-C flag} is only send if the user requested a break. In this +case, @var{errno} must be send as well, even if the call was successful. +The @var{Ctrl-C flag} itself consists of the character 'C': + +@smallexample +F0,0,C +@end smallexample + +@noindent +or, if the call was interupted before the host call has been performed: + +@smallexample +F-1,4,C +@end smallexample + +@noindent +assuming 4 is the protocol specific representation of @code{EINTR}. + +@end table + +@node Memory transfer +@subsection Memory transfer +@cindex memory transfer, in file-i/o protocol + +Structured data which is transferred using a memory read or write as e.g.@: +a @code{struct stat} is expected to be in a protocol specific format with +all scalar multibyte datatypes being big endian. This should be done by +the target before the @code{F} packet is sent resp.@: by @value{GDBN} before +it transfers memory to the target. Transferred pointers to structured +data should point to the already coerced data at any time. + +@node The Ctrl-C message +@subsection The Ctrl-C message +@cindex ctrl-c message, in file-i/o protocol + +A special case is, if the @var{Ctrl-C flag} is set in the @value{GDBN} +reply packet. In this case the target should behave, as if it had +gotten a break message. The meaning for the target is ``system call +interupted by @code{SIGINT}''. Consequentially, the target should actually stop +(as with a break message) and return to @value{GDBN} with a @code{T02} +packet. In this case, it's important for the target to know, in which +state the system call was interrupted. Since this action is by design +not an atomic operation, we have to differ between two cases: + +@itemize @bullet +@item +The system call hasn't been performed on the host yet. + +@item +The system call on the host has been finished. + +@end itemize + +These two states can be distinguished by the target by the value of the +returned @code{errno}. If it's the protocol representation of @code{EINTR}, the system +call hasn't been performed. This is equivalent to the @code{EINTR} handling +on POSIX systems. In any other case, the target may presume that the +system call has been finished --- successful or not --- and should behave +as if the break message arrived right after the system call. + +@value{GDBN} must behave reliable. If the system call has not been called +yet, @value{GDBN} may send the @code{F} reply immediately, setting @code{EINTR} as +@code{errno} in the packet. If the system call on the host has been finished +before the user requests a break, the full action must be finshed by +@value{GDBN}. This requires sending @code{M} or @code{X} packets as they fit. +The @code{F} packet may only be send when either nothing has happened +or the full action has been completed. + +@node Console I/O +@subsection Console I/O +@cindex console i/o as part of file-i/o + +By default and if not explicitely closed by the target system, the file +descriptors 0, 1 and 2 are connected to the @value{GDBN} console. Output +on the @value{GDBN} console is handled as any other file output operation +(@code{write(1, @dots{})} or @code{write(2, @dots{})}). Console input is handled +by @value{GDBN} so that after the target read request from file descriptor +0 all following typing is buffered until either one of the following +conditions is met: + +@itemize @bullet +@item +The user presses @kbd{Ctrl-C}. The behaviour is as explained above, the +@code{read} +system call is treated as finished. + +@item +The user presses @kbd{Enter}. This is treated as end of input with a trailing +line feed. + +@item +The user presses @kbd{Ctrl-D}. This is treated as end of input. No trailing +character, especially no Ctrl-D is appended to the input. + +@end itemize + +If the user has typed more characters as fit in the buffer given to +the read call, the trailing characters are buffered in @value{GDBN} until +either another @code{read(0, @dots{})} is requested by the target or debugging +is stopped on users request. + +@node The isatty call +@subsection The isatty(3) call +@cindex isatty call, file-i/o protocol + +A special case in this protocol is the library call @code{isatty} which +is implemented as it's own call inside of this protocol. It returns +1 to the target if the file descriptor given as parameter is attached +to the @value{GDBN} console, 0 otherwise. Implementing through system calls +would require implementing @code{ioctl} and would be more complex than +needed. + +@node The system call +@subsection The system(3) call +@cindex system call, file-i/o protocol + +The other special case in this protocol is the @code{system} call which +is implemented as it's own call, too. @value{GDBN} is taking over the full +task of calling the necessary host calls to perform the @code{system} +call. The return value of @code{system} is simplified before it's returned +to the target. Basically, the only signal transmitted back is @code{EINTR} +in case the user pressed @kbd{Ctrl-C}. Otherwise the return value consists +entirely of the exit status of the called command. + +Due to security concerns, the @code{system} call is refused to be called +by @value{GDBN} by default. The user has to allow this call explicitly by +entering + +@table @samp +@kindex set remote system-call-allowed 1 +@item @code{set remote system-call-allowed 1} +@end table + +Disabling the @code{system} call is done by + +@table @samp +@kindex set remote system-call-allowed 0 +@item @code{set remote system-call-allowed 0} +@end table + +The current setting is shown by typing + +@table @samp +@kindex show remote system-call-allowed +@item @code{show remote system-call-allowed} +@end table + +@node List of supported calls +@subsection List of supported calls +@cindex list of supported file-i/o calls + +@menu +* open:: +* close:: +* read:: +* write:: +* lseek:: +* rename:: +* unlink:: +* stat/fstat:: +* gettimeofday:: +* isatty:: +* system:: +@end menu + +@node open +@unnumberedsubsubsec open +@cindex open, file-i/o system call + +@smallexample +@exdent Synopsis: +int open(const char *pathname, int flags); +int open(const char *pathname, int flags, mode_t mode); + +@exdent Request: +Fopen,pathptr/len,flags,mode +@end smallexample + +@noindent +@code{flags} is the bitwise or of the following values: + +@table @code +@item O_CREAT +If the file does not exist it will be created. The host +rules apply as far as file ownership and time stamps +are concerned. + +@item O_EXCL +When used with O_CREAT, if the file already exists it is +an error and open() fails. + +@item O_TRUNC +If the file already exists and the open mode allows +writing (O_RDWR or O_WRONLY is given) it will be +truncated to length 0. + +@item O_APPEND +The file is opened in append mode. + +@item O_RDONLY +The file is opened for reading only. + +@item O_WRONLY +The file is opened for writing only. + +@item O_RDWR +The file is opened for reading and writing. + +@noindent +Each other bit is silently ignored. + +@end table + +@noindent +@code{mode} is the bitwise or of the following values: + +@table @code +@item S_IRUSR +User has read permission. + +@item S_IWUSR +User has write permission. + +@item S_IRGRP +Group has read permission. + +@item S_IWGRP +Group has write permission. + +@item S_IROTH +Others have read permission. + +@item S_IWOTH +Others have write permission. + +@noindent +Each other bit is silently ignored. + +@end table + +@smallexample +@exdent Return value: +open returns the new file descriptor or -1 if an error +occured. + +@exdent Errors: +@end smallexample + +@table @code +@item EEXIST +pathname already exists and O_CREAT and O_EXCL were used. + +@item EISDIR +pathname refers to a directory. + +@item EACCES +The requested access is not allowed. + +@item ENAMETOOLONG +pathname was too long. + +@item ENOENT +A directory component in pathname does not exist. + +@item ENODEV +pathname refers to a device, pipe, named pipe or socket. + +@item EROFS +pathname refers to a file on a read-only filesystem and +write access was requested. + +@item EFAULT +pathname is an invalid pointer value. + +@item ENOSPC +No space on device to create the file. + +@item EMFILE +The process already has the maximum number of files open. + +@item ENFILE +The limit on the total number of files open on the system +has been reached. + +@item EINTR +The call was interrupted by the user. +@end table + +@node close +@unnumberedsubsubsec close +@cindex close, file-i/o system call + +@smallexample +@exdent Synopsis: +int close(int fd); + +@exdent Request: +Fclose,fd + +@exdent Return value: +close returns zero on success, or -1 if an error occurred. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd isn't a valid open file descriptor. + +@item EINTR +The call was interrupted by the user. +@end table + +@node read +@unnumberedsubsubsec read +@cindex read, file-i/o system call + +@smallexample +@exdent Synopsis: +int read(int fd, void *buf, unsigned int count); + +@exdent Request: +Fread,fd,bufptr,count + +@exdent Return value: +On success, the number of bytes read is returned. +Zero indicates end of file. If count is zero, read +returns zero as well. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid file descriptor or is not open for +reading. + +@item EFAULT +buf is an invalid pointer value. + +@item EINTR +The call was interrupted by the user. +@end table + +@node write +@unnumberedsubsubsec write +@cindex write, file-i/o system call + +@smallexample +@exdent Synopsis: +int write(int fd, const void *buf, unsigned int count); + +@exdent Request: +Fwrite,fd,bufptr,count + +@exdent Return value: +On success, the number of bytes written are returned. +Zero indicates nothing was written. On error, -1 +is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid file descriptor or is not open for +writing. + +@item EFAULT +buf is an invalid pointer value. + +@item EFBIG +An attempt was made to write a file that exceeds the +host specific maximum file size allowed. + +@item ENOSPC +No space on device to write the data. + +@item EINTR +The call was interrupted by the user. +@end table + +@node lseek +@unnumberedsubsubsec lseek +@cindex lseek, file-i/o system call + +@smallexample +@exdent Synopsis: +long lseek (int fd, long offset, int flag); + +@exdent Request: +Flseek,fd,offset,flag +@end smallexample + +@code{flag} is one of: + +@table @code +@item SEEK_SET +The offset is set to offset bytes. + +@item SEEK_CUR +The offset is set to its current location plus offset +bytes. + +@item SEEK_END +The offset is set to the size of the file plus offset +bytes. +@end table + +@smallexample +@exdent Return value: +On success, the resulting unsigned offset in bytes from +the beginning of the file is returned. Otherwise, a +value of -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid open file descriptor. + +@item ESPIPE +fd is associated with the @value{GDBN} console. + +@item EINVAL +flag is not a proper value. + +@item EINTR +The call was interrupted by the user. +@end table + +@node rename +@unnumberedsubsubsec rename +@cindex rename, file-i/o system call + +@smallexample +@exdent Synopsis: +int rename(const char *oldpath, const char *newpath); + +@exdent Request: +Frename,oldpathptr/len,newpathptr/len + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EISDIR +newpath is an existing directory, but oldpath is not a +directory. + +@item EEXIST +newpath is a non-empty directory. + +@item EBUSY +oldpath or newpath is a directory that is in use by some +process. + +@item EINVAL +An attempt was made to make a directory a subdirectory +of itself. + +@item ENOTDIR +A component used as a directory in oldpath or new +path is not a directory. Or oldpath is a directory +and newpath exists but is not a directory. + +@item EFAULT +oldpathptr or newpathptr are invalid pointer values. + +@item EACCES +No access to the file or the path of the file. + +@item ENAMETOOLONG + +oldpath or newpath was too long. + +@item ENOENT +A directory component in oldpath or newpath does not exist. + +@item EROFS +The file is on a read-only filesystem. + +@item ENOSPC +The device containing the file has no room for the new +directory entry. + +@item EINTR +The call was interrupted by the user. +@end table + +@node unlink +@unnumberedsubsubsec unlink +@cindex unlink, file-i/o system call + +@smallexample +@exdent Synopsis: +int unlink(const char *pathname); + +@exdent Request: +Funlink,pathnameptr/len + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EACCES +No access to the file or the path of the file. + +@item EPERM +The system does not allow unlinking of directories. + +@item EBUSY +The file pathname cannot be unlinked because it's +being used by another process. + +@item EFAULT +pathnameptr is an invalid pointer value. + +@item ENAMETOOLONG +pathname was too long. + +@item ENOENT +A directory component in pathname does not exist. + +@item ENOTDIR +A component of the path is not a directory. + +@item EROFS +The file is on a read-only filesystem. + +@item EINTR +The call was interrupted by the user. +@end table + +@node stat/fstat +@unnumberedsubsubsec stat/fstat +@cindex fstat, file-i/o system call +@cindex stat, file-i/o system call + +@smallexample +@exdent Synopsis: +int stat(const char *pathname, struct stat *buf); +int fstat(int fd, struct stat *buf); + +@exdent Request: +Fstat,pathnameptr/len,bufptr +Ffstat,fd,bufptr + +@exdent Return value: +On success, zero is returned. On error, -1 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EBADF +fd is not a valid open file. + +@item ENOENT +A directory component in pathname does not exist or the +path is an empty string. + +@item ENOTDIR +A component of the path is not a directory. + +@item EFAULT +pathnameptr is an invalid pointer value. + +@item EACCES +No access to the file or the path of the file. + +@item ENAMETOOLONG +pathname was too long. + +@item EINTR +The call was interrupted by the user. +@end table + +@node gettimeofday +@unnumberedsubsubsec gettimeofday +@cindex gettimeofday, file-i/o system call + +@smallexample +@exdent Synopsis: +int gettimeofday(struct timeval *tv, void *tz); + +@exdent Request: +Fgettimeofday,tvptr,tzptr + +@exdent Return value: +On success, 0 is returned, -1 otherwise. + +@exdent Errors: +@end smallexample + +@table @code +@item EINVAL +tz is a non-NULL pointer. + +@item EFAULT +tvptr and/or tzptr is an invalid pointer value. +@end table + +@node isatty +@unnumberedsubsubsec isatty +@cindex isatty, file-i/o system call + +@smallexample +@exdent Synopsis: +int isatty(int fd); + +@exdent Request: +Fisatty,fd + +@exdent Return value: +Returns 1 if fd refers to the @value{GDBN} console, 0 otherwise. + +@exdent Errors: +@end smallexample + +@table @code +@item EINTR +The call was interrupted by the user. +@end table + +@node system +@unnumberedsubsubsec system +@cindex system, file-i/o system call + +@smallexample +@exdent Synopsis: +int system(const char *command); + +@exdent Request: +Fsystem,commandptr/len + +@exdent Return value: +The value returned is -1 on error and the return status +of the command otherwise. Only the exit status of the +command is returned, which is extracted from the hosts +system return value by calling WEXITSTATUS(retval). +In case /bin/sh could not be executed, 127 is returned. + +@exdent Errors: +@end smallexample + +@table @code +@item EINTR +The call was interrupted by the user. +@end table + +@node Protocol specific representation of datatypes +@subsection Protocol specific representation of datatypes +@cindex protocol specific representation of datatypes, in file-i/o protocol + +@menu +* Integral datatypes:: +* Pointer values:: +* struct stat:: +* struct timeval:: +@end menu + +@node Integral datatypes +@unnumberedsubsubsec Integral datatypes +@cindex integral datatypes, in file-i/o protocol + +The integral datatypes used in the system calls are + +@smallexample +int@r{,} unsigned int@r{,} long@r{,} unsigned long@r{,} mode_t @r{and} time_t +@end smallexample + +@code{Int}, @code{unsigned int}, @code{mode_t} and @code{time_t} are +implemented as 32 bit values in this protocol. + +@code{Long} and @code{unsigned long} are implemented as 64 bit types. + +@xref{Limits}, for corresponding MIN and MAX values (similar to those +in @file{limits.h}) to allow range checking on host and target. + +@code{time_t} datatypes are defined as seconds since the Epoch. + +All integral datatypes transferred as part of a memory read or write of a +structured datatype e.g.@: a @code{struct stat} have to be given in big endian +byte order. + +@node Pointer values +@unnumberedsubsubsec Pointer values +@cindex pointer values, in file-i/o protocol + +Pointers to target data are transmitted as they are. An exception +is made for pointers to buffers for which the length isn't +transmitted as part of the function call, namely strings. Strings +are transmitted as a pointer/length pair, both as hex values, e.g.@: + +@smallexample +@code{1aaf/12} +@end smallexample + +@noindent +which is a pointer to data of length 18 bytes at position 0x1aaf. +The length is defined as the full string length in bytes, including +the trailing null byte. Example: + +@smallexample +``hello, world'' at address 0x123456 +@end smallexample + +@noindent +is transmitted as + +@smallexample +@code{123456/d} +@end smallexample + +@node struct stat +@unnumberedsubsubsec struct stat +@cindex struct stat, in file-i/o protocol + +The buffer of type struct stat used by the target and @value{GDBN} is defined +as follows: + +@smallexample +struct stat @{ + unsigned int st_dev; /* device */ + unsigned int st_ino; /* inode */ + mode_t st_mode; /* protection */ + unsigned int st_nlink; /* number of hard links */ + unsigned int st_uid; /* user ID of owner */ + unsigned int st_gid; /* group ID of owner */ + unsigned int st_rdev; /* device type (if inode device) */ + unsigned long st_size; /* total size, in bytes */ + unsigned long st_blksize; /* blocksize for filesystem I/O */ + unsigned long st_blocks; /* number of blocks allocated */ + time_t st_atime; /* time of last access */ + time_t st_mtime; /* time of last modification */ + time_t st_ctime; /* time of last change */ +@}; +@end smallexample + +The integral datatypes are conforming to the definitions given in the +approriate section (see @ref{Integral datatypes}, for details) so this +structure is of size 64 bytes. + +The values of several fields have a restricted meaning and/or +range of values. + +@smallexample +st_dev: 0 file + 1 console + +st_ino: No valid meaning for the target. Transmitted unchanged. + +st_mode: Valid mode bits are described in Appendix C. Any other + bits have currently no meaning for the target. + +st_uid: No valid meaning for the target. Transmitted unchanged. + +st_gid: No valid meaning for the target. Transmitted unchanged. + +st_rdev: No valid meaning for the target. Transmitted unchanged. + +st_atime, st_mtime, st_ctime: + These values have a host and file system dependent + accuracy. Especially on Windows hosts the file systems + don't support exact timing values. +@end smallexample + +The target gets a struct stat of the above representation and is +responsible to coerce it to the target representation before +continuing. + +Note that due to size differences between the host and target +representation of stat members, these members could eventually +get truncated on the target. + +@node struct timeval +@unnumberedsubsubsec struct timeval +@cindex struct timeval, in file-i/o protocol + +The buffer of type struct timeval used by the target and @value{GDBN} +is defined as follows: + +@smallexample +struct timeval @{ + time_t tv_sec; /* second */ + long tv_usec; /* microsecond */ +@}; +@end smallexample + +The integral datatypes are conforming to the definitions given in the +approriate section (see @ref{Integral datatypes}, for details) so this +structure is of size 8 bytes. + +@node Constants +@subsection Constants +@cindex constants, in file-i/o protocol + +The following values are used for the constants inside of the +protocol. @value{GDBN} and target are resposible to translate these +values before and after the call as needed. + +@menu +* Open flags:: +* mode_t values:: +* Errno values:: +* Lseek flags:: +* Limits:: +@end menu + +@node Open flags +@unnumberedsubsubsec Open flags +@cindex open flags, in file-i/o protocol + +All values are given in hexadecimal representation. + +@smallexample + O_RDONLY 0x0 + O_WRONLY 0x1 + O_RDWR 0x2 + O_APPEND 0x8 + O_CREAT 0x200 + O_TRUNC 0x400 + O_EXCL 0x800 +@end smallexample + +@node mode_t values +@unnumberedsubsubsec mode_t values +@cindex mode_t values, in file-i/o protocol + +All values are given in octal representation. + +@smallexample + S_IFREG 0100000 + S_IFDIR 040000 + S_IRUSR 0400 + S_IWUSR 0200 + S_IXUSR 0100 + S_IRGRP 040 + S_IWGRP 020 + S_IXGRP 010 + S_IROTH 04 + S_IWOTH 02 + S_IXOTH 01 +@end smallexample + +@node Errno values +@unnumberedsubsubsec Errno values +@cindex errno values, in file-i/o protocol + +All values are given in decimal representation. + +@smallexample + EPERM 1 + ENOENT 2 + EINTR 4 + EBADF 9 + EACCES 13 + EFAULT 14 + EBUSY 16 + EEXIST 17 + ENODEV 19 + ENOTDIR 20 + EISDIR 21 + EINVAL 22 + ENFILE 23 + EMFILE 24 + EFBIG 27 + ENOSPC 28 + ESPIPE 29 + EROFS 30 + ENAMETOOLONG 91 + EUNKNOWN 9999 +@end smallexample + + EUNKNOWN is used as a fallback error value if a host system returns + any error value not in the list of supported error numbers. + +@node Lseek flags +@unnumberedsubsubsec Lseek flags +@cindex lseek flags, in file-i/o protocol + +@smallexample + SEEK_SET 0 + SEEK_CUR 1 + SEEK_END 2 +@end smallexample + +@node Limits +@unnumberedsubsubsec Limits +@cindex limits, in file-i/o protocol + +All values are given in decimal representation. + +@smallexample + INT_MIN -2147483648 + INT_MAX 2147483647 + UINT_MAX 4294967295 + LONG_MIN -9223372036854775808 + LONG_MAX 9223372036854775807 + ULONG_MAX 18446744073709551615 +@end smallexample + +@node File-I/O Examples +@subsection File-I/O Examples +@cindex file-i/o examples + +Example sequence of a write call, file descriptor 3, buffer is at target +address 0x1234, 6 bytes should be written: + +@smallexample +<- @code{Fwrite,3,1234,6} +@emph{request memory read from target} +-> @code{m1234,6} +<- XXXXXX +@emph{return "6 bytes written"} +-> @code{F6} +@end smallexample + +Example sequence of a read call, file descriptor 3, buffer is at target +address 0x1234, 6 bytes should be read: + +@smallexample +<- @code{Fread,3,1234,6} +@emph{request memory write to target} +-> @code{X1234,6:XXXXXX} +@emph{return "6 bytes read"} +-> @code{F6} +@end smallexample + +Example sequence of a read call, call fails on the host due to invalid +file descriptor (EBADF): + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{F-1,9} +@end smallexample + +Example sequence of a read call, user presses Ctrl-C before syscall on +host is called: + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{F-1,4,C} +<- @code{T02} +@end smallexample + +Example sequence of a read call, user presses Ctrl-C after syscall on +host is called: + +@smallexample +<- @code{Fread,3,1234,6} +-> @code{X1234,6:XXXXXX} +<- @code{T02} +@end smallexample + @include gpl.texi @include fdl.texi diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 9776a35..4ca81f6 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -94,6 +94,7 @@ as the mechanisms that adapt @value{GDBN} to specific hosts and targets. * Testsuite:: * Hints:: +* GDB Observers:: @value{GDBN} Currently available observers * GNU Free Documentation License:: The license for this documentation * Index:: @end menu @@ -252,9 +253,9 @@ if it is defined; that is where you should use the @code{FP_REGNUM} value, if your frames are nonstandard.) @cindex frame chain -Given a @value{GDBN} frame, define @code{FRAME_CHAIN} to determine the -address of the calling function's frame. This will be used to create a -new @value{GDBN} frame struct, and then +Given a @value{GDBN} frame, define @code{DEPRECATED_FRAME_CHAIN} to +determine the address of the calling function's frame. This will be +used to create a new @value{GDBN} frame struct, and then @code{DEPRECATED_INIT_EXTRA_FRAME_INFO} and @code{DEPRECATED_INIT_FRAME_PC} will be called for the new frame. @@ -696,6 +697,29 @@ watchpoints might interfere with the underlying OS and are probably unavailable in many platforms. @end enumerate +@section Observing changes in @value{GDBN} internals +@cindex observer pattern interface +@cindex notifications about changes in internals + +In order to function properly, several modules need to be notified when +some changes occur in the @value{GDBN} internals. Traditionally, these +modules have relied on several paradigms, the most common ones being +hooks and gdb-events. Unfortunately, none of these paradigms was +versatile enough to become the standard notification mechanism in +@value{GDBN}. The fact that they only supported one ``client'' was also +a strong limitation. + +A new paradigm, based on the Observer pattern of the @cite{Design +Patterns} book, has therefore been implemented. The goal was to provide +a new interface overcoming the issues with the notification mechanisms +previously available. This new interface needed to be strongly typed, +easy to extend, and versatile enough to be used as the standard +interface when adding new notifications. + +See @ref{GDB Observers} for a brief description of the observers +currently implemented in GDB. The rationale for the current +implementation is also briefly discussed. + @node User Interface @chapter User Interface @@ -3060,11 +3084,6 @@ custom breakpoint insertion and removal routines if @code{BREAKPOINT_FROM_PC} needs to read the target's memory for some reason. -@item CALL_DUMMY_P -@findex CALL_DUMMY_P -A C expression that is non-zero when the target supports inferior function -calls. - @item CALL_DUMMY_WORDS @findex CALL_DUMMY_WORDS Pointer to an array of @code{LONGEST} words of data containing @@ -3077,8 +3096,8 @@ data. @item SIZEOF_CALL_DUMMY_WORDS @findex SIZEOF_CALL_DUMMY_WORDS -The size of @code{CALL_DUMMY_WORDS}. When @code{CALL_DUMMY_P} this must -return a positive value. See also @code{CALL_DUMMY_LENGTH}. +The size of @code{CALL_DUMMY_WORDS}. This must return a positive value. +See also @code{CALL_DUMMY_LENGTH}. @item CALL_DUMMY @findex CALL_DUMMY @@ -3088,17 +3107,11 @@ A static initializer for @code{CALL_DUMMY_WORDS}. Deprecated. @findex CALL_DUMMY_LOCATION See the file @file{inferior.h}. -@item CALL_DUMMY_STACK_ADJUST -@findex CALL_DUMMY_STACK_ADJUST -Stack adjustment needed when performing an inferior function call. - -Should be deprecated in favor of something like @code{STACK_ALIGN}. - -@item CALL_DUMMY_STACK_ADJUST_P -@findex CALL_DUMMY_STACK_ADJUST_P -Predicate for use of @code{CALL_DUMMY_STACK_ADJUST}. - -Should be deprecated in favor of something like @code{STACK_ALIGN}. +@item DEPRECATED_CALL_DUMMY_STACK_ADJUST +@findex DEPRECATED_CALL_DUMMY_STACK_ADJUST +Stack adjustment needed when performing an inferior function call. This +function is no longer needed. @xref{push_dummy_call}, which can handle +all alignment directly. @item CANNOT_FETCH_REGISTER (@var{regno}) @findex CANNOT_FETCH_REGISTER @@ -3239,12 +3252,12 @@ By default, no frame based stack alignment is performed. @findex FRAME_ARGS_ADDRESS_CORRECT See @file{stack.c}. -@item FRAME_CHAIN(@var{frame}) -@findex FRAME_CHAIN +@item DEPRECATED_FRAME_CHAIN(@var{frame}) +@findex DEPRECATED_FRAME_CHAIN Given @var{frame}, return a pointer to the calling frame. -@item FRAME_CHAIN_VALID(@var{chain}, @var{thisframe}) -@findex FRAME_CHAIN_VALID +@item DEPRECATED_FRAME_CHAIN_VALID(@var{chain}, @var{thisframe}) +@findex DEPRECATED_FRAME_CHAIN_VALID Define this to be an expression that returns zero if the given frame is an outermost frame, with no caller, and nonzero otherwise. Most normal situations can be handled without defining this macro, including @code{NULL} @@ -3260,7 +3273,7 @@ current stack frame storing each in @code{frame->saved_regs}. Space for @code{DEPRECATED_FRAME_INIT_SAVED_REGS} using @code{frame_saved_regs_zalloc}. -@code{FRAME_FIND_SAVED_REGS} and @code{EXTRA_FRAME_INFO} are deprecated. +@code{FRAME_FIND_SAVED_REGS} is deprecated. @item FRAME_NUM_ARGS (@var{fi}) @findex FRAME_NUM_ARGS @@ -3268,10 +3281,30 @@ For the frame described by @var{fi} return the number of arguments that are being passed. If the number of arguments is not known, return @code{-1}. -@item FRAME_SAVED_PC(@var{frame}) -@findex FRAME_SAVED_PC -Given @var{frame}, return the pc saved there. This is the return -address. +@item DEPRECATED_FRAME_SAVED_PC(@var{frame}) +@findex DEPRECATED_FRAME_SAVED_PC +@anchor{DEPRECATED_FRAME_SAVED_PC} Given @var{frame}, return the pc +saved there. This is the return address. + +This method is deprecated. @xref{unwind_pc}. + +@item CORE_ADDR unwind_pc (struct frame_info *@var{this_frame}) +@findex unwind_pc +@anchor{unwind_pc} Return the instruction address, in @var{this_frame}'s +caller, at which execution will resume after @var{this_frame} returns. +This is commonly refered to as the return address. + +The implementation, which must be frame agnostic (work with any frame), +is typically no more than: + +@smallexample +ULONGEST pc; +frame_unwind_unsigned_register (this_frame, D10V_PC_REGNUM, &pc); +return d10v_make_iaddr (pc); +@end smallexample + +@noindent +@xref{DEPRECATED_FRAME_SAVED_PC}, which this method replaces. @item FUNCTION_EPILOGUE_SIZE @findex FUNCTION_EPILOGUE_SIZE @@ -3332,11 +3365,10 @@ assuming that we have just stopped at a @code{longjmp} breakpoint. It takes a @code{CORE_ADDR *} as argument, and stores the target PC value through this pointer. It examines the current state of the machine as needed. -@item GET_SAVED_REGISTER -@findex GET_SAVED_REGISTER -@findex get_saved_register +@item DEPRECATED_GET_SAVED_REGISTER +@findex DEPRECATED_GET_SAVED_REGISTER Define this if you need to supply your own definition for the function -@code{get_saved_register}. +@code{DEPRECATED_GET_SAVED_REGISTER}. @item IBM6000_TARGET @findex IBM6000_TARGET @@ -3642,11 +3674,6 @@ The number of the ``next program counter'' register, if defined. If non-zero, round arguments to a boundary of this many bits before pushing them on the stack. -@item PRINT_TYPELESS_INTEGER -@findex PRINT_TYPELESS_INTEGER -This is an obscure substitute for @code{print_longest} that seems to -have been defined for the Convex target. - @item PROCESS_LINENUMBER_HOOK @findex PROCESS_LINENUMBER_HOOK A hook defined for XCOFF reading. @@ -3660,20 +3687,27 @@ A hook defined for XCOFF reading. If defined, this is the number of the processor status register. (This definition is only used in generic code when parsing "$ps".) -@item POP_FRAME -@findex POP_FRAME -@findex call_function_by_hand -@findex return_command -Used in @samp{call_function_by_hand} to remove an artificial stack -frame and in @samp{return_command} to remove a real stack frame. +@item DEPRECATED_POP_FRAME +@findex DEPRECATED_POP_FRAME +@findex frame_pop +If defined, used by @code{frame_pop} to remove a stack frame. This +method has been superseeded by generic code. -@item PUSH_ARGUMENTS (@var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr}) -@findex PUSH_ARGUMENTS -Define this to push arguments onto the stack for inferior function -call. Returns the updated stack pointer value. +@item push_dummy_call (@var{gdbarch}, @var{regcache}, @var{dummy_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr}) +@findex push_dummy_call +@findex DEPRECATED_PUSH_ARGUMENTS. +@anchor{push_dummy_call} +Define this to push the dummy frame's call to the inferior function onto +the stack. In addition to pushing @var{nargs}, the code should push +@var{struct_addr} (when @var{struct_return}), and the return value (in +the call dummy at @var{dummy_addr}). -@item PUSH_DUMMY_FRAME -@findex PUSH_DUMMY_FRAME +Returns the updated top-of-stack pointer. + +This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}. + +@item DEPRECATED_PUSH_DUMMY_FRAME +@findex DEPRECATED_PUSH_DUMMY_FRAME Used in @samp{call_function_by_hand} to create an artificial stack frame. @item REGISTER_BYTES @@ -3697,10 +3731,11 @@ rather than directly. @item SAVE_DUMMY_FRAME_TOS (@var{sp}) @findex SAVE_DUMMY_FRAME_TOS -Used in @samp{call_function_by_hand} to notify the target dependent code -of the top-of-stack value that will be passed to the the inferior code. -This is the value of the @code{SP} after both the dummy frame and space -for parameters/results have been allocated on the stack. +@anchor{SAVE_DUMMY_FRAME_TOS} Used in @samp{call_function_by_hand} to +notify the target dependent code of the top-of-stack value that will be +passed to the the inferior code. This is the value of the @code{SP} +after both the dummy frame and space for parameters/results have been +allocated on the stack. @xref{unwind_dummy_id}. @item SDB_REG_TO_REGNUM @findex SDB_REG_TO_REGNUM @@ -3732,10 +3767,8 @@ that is at the start of the real function. @item SP_REGNUM @findex SP_REGNUM If the stack-pointer is kept in a register, then define this macro to be -the number (greater than or equal to zero) of that register. - -This should only need to be defined if @code{TARGET_WRITE_SP} and -@code{TARGET_WRITE_SP} are not defined. +the number (greater than or equal to zero) of that register, or -1 if +there is no such register. @item STAB_REG_TO_REGNUM @findex STAB_REG_TO_REGNUM @@ -3842,19 +3875,16 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}. @findex TARGET_WRITE_PC @itemx TARGET_READ_SP @findex TARGET_READ_SP -@itemx TARGET_WRITE_SP -@findex TARGET_WRITE_SP @itemx TARGET_READ_FP @findex TARGET_READ_FP @findex read_pc @findex write_pc @findex read_sp -@findex write_sp @findex read_fp These change the behavior of @code{read_pc}, @code{write_pc}, -@code{read_sp}, @code{write_sp} and @code{read_fp}. For most targets, -these may be left undefined. @value{GDBN} will call the read and write -register functions with the relevant @code{_REGNUM} argument. +@code{read_sp} and @code{read_fp}. For most targets, these may be left +undefined. @value{GDBN} will call the read and write register functions +with the relevant @code{_REGNUM} argument. These macros are useful when a target keeps one of these registers in a hard to get at place; for example, part in a segment register and part @@ -3884,6 +3914,14 @@ 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 +@anchor{unwind_dummy_id} Given @var{frame} return a @code{struct +frame_id} that uniquely identifies an inferior function call's dummy +frame. The value returned must match the dummy frame stack value +previously saved using @code{SAVE_DUMMY_FRAME_TOS}. +@xref{SAVE_DUMMY_FRAME_TOS}. + @item USE_STRUCT_CONVENTION (@var{gcc_p}, @var{type}) @findex USE_STRUCT_CONVENTION If defined, this must be an expression that is nonzero if a value of the @@ -4100,8 +4138,6 @@ Add the macro @code{GDB_MULTI_ARCH}, defined as 0 (zero), to the file@* Some mechanisms do not work with multi-arch. They include: @table @code -@item EXTRA_FRAME_INFO -Delete. @item FRAME_FIND_SAVED_REGS Replaced with @code{DEPRECATED_FRAME_INIT_SAVED_REGS} @end table @@ -6568,6 +6604,7 @@ is so old that it has never been converted to use BFD. Now that's old! @end table +@include observer.texi @include fdl.texi @node Index diff --git a/gdb/doublest.c b/gdb/doublest.c index e601a4d..101240b 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -1,7 +1,8 @@ /* Floating point routines for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, + 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -633,6 +634,14 @@ floatformat_from_length (int len) return TARGET_DOUBLE_FORMAT; else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT) return TARGET_LONG_DOUBLE_FORMAT; + /* On i386 the 'long double' type takes 96 bits, + while the real number of used bits is only 80, + both in processor and in memory. + The code below accepts the real bit size. */ + else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) + && (len * TARGET_CHAR_BIT == + TARGET_LONG_DOUBLE_FORMAT->totalsize)) + return TARGET_LONG_DOUBLE_FORMAT; return NULL; } @@ -655,8 +664,8 @@ floatformat_from_type (const struct type *type) /* Extract a floating-point number of length LEN from a target-order byte-stream at ADDR. Returns the value as type DOUBLEST. */ -DOUBLEST -extract_floating (const void *addr, int len) +static DOUBLEST +extract_floating_by_length (const void *addr, int len) { const struct floatformat *fmt = floatformat_from_length (len); DOUBLEST val; @@ -671,11 +680,17 @@ extract_floating (const void *addr, int len) return val; } +DOUBLEST +deprecated_extract_floating (const void *addr, int len) +{ + return extract_floating_by_length (addr, len); +} + /* Store VAL as a floating-point number of length LEN to a target-order byte-stream at ADDR. */ -void -store_floating (void *addr, int len, DOUBLEST val) +static void +store_floating_by_length (void *addr, int len, DOUBLEST val) { const struct floatformat *fmt = floatformat_from_length (len); @@ -689,6 +704,12 @@ store_floating (void *addr, int len, DOUBLEST val) floatformat_from_doublest (fmt, &val, addr); } +void +deprecated_store_floating (void *addr, int len, DOUBLEST val) +{ + store_floating_by_length (addr, len, val); +} + /* Extract a floating-point number of type TYPE from a target-order byte-stream at ADDR. Returns the value as type DOUBLEST. */ @@ -700,7 +721,9 @@ extract_typed_floating (const void *addr, const struct type *type) gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); if (TYPE_FLOATFORMAT (type) == NULL) - return extract_floating (addr, TYPE_LENGTH (type)); + /* Not all code remembers to set the FLOATFORMAT (language + specific code? stabs?) so handle that here as a special case. */ + return extract_floating_by_length (addr, TYPE_LENGTH (type)); floatformat_to_doublest (TYPE_FLOATFORMAT (type), addr, &retval); return retval; @@ -735,7 +758,9 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val) memset (addr, 0, TYPE_LENGTH (type)); if (TYPE_FLOATFORMAT (type) == NULL) - store_floating (addr, TYPE_LENGTH (type), val); + /* Not all code remembers to set the FLOATFORMAT (language + specific code? stabs?) so handle that here as a special case. */ + store_floating_by_length (addr, TYPE_LENGTH (type), val); else floatformat_from_doublest (TYPE_FLOATFORMAT (type), &val, addr); } diff --git a/gdb/doublest.h b/gdb/doublest.h index 920d702..668efa7 100644 --- a/gdb/doublest.h +++ b/gdb/doublest.h @@ -1,7 +1,8 @@ /* Floating point definitions for GDB. - Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, + 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, + Inc. This file is part of GDB. @@ -23,6 +24,8 @@ #ifndef DOUBLEST_H #define DOUBLEST_H +struct type; + /* Setup definitions for host and target floating point formats. We need to consider the format for `float', `double', and `long double' for both target and host. We need to do this so that we know what kind of conversions need @@ -59,12 +62,16 @@ extern int floatformat_is_negative (const struct floatformat *, char *); extern int floatformat_is_nan (const struct floatformat *, char *); extern char *floatformat_mantissa (const struct floatformat *, char *); -/* These two functions are deprecated in favour of - extract_typed_floating and store_typed_floating. See comments in - 'doublest.c' for details. */ +/* These functions have been replaced by extract_typed_floating and + store_typed_floating. + + Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to + just pass the TYPE. The remainder pass in the length of a + register, those calls should instead pass in the floating point + type that corresponds to that length. */ -extern DOUBLEST extract_floating (const void *addr, int len); -extern void store_floating (void *addr, int len, DOUBLEST val); +extern DOUBLEST deprecated_extract_floating (const void *addr, int len); +extern void deprecated_store_floating (void *addr, int len, DOUBLEST val); /* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return NULL. type_floatformat() detects that and returns a floatformat diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 5b63830..a320b7d 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -30,6 +30,10 @@ #include "gdb_assert.h" #include "frame-unwind.h" +static void dummy_frame_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id); + /* Dummy frame. This saves the processor state just prior to setting up the inferior function call. Older targets save the registers on the target stack (but that really slows down function calls). */ @@ -104,14 +108,6 @@ find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) return NULL; } -struct dummy_frame * -cached_find_dummy_frame (struct frame_info *frame, void **cache) -{ - if ((*cache) == NULL) - (*cache) = find_dummy_frame (get_frame_pc (frame), get_frame_base (frame)); - return (*cache); -} - struct regcache * generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) { @@ -282,37 +278,6 @@ discard_innermost_dummy (struct dummy_frame **stack) xfree (tbd); } -/* Function: dummy_frame_pop. Restore the machine state from a saved - dummy stack frame. */ - -static void -dummy_frame_pop (struct frame_info *fi, void **cache, - struct regcache *regcache) -{ - struct dummy_frame *dummy = cached_find_dummy_frame (fi, cache); - - /* If it isn't, what are we even doing here? */ - gdb_assert (get_frame_type (fi) == DUMMY_FRAME); - - if (dummy == NULL) - error ("Can't pop dummy frame!"); - - /* Discard all dummy frames up-to but not including this one. */ - while (dummy_frame_stack != dummy) - discard_innermost_dummy (&dummy_frame_stack); - - /* Restore this one. */ - regcache_cpy (regcache, dummy->regcache); - flush_cached_frames (); - - /* Now discard it. */ - discard_innermost_dummy (&dummy_frame_stack); - - /* Note: target changed would be better. Registers, memory and - frame are all invalid. */ - flush_cached_frames (); -} - void generic_pop_dummy_frame (void) { @@ -329,27 +294,23 @@ generic_pop_dummy_frame (void) discard_innermost_dummy (&dummy_frame_stack); } -/* Function: fix_call_dummy - Stub function. Generic dummy frames typically do not need to fix - the frame being created */ - -void -generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, - struct value **args, struct type *type, int gcc_p) -{ - return; -} - /* Given a call-dummy dummy-frame, return the registers. Here the register value is taken from the local copy of the register buffer. */ static void -dummy_frame_register_unwind (struct frame_info *frame, void **cache, - int regnum, int *optimized, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnum, void *bufferp) +dummy_frame_prev_register (struct frame_info *next_frame, + void **this_prologue_cache, + int regnum, int *optimized, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnum, void *bufferp) { - struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache); + struct dummy_frame *dummy; + struct frame_id id; + + /* Call the ID method which, if at all possible, will set the + prologue cache. */ + dummy_frame_this_id (next_frame, this_prologue_cache, &id); + dummy = (*this_prologue_cache); gdb_assert (dummy != NULL); /* Describe the register's location. Generic dummy frames always @@ -370,47 +331,81 @@ dummy_frame_register_unwind (struct frame_info *frame, void **cache, } } -/* Assuming that FRAME is a dummy, return the resume address for the - previous frame. */ - -static CORE_ADDR -dummy_frame_pc_unwind (struct frame_info *frame, - void **cache) -{ - struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache); - /* Oops! In a dummy-frame but can't find the stack dummy. Pretend - that the frame doesn't unwind. Should this function instead - return a has-no-caller indication? */ - if (dummy == NULL) - return 0; - return dummy->pc; -} - - -/* Assuming that FRAME is a dummy, return the ID of the calling frame - (the frame that the dummy has the saved state of). */ +/* Assuming that THIS frame is a dummy (remember, the NEXT and not + THIS frame is passed in), return the ID of THIS frame. That ID is + determined by examining the NEXT frame's unwound registers using + the method unwind_dummy_id(). As a side effect, THIS dummy frame's + dummy cache is located and and saved in THIS_PROLOGUE_CACHE. */ static void -dummy_frame_id_unwind (struct frame_info *frame, - void **cache, - struct frame_id *id) +dummy_frame_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id) { - struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache); - /* Oops! In a dummy-frame but can't find the stack dummy. Pretend - that the frame doesn't unwind. Should this function instead - return a has-no-caller indication? */ - if (dummy == NULL) - (*id) = null_frame_id; + struct dummy_frame *dummy = (*this_prologue_cache); + if (dummy != NULL) + { + (*this_id) = dummy->id; + return; + } + /* When unwinding a normal frame, the stack structure is determined + by analyzing the frame's function's code (be it using brute force + prologue analysis, or the dwarf2 CFI). In the case of a dummy + frame, that simply isn't possible. The The PC is either the + program entry point, or some random address on the stack. Trying + to use that PC to apply standard frame ID unwind techniques is + just asking for trouble. */ + if (gdbarch_unwind_dummy_id_p (current_gdbarch)) + { + /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS, + previously saved the dummy frame's ID. Things only work if + the two return the same value. */ + gdb_assert (SAVE_DUMMY_FRAME_TOS_P ()); + /* Use an architecture specific method to extract the prev's + dummy ID from the next frame. Note that this method uses + frame_register_unwind to obtain the register values needed to + determine the dummy frame's ID. */ + (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame); + } + else if (frame_relative_level (next_frame) < 0) + { + /* We're unwinding a sentinel frame, the PC of which is pointing + at a stack dummy. Fake up the dummy frame's ID using the + 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 ()); + } + else if (legacy_frame_p (current_gdbarch) + && get_prev_frame (next_frame)) + { + /* Things are looking seriously grim! Assume that the legacy + get_prev_frame code has already created THIS frame and linked + it in to the frame chain (a pretty bold assumption), extract + the ID from THIS base / pc. */ + (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)), + get_frame_pc (get_prev_frame (next_frame))); + } else - (*id) = dummy->id; + { + /* Outch! We're not trying to find the innermost frame's ID yet + we're trying to unwind to a dummy. The architecture must + provide the unwind_dummy_id() method. Abandon the unwind + process but only after first warning the user. */ + internal_warning (__FILE__, __LINE__, + "Missing unwind_dummy_id architecture method"); + (*this_id) = null_frame_id; + return; + } + (*this_prologue_cache) = find_dummy_frame ((*this_id).code_addr, + (*this_id).stack_addr); } static struct frame_unwind dummy_frame_unwind = { - dummy_frame_pop, - dummy_frame_pc_unwind, - dummy_frame_id_unwind, - dummy_frame_register_unwind + DUMMY_FRAME, + dummy_frame_this_id, + dummy_frame_prev_register }; const struct frame_unwind * diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h index 2d03421..bb41e8d 100644 --- a/gdb/dummy-frame.h +++ b/gdb/dummy-frame.h @@ -40,9 +40,9 @@ struct frame_id; is probably to define CALL_DUMMY to be empty, CALL_DUMMY_LENGTH to zero, and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember to define PUSH_RETURN_ADDRESS, because no call instruction will be - being executed by the target. Also FRAME_CHAIN_VALID as - generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as - generic_fix_call_dummy. */ + being executed by the target. Also DEPRECATED_FRAME_CHAIN_VALID as + generic_{file,func}_frame_chain_valid and do not set + FIX_CALL_DUMMY. */ /* If the PC falls in a dummy frame, return a dummy frame unwinder. */ diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c index 6bedddb..81fa207 100644 --- a/gdb/dwarf2cfi.c +++ b/gdb/dwarf2cfi.c @@ -345,7 +345,7 @@ read_2u (bfd *abfd, char **p) unsigned ret; ret = bfd_get_16 (abfd, (bfd_byte *) * p); - (*p)++; + (*p) += 2; return ret; } diff --git a/gdb/dwarf2cfi.h b/gdb/dwarf2cfi.h index 2c8be97..28a329d 100644 --- a/gdb/dwarf2cfi.h +++ b/gdb/dwarf2cfi.h @@ -22,6 +22,8 @@ #ifndef DWARF2CFI_H #define DWARF2CFI_H +struct frame_info; + struct context_reg { union diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 7456979..35e76f3 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -170,13 +170,13 @@ read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r) BUF_END. The address is returned, and *BYTES_READ is set to the number of bytes read from BUF. */ -static CORE_ADDR -read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read) +CORE_ADDR +dwarf2_read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read) { CORE_ADDR result; if (buf_end - buf < TARGET_ADDR_BIT / TARGET_CHAR_BIT) - error ("read_address: Corrupted DWARF expression."); + error ("dwarf2_read_address: Corrupted DWARF expression."); *bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT; result = extract_address (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT); @@ -231,11 +231,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, while (op_ptr < op_end) { enum dwarf_location_atom op = *op_ptr++; - CORE_ADDR result, memaddr; + CORE_ADDR result; ULONGEST uoffset, reg; LONGEST offset; int bytes_read; - enum lval_type expr_lval; ctx->in_reg = 0; @@ -277,7 +276,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, break; case DW_OP_addr: - result = read_address (op_ptr, op_end, &bytes_read); + result = dwarf2_read_address (op_ptr, op_end, &bytes_read); op_ptr += bytes_read; break; @@ -361,19 +360,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, error ("DWARF-2 expression error: DW_OP_reg operations must be " "used alone."); - /* FIXME drow/2003-02-21: This call to read_reg could be pushed - into the evaluator's caller by changing the semantics for in_reg. - Then we wouldn't need to return an lval_type and a memaddr. */ - result = (ctx->read_reg) (ctx->baton, op - DW_OP_reg0, &expr_lval, - &memaddr); - - if (expr_lval == lval_register) - { - ctx->regnum = op - DW_OP_reg0; - ctx->in_reg = 1; - } - else - result = memaddr; + result = op - DW_OP_reg0; + ctx->in_reg = 1; break; @@ -383,16 +371,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, error ("DWARF-2 expression error: DW_OP_reg operations must be " "used alone."); - result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr); - - if (expr_lval == lval_register) - { - ctx->regnum = reg; - ctx->in_reg = 1; - } - else - result = memaddr; - + result = reg; + ctx->in_reg = 1; break; case DW_OP_breg0: @@ -429,8 +409,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, case DW_OP_breg31: { op_ptr = read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0, - &expr_lval, &memaddr); + result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0); result += offset; } break; @@ -438,7 +417,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, { op_ptr = read_uleb128 (op_ptr, op_end, ®); op_ptr = read_sleb128 (op_ptr, op_end, &offset); - result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr); + result = (ctx->read_reg) (ctx->baton, reg); result += offset; } break; @@ -454,19 +433,25 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, afterwards, effectively erasing whatever the recursive call put there. */ before_stack_len = ctx->stack_len; + /* FIXME: cagney/2003-03-26: This code should be using + get_frame_base_address(), and then implement a dwarf2 + specific this_base method. */ (ctx->get_frame_base) (ctx->baton, &datastart, &datalen); dwarf_expr_eval (ctx, datastart, datalen); result = dwarf_expr_fetch (ctx, 0); - if (! ctx->in_reg) + if (ctx->in_reg) + result = (ctx->read_reg) (ctx->baton, result); + else { char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT); int bytes_read; (ctx->read_mem) (ctx->baton, buf, result, TARGET_ADDR_BIT / TARGET_CHAR_BIT); - result = read_address (buf, - buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT, - &bytes_read); + result = dwarf2_read_address (buf, + buf + (TARGET_ADDR_BIT + / TARGET_CHAR_BIT), + &bytes_read); } result = result + offset; ctx->stack_len = before_stack_len; @@ -525,9 +510,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, (ctx->read_mem) (ctx->baton, buf, result, TARGET_ADDR_BIT / TARGET_CHAR_BIT); - result = read_address (buf, - buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT, - &bytes_read); + result = dwarf2_read_address (buf, + buf + (TARGET_ADDR_BIT + / TARGET_CHAR_BIT), + &bytes_read); } break; @@ -537,9 +523,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr, int bytes_read; (ctx->read_mem) (ctx->baton, buf, result, *op_ptr++); - result = read_address (buf, - buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT, - &bytes_read); + result = dwarf2_read_address (buf, + buf + (TARGET_ADDR_BIT + / TARGET_CHAR_BIT), + &bytes_read); } break; diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h index 3d0fcb3..9e6fe80 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -36,13 +36,8 @@ struct dwarf_expr_context to all of the callback functions. */ void *baton; - /* Return the value of register number REGNUM. LVALP will be set - to the kind of lval this register is (generally lval_register - for the current frame's registers or lval_memory for a register - saved to the stack). For lval_memory ADDRP will be set to the - saved location of the register. */ - CORE_ADDR (*read_reg) (void *baton, int regnum, enum lval_type *lvalp, - CORE_ADDR *addrp); + /* Return the value of register number REGNUM. */ + CORE_ADDR (*read_reg) (void *baton, int regnum); /* Read LENGTH bytes at ADDR into BUF. */ void (*read_mem) (void *baton, char *buf, CORE_ADDR addr, @@ -77,12 +72,8 @@ struct dwarf_expr_context int recursion_depth, max_recursion_depth; /* Non-zero if the result is in a register. The register number - will be in REGNUM, and the result will be the contents of the - register. */ + will be on the expression stack. */ int in_reg; - - /* If the result is in a register, the register number. */ - int regnum; }; struct dwarf_expr_context *new_dwarf_expr_context (); @@ -99,5 +90,7 @@ unsigned char *read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r); unsigned char *read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r); +CORE_ADDR dwarf2_read_address (unsigned char *buf, unsigned char *buf_end, + int *bytes_read); #endif diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 4180e05..78e75f3 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -40,6 +40,62 @@ #define DWARF2_REG_TO_REGNUM(REG) (REG) #endif +/* A helper function for dealing with location lists. Given a + symbol baton (BATON) and a pc value (PC), find the appropriate + location expression, set *LOCEXPR_LENGTH, and return a pointer + to the beginning of the expression. Returns NULL on failure. + + For now, only return the first matching location expression; there + can be more than one in the list. */ + +static char * +find_location_expression (struct dwarf2_loclist_baton *baton, + int *locexpr_length, CORE_ADDR pc) +{ + CORE_ADDR base_address = baton->base_address; + CORE_ADDR low, high; + char *loc_ptr, *buf_end; + unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT, length; + CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); + + loc_ptr = baton->data; + buf_end = baton->data + baton->size; + + while (1) + { + low = dwarf2_read_address (loc_ptr, buf_end, &length); + loc_ptr += length; + high = dwarf2_read_address (loc_ptr, buf_end, &length); + loc_ptr += length; + + /* An end-of-list entry. */ + if (low == 0 && high == 0) + return NULL; + + /* A base-address-selection entry. */ + if ((low & base_mask) == base_mask) + { + base_address = high; + continue; + } + + /* Otherwise, a location expression entry. */ + low += base_address; + high += base_address; + + length = extract_unsigned_integer (loc_ptr, 2); + loc_ptr += 2; + + if (pc >= low && pc < high) + { + *locexpr_length = length; + return loc_ptr; + } + + loc_ptr += length; + } +} + /* This is the baton used when performing dwarf2 expression evaluation. */ struct dwarf_expr_baton @@ -54,11 +110,11 @@ struct dwarf_expr_baton type will be returned in LVALP, and for lval_memory the register save address will be returned in ADDRP. */ static CORE_ADDR -dwarf_expr_read_reg (void *baton, int dwarf_regnum, enum lval_type *lvalp, - CORE_ADDR *addrp) +dwarf_expr_read_reg (void *baton, int dwarf_regnum) { struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; - CORE_ADDR result; + CORE_ADDR result, save_addr; + enum lval_type lval_type; char *buf; int optimized, regnum, realnum, regsize; @@ -66,8 +122,8 @@ dwarf_expr_read_reg (void *baton, int dwarf_regnum, enum lval_type *lvalp, regsize = register_size (current_gdbarch, regnum); buf = (char *) alloca (regsize); - frame_register (debaton->frame, regnum, &optimized, lvalp, addrp, &realnum, - buf); + frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr, + &realnum, buf); result = extract_address (buf, regsize); return result; @@ -87,13 +143,32 @@ dwarf_expr_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len) static void dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length) { + /* FIXME: cagney/2003-03-26: This code should be using + get_frame_base_address(), and then implement a dwarf2 specific + this_base method. */ struct symbol *framefunc; - struct dwarf2_locexpr_baton *symbaton; struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; + framefunc = get_frame_function (debaton->frame); - symbaton = SYMBOL_LOCATION_BATON (framefunc); - *start = symbaton->data; - *length = symbaton->size; + + if (SYMBOL_LOCATION_FUNCS (framefunc) == &dwarf2_loclist_funcs) + { + struct dwarf2_loclist_baton *symbaton; + symbaton = SYMBOL_LOCATION_BATON (framefunc); + *start = find_location_expression (symbaton, length, + get_frame_pc (debaton->frame)); + } + else + { + struct dwarf2_locexpr_baton *symbaton; + symbaton = SYMBOL_LOCATION_BATON (framefunc); + *length = symbaton->size; + *start = symbaton->data; + } + + if (*start == NULL) + error ("Could not find the frame base for \"%s\".", + SYMBOL_NATURAL_NAME (framefunc)); } /* Using the objfile specified in BATON, find the address for the @@ -127,6 +202,13 @@ dwarf2_evaluate_loc_desc (const struct symbol *var, struct frame_info *frame, struct dwarf_expr_baton baton; struct dwarf_expr_context *ctx; + if (size == 0) + { + retval = allocate_value (SYMBOL_TYPE (var)); + VALUE_LVAL (retval) = not_lval; + VALUE_OPTIMIZED_OUT (retval) = 1; + } + baton.frame = frame; baton.objfile = objfile; @@ -138,21 +220,15 @@ dwarf2_evaluate_loc_desc (const struct symbol *var, struct frame_info *frame, ctx->get_tls_address = dwarf_expr_tls_address; dwarf_expr_eval (ctx, data, size); - - retval = allocate_value (SYMBOL_TYPE (var)); - VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var); + result = dwarf_expr_fetch (ctx, 0); if (ctx->in_reg) - { - store_unsigned_integer (VALUE_CONTENTS_RAW (retval), - TYPE_LENGTH (SYMBOL_TYPE (var)), - dwarf_expr_fetch (ctx, 0)); - VALUE_LVAL (retval) = lval_register; - VALUE_REGNO (retval) = ctx->regnum; - } + retval = value_from_register (SYMBOL_TYPE (var), result, frame); else { - result = dwarf_expr_fetch (ctx, 0); + retval = allocate_value (SYMBOL_TYPE (var)); + VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var); + VALUE_LVAL (retval) = lval_memory; VALUE_LAZY (retval) = 1; VALUE_ADDRESS (retval) = result; @@ -176,8 +252,7 @@ struct needs_frame_baton /* Reads from registers do require a frame. */ static CORE_ADDR -needs_frame_read_reg (void *baton, int regnum, enum lval_type *lvalp, - CORE_ADDR *addrp) +needs_frame_read_reg (void *baton, int regnum) { struct needs_frame_baton *nf_baton = baton; nf_baton->needs_frame = 1; @@ -238,8 +313,56 @@ dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size) return baton.needs_frame; } +static void +dwarf2_tracepoint_var_ref (const struct symbol * symbol, + struct agent_expr * ax, + struct axs_value * value, unsigned char *data, + int size) +{ + if (size == 0) + error ("Symbol \"%s\" has been optimized out.", + SYMBOL_PRINT_NAME (symbol)); + if (size == 1 + && data[0] >= DW_OP_reg0 + && data[0] <= DW_OP_reg31) + { + value->kind = axs_lvalue_register; + value->u.reg = data[0] - DW_OP_reg0; + } + else if (data[0] == DW_OP_regx) + { + ULONGEST reg; + read_uleb128 (data + 1, data + size, ®); + value->kind = axs_lvalue_register; + value->u.reg = reg; + } + else if (data[0] == DW_OP_fbreg) + { + /* And this is worse than just minimal; we should honor the frame base + as above. */ + int frame_reg; + LONGEST frame_offset; + unsigned char *buf_end; + + buf_end = read_sleb128 (data + 1, data + size, &frame_offset); + if (buf_end != data + size) + error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".", + SYMBOL_PRINT_NAME (symbol)); + + TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset); + ax_reg (ax, frame_reg); + ax_const_l (ax, frame_offset); + ax_simple (ax, aop_add); + ax_const_l (ax, frame_offset); + ax_simple (ax, aop_add); + value->kind = axs_lvalue_memory; + } + else + error ("Unsupported DWARF opcode in the location of \"%s\".", + SYMBOL_PRINT_NAME (symbol)); +} /* Return the value of SYMBOL in FRAME using the DWARF-2 expression evaluator to calculate the location. */ @@ -293,58 +416,14 @@ locexpr_describe_location (const struct symbol *symbol, struct ui_file *stream) publicly available stub with tracepoint support for me to test against. When there is one this function should be revisited. */ -void +static void locexpr_tracepoint_var_ref (const struct symbol * symbol, struct agent_expr * ax, struct axs_value * value) { struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); - if (dlbaton->size == 0) - error ("Symbol \"%s\" has been optimized out.", - SYMBOL_PRINT_NAME (symbol)); - - if (dlbaton->size == 1 - && dlbaton->data[0] >= DW_OP_reg0 - && dlbaton->data[0] <= DW_OP_reg31) - { - value->kind = axs_lvalue_register; - value->u.reg = dlbaton->data[0] - DW_OP_reg0; - } - else if (dlbaton->data[0] == DW_OP_regx) - { - ULONGEST reg; - read_uleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size, - ®); - value->kind = axs_lvalue_register; - value->u.reg = reg; - } - else if (dlbaton->data[0] == DW_OP_fbreg) - { - /* And this is worse than just minimal; we should honor the frame base - as above. */ - int frame_reg; - LONGEST frame_offset; - unsigned char *buf_end; - - buf_end = read_sleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size, - &frame_offset); - if (buf_end != dlbaton->data + dlbaton->size) - error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".", - SYMBOL_PRINT_NAME (symbol)); - - TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset); - ax_reg (ax, frame_reg); - ax_const_l (ax, frame_offset); - ax_simple (ax, aop_add); - - ax_const_l (ax, frame_offset); - ax_simple (ax, aop_add); - value->kind = axs_lvalue_memory; - } - else - error ("Unsupported DWARF opcode in the location of \"%s\".", - SYMBOL_PRINT_NAME (symbol)); + dwarf2_tracepoint_var_ref (symbol, ax, value, dlbaton->data, dlbaton->size); } /* The set of location functions used with the DWARF-2 expression @@ -355,3 +434,76 @@ struct location_funcs dwarf2_locexpr_funcs = { locexpr_describe_location, locexpr_tracepoint_var_ref }; + + +/* Wrapper functions for location lists. These generally find + the appropriate location expression and call something above. */ + +/* Return the value of SYMBOL in FRAME using the DWARF-2 expression + evaluator to calculate the location. */ +static struct value * +loclist_read_variable (const struct symbol *symbol, struct frame_info *frame) +{ + struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); + struct value *val; + unsigned char *data; + int size; + + data = find_location_expression (dlbaton, &size, + frame ? get_frame_pc (frame) : 0); + if (data == NULL) + error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol)); + + val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, dlbaton->objfile); + + return val; +} + +/* Return non-zero iff we need a frame to evaluate SYMBOL. */ +static int +loclist_read_needs_frame (const struct symbol *symbol) +{ + /* If there's a location list, then assume we need to have a frame + to choose the appropriate location expression. With tracking of + global variables this is not necessarily true, but such tracking + is disabled in GCC at the moment until we figure out how to + represent it. */ + + return 1; +} + +/* Print a natural-language description of SYMBOL to STREAM. */ +static int +loclist_describe_location (const struct symbol *symbol, struct ui_file *stream) +{ + /* FIXME: Could print the entire list of locations. */ + fprintf_filtered (stream, "a variable with multiple locations"); + return 1; +} + +/* Describe the location of SYMBOL as an agent value in VALUE, generating + any necessary bytecode in AX. */ +static void +loclist_tracepoint_var_ref (const struct symbol * symbol, + struct agent_expr * ax, + struct axs_value * value) +{ + struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); + unsigned char *data; + int size; + + data = find_location_expression (dlbaton, &size, ax->scope); + if (data == NULL) + error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol)); + + dwarf2_tracepoint_var_ref (symbol, ax, value, data, size); +} + +/* The set of location functions used with the DWARF-2 expression + evaluator and location lists. */ +struct location_funcs dwarf2_loclist_funcs = { + loclist_read_variable, + loclist_read_needs_frame, + loclist_describe_location, + loclist_tracepoint_var_ref +}; diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h index fde1329..b6b4d33 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h @@ -24,16 +24,41 @@ /* This header is private to the DWARF-2 reader. It is shared between dwarf2read.c and dwarf2loc.c. */ -/* The symbol location baton type used by the DWARF-2 reader (i.e. - SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). */ +/* The symbol location baton types used by the DWARF-2 reader (i.e. + SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct + dwarf2_locexpr_baton" is for a symbol with a single location + expression; "struct dwarf2_loclist_baton" is for a symbol with a + location list. */ struct dwarf2_locexpr_baton { + /* Pointer to the start of the location expression. */ unsigned char *data; + + /* Length of the location expression. */ unsigned short size; + + /* The objfile containing the symbol whose location we're computing. */ + struct objfile *objfile; +}; + +struct dwarf2_loclist_baton +{ + /* The initial base address for the location list, based on the compilation + unit. */ + CORE_ADDR base_address; + + /* Pointer to the start of the location list. */ + unsigned char *data; + + /* Length of the location list. */ + unsigned short size; + + /* The objfile containing the symbol whose location we're computing. */ struct objfile *objfile; }; extern struct location_funcs dwarf2_locexpr_funcs; +extern struct location_funcs dwarf2_loclist_funcs; #endif diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 63e0c7a..55c2412 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -43,6 +43,7 @@ #include "bcache.h" #include "dwarf2expr.h" #include "dwarf2loc.h" +#include "cp-support.h" #include <fcntl.h> #include "gdb_string.h" @@ -221,9 +222,13 @@ struct comp_unit_head struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE]; - /* Pointer to the DIE associated with the compilation unit. */ + /* Base address of this compilation unit. */ + + CORE_ADDR base_address; - struct die_info *die; + /* Non-zero if base_address has been set. */ + + int base_known; }; /* The line number information for a compilation unit (found in the @@ -396,6 +401,7 @@ static char *dwarf_line_buffer; static char *dwarf_str_buffer; static char *dwarf_macinfo_buffer; static char *dwarf_ranges_buffer; +static char *dwarf_loc_buffer; /* A zeroed version of a partial die for initialization purposes. */ static struct partial_die_info zeroed_partial_die; @@ -512,6 +518,13 @@ struct dwarf2_pinfo unsigned int dwarf_ranges_size; + /* Pointer to start of dwarf locations buffer for the objfile. */ + + char *dwarf_loc_buffer; + + /* Size of dwarf locations buffer for the objfile. */ + + unsigned int dwarf_loc_size; }; #define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private) @@ -527,6 +540,8 @@ struct dwarf2_pinfo #define DWARF_MACINFO_SIZE(p) (PST_PRIVATE(p)->dwarf_macinfo_size) #define DWARF_RANGES_BUFFER(p) (PST_PRIVATE(p)->dwarf_ranges_buffer) #define DWARF_RANGES_SIZE(p) (PST_PRIVATE(p)->dwarf_ranges_size) +#define DWARF_LOC_BUFFER(p) (PST_PRIVATE(p)->dwarf_loc_buffer) +#define DWARF_LOC_SIZE(p) (PST_PRIVATE(p)->dwarf_loc_size) /* Maintain an array of referenced fundamental types for the current compilation unit being read. For DWARF version 1, we have to construct @@ -959,6 +974,7 @@ dwarf2_has_info (bfd *abfd) dwarf_frame_offset = 0; dwarf_eh_frame_offset = 0; dwarf_ranges_offset = 0; + dwarf_loc_offset = 0; bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL); if (dwarf_info_offset && dwarf_abbrev_offset) @@ -1095,6 +1111,14 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline) else dwarf_ranges_buffer = NULL; + if (dwarf_loc_offset) + dwarf_loc_buffer = dwarf2_read_section (objfile, + dwarf_loc_offset, + dwarf_loc_size, + dwarf_loc_section); + else + dwarf_loc_buffer = NULL; + if (mainline || (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)) @@ -1316,6 +1340,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) DWARF_MACINFO_SIZE (pst) = dwarf_macinfo_size; DWARF_RANGES_BUFFER (pst) = dwarf_ranges_buffer; DWARF_RANGES_SIZE (pst) = dwarf_ranges_size; + DWARF_LOC_BUFFER (pst) = dwarf_loc_buffer; + DWARF_LOC_SIZE (pst) = dwarf_loc_size; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); /* Store the function that reads in the rest of the symbol table */ @@ -1838,6 +1864,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) char *info_ptr; struct symtab *symtab; struct cleanup *back_to; + struct attribute *attr; /* Set local variables from the partial symbol table info. */ offset = DWARF_INFO_OFFSET (pst); @@ -1852,6 +1879,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) dwarf_macinfo_size = DWARF_MACINFO_SIZE (pst); dwarf_ranges_buffer = DWARF_RANGES_BUFFER (pst); dwarf_ranges_size = DWARF_RANGES_SIZE (pst); + dwarf_loc_buffer = DWARF_LOC_BUFFER (pst); + dwarf_loc_size = DWARF_LOC_SIZE (pst); baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile)); cu_header_offset = offset; info_ptr = dwarf_info_buffer + offset; @@ -1876,8 +1905,32 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) make_cleanup_free_die_list (dies); + /* Find the base address of the compilation unit for range lists and + location lists. It will normally be specified by DW_AT_low_pc. + In DWARF-3 draft 4, the base address could be overridden by + DW_AT_entry_pc. It's been removed, but GCC still uses this for + compilation units with discontinuous ranges. */ + + cu_header.base_known = 0; + cu_header.base_address = 0; + + attr = dwarf_attr (dies, DW_AT_entry_pc); + if (attr) + { + cu_header.base_address = DW_ADDR (attr); + cu_header.base_known = 1; + } + else + { + attr = dwarf_attr (dies, DW_AT_low_pc); + if (attr) + { + cu_header.base_address = DW_ADDR (attr); + cu_header.base_known = 1; + } + } + /* Do line number decoding in read_file_scope () */ - cu_header.die = dies; process_die (dies, objfile, &cu_header); if (!dwarf2_get_pc_bounds (dies, &lowpc, &highpc, objfile, &cu_header)) @@ -2355,40 +2408,18 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, .debug_renges section. */ unsigned int offset = DW_UNSND (attr); /* Base address selection entry. */ - CORE_ADDR base = 0; - int found_base = 0; + CORE_ADDR base; + int found_base; int dummy; unsigned int i; char *buffer; CORE_ADDR marker; int low_set; - /* The applicable base address is determined by (1) the closest - preceding base address selection entry in the range list or - (2) the DW_AT_low_pc of the compilation unit. */ - - /* ??? Was in dwarf3 draft4, and has since been removed. - GCC still uses it though. */ - attr = dwarf_attr (cu_header->die, DW_AT_entry_pc); - if (attr) - { - base = DW_ADDR (attr); - found_base = 1; - } - - if (!found_base) - { - attr = dwarf_attr (cu_header->die, DW_AT_low_pc); - if (attr) - { - base = DW_ADDR (attr); - found_base = 1; - } - } - + found_base = cu_header->base_known; + base = cu_header->base_address; buffer = dwarf_ranges_buffer + offset; - /* Read in the largest possible address. */ marker = read_address (obfd, buffer, cu_header, &dummy); if ((marker & mask) == mask) @@ -3490,7 +3521,7 @@ read_namespace (struct die_info *die, struct objfile *objfile, } else { - /* We need temp_name around because processing_current_namespace + /* We need temp_name around because processing_current_prefix is a const char *. */ char *temp_name = alloca (strlen (previous_prefix) + 2 + strlen(name) + 1); @@ -3505,9 +3536,9 @@ read_namespace (struct die_info *die, struct objfile *objfile, time, add a using directive. */ if (is_anonymous && dwarf_attr (die, DW_AT_extension) == NULL) - add_using_directive (processing_current_prefix, - strlen (previous_prefix), - strlen (processing_current_prefix)); + cp_add_using_directive (processing_current_prefix, + strlen (previous_prefix), + strlen (processing_current_prefix)); if (die->has_children) { @@ -7778,26 +7809,53 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, const struct comp_unit_head *cu_header, struct objfile *objfile) { - struct dwarf2_locexpr_baton *baton; - - /* When support for location lists is added, this will go away. */ - if (!attr_form_is_block (attr)) + if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) { - dwarf2_complex_location_expr_complaint (); - return; - } + struct dwarf2_loclist_baton *baton; - baton = obstack_alloc (&objfile->symbol_obstack, - sizeof (struct dwarf2_locexpr_baton)); - baton->objfile = objfile; + baton = obstack_alloc (&objfile->symbol_obstack, + sizeof (struct dwarf2_loclist_baton)); + baton->objfile = objfile; - /* Note that we're just copying the block's data pointer here, not - the actual data. We're still pointing into the dwarf_info_buffer - for SYM's objfile; right now we never release that buffer, but - when we do clean up properly this may need to change. */ - baton->size = DW_BLOCK (attr)->size; - baton->data = DW_BLOCK (attr)->data; + /* We don't know how long the location list is, but make sure we + don't run off the edge of the section. */ + baton->size = dwarf_loc_size - DW_UNSND (attr); + baton->data = dwarf_loc_buffer + DW_UNSND (attr); + baton->base_address = cu_header->base_address; + if (cu_header->base_known == 0) + complaint (&symfile_complaints, + "Location list used without specifying the CU base address."); - SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs; - SYMBOL_LOCATION_BATON (sym) = baton; + SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_loclist_funcs; + SYMBOL_LOCATION_BATON (sym) = baton; + } + else + { + struct dwarf2_locexpr_baton *baton; + + baton = obstack_alloc (&objfile->symbol_obstack, + sizeof (struct dwarf2_locexpr_baton)); + baton->objfile = objfile; + + if (attr_form_is_block (attr)) + { + /* Note that we're just copying the block's data pointer + here, not the actual data. We're still pointing into the + dwarf_info_buffer for SYM's objfile; right now we never + release that buffer, but when we do clean up properly + this may need to change. */ + baton->size = DW_BLOCK (attr)->size; + baton->data = DW_BLOCK (attr)->data; + } + else + { + dwarf2_invalid_attrib_class_complaint ("location description", + SYMBOL_NATURAL_NAME (sym)); + baton->size = 0; + baton->data = NULL; + } + + SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs; + SYMBOL_LOCATION_BATON (sym) = baton; + } } @@ -446,7 +446,7 @@ evaluate_subexp_standard (struct type *expect_type, case OP_REGISTER: { int regno = longest_to_int (exp->elts[pc + 1].longconst); - struct value *val = value_of_register (regno, deprecated_selected_frame); + struct value *val = value_of_register (regno, get_selected_frame ()); (*pos) += 2; if (val == NULL) error ("Value of register %s not available.", diff --git a/gdb/event-top.h b/gdb/event-top.h index 4c06083..7e48a6c 100644 --- a/gdb/event-top.h +++ b/gdb/event-top.h @@ -24,6 +24,8 @@ #ifndef EVENT_TOP_H #define EVENT_TOP_H +struct cmd_list_element; + /* Stack for prompts. Each prompt is composed as a prefix, a prompt and a suffix. The prompt to be displayed at any given time is the one on top of the stack. A stack is necessary because of cases in diff --git a/gdb/expression.h b/gdb/expression.h index e8bc90c..6d7a490 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -327,7 +327,7 @@ enum exp_opcode OP_EXPRSTRING, /* An Objective C Foundation Class NSString constant */ - OP_OBJC_NSSTRING, + OP_OBJC_NSSTRING }; union exp_element diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 84e3d81..2a4eac3 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -472,6 +472,8 @@ const struct language_defn f_language_defn = f_print_type, /* Print a type using appropriate syntax */ f_val_print, /* Print a value using appropriate syntax */ c_value_print, /* FIXME */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%o", "0", "o", ""}, /* Octal format info */ {"%d", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/findvar.c b/gdb/findvar.c index 2283d4d..bb1d3a5 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -299,16 +299,16 @@ value_of_register (int regnum, struct frame_info *frame) CORE_ADDR addr; int optim; struct value *reg_val; + int realnum; char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); enum lval_type lval; /* Builtin registers lie completly outside of the range of normal registers. Catch them early so that the target never sees them. */ if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) - return value_of_builtin_reg (regnum, deprecated_selected_frame); + return value_of_builtin_reg (regnum, frame); - get_saved_register (raw_buffer, &optim, &addr, - frame, regnum, &lval); + frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer); /* FIXME: cagney/2002-05-15: This test is just bogus. @@ -508,7 +508,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_ARG: if (frame == NULL) return 0; - addr = FRAME_ARGS_ADDRESS (frame); + addr = get_frame_args_address (frame); if (!addr) return 0; addr += SYMBOL_VALUE (var); @@ -520,7 +520,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i CORE_ADDR argref; if (frame == NULL) return 0; - argref = FRAME_ARGS_ADDRESS (frame); + argref = get_frame_args_address (frame); if (!argref) return 0; argref += SYMBOL_VALUE (var); @@ -533,7 +533,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_LOCAL_ARG: if (frame == NULL) return 0; - addr = FRAME_LOCALS_ADDRESS (frame); + addr = get_frame_locals_address (frame); addr += SYMBOL_VALUE (var); break; @@ -780,12 +780,9 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum), ++local_regnum)) { - get_saved_register (value_bytes + value_bytes_copied, - &optim, - &addr, - frame, - local_regnum, - &lval); + int realnum; + frame_register (frame, local_regnum, &optim, &lval, &addr, + &realnum, value_bytes + value_bytes_copied); if (register_cached (local_regnum) == -1) return NULL; /* register value not available */ @@ -851,7 +848,10 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) register's contents in a real register or in core; read the data in raw format. */ - get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval); + { + int realnum; + frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer); + } if (register_cached (regnum) == -1) return NULL; /* register value not available */ diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 0b14a94..1dc28e8 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -409,7 +409,8 @@ startup_inferior (int ntraps) #else while (1) { - stop_soon_quietly = 1; /* Make wait_for_inferior be quiet */ + /* Make wait_for_inferior be quiet */ + stop_soon = STOP_QUIETLY; wait_for_inferior (); if (stop_signal != TARGET_SIGNAL_TRAP) { @@ -444,5 +445,5 @@ startup_inferior (int ntraps) } } #endif /* STARTUP_INFERIOR */ - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; } diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index a889f95..c72d24a 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -83,16 +83,19 @@ frame_unwind_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc) int i; struct frame_unwind_table *table = gdbarch_data (gdbarch, frame_unwind_data); - /* Seriously old code. Don't even try to use this new mechanism. */ if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES) - return trad_frame_unwind; + /* Seriously old code. Don't even try to use this new mechanism. + (Note: The variable USE_GENERIC_DUMMY_FRAMES is deprecated, not + the dummy frame mechanism. All architectures should be using + generic dummy frames). */ + return legacy_saved_regs_unwind; for (i = 0; i < table->nr; i++) { const struct frame_unwind *desc = table->p[i] (pc); if (desc != NULL) return desc; } - return trad_frame_unwind; + return legacy_saved_regs_unwind; } void diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 2c67c96..ad1efdf 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -28,6 +28,8 @@ struct frame_unwind; struct gdbarch; struct regcache; +#include "frame.h" /* For enum frame_type. */ + /* Return the frame unwind methods for the function that contains PC, or NULL if this this unwinder can't handle this frame. */ @@ -47,65 +49,94 @@ extern const struct frame_unwind *frame_unwind_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc); -/* Return the location (and possibly value) of REGNUM for the previous - (older, up) frame. All parameters except VALUEP can be assumed to - be non NULL. When VALUEP is NULL, just the location of the - register should be returned. - - UNWIND_CACHE is provided as mechanism for implementing a per-frame - local cache. It's initial value being NULL. Memory for that cache - should be allocated using frame_obstack_zalloc(). - - Register window architectures (eg SPARC) should note that REGNUM - identifies the register for the previous frame. For instance, a - request for the value of "o1" for the previous frame would be found - in the register "i1" in this FRAME. */ - -typedef void (frame_unwind_reg_ftype) (struct frame_info * frame, - void **unwind_cache, - int regnum, - int *optimized, - enum lval_type * lvalp, - CORE_ADDR *addrp, - int *realnump, void *valuep); - -/* Same as for registers above, but return the address at which the - calling frame would resume. */ - -typedef CORE_ADDR (frame_unwind_pc_ftype) (struct frame_info * frame, - void **unwind_cache); - -/* Same as for registers above, but return the ID of the frame that - called this one. */ - -typedef void (frame_unwind_id_ftype) (struct frame_info * frame, - void **unwind_cache, - struct frame_id * id); - -/* Discard the frame by restoring the registers (in regcache) back to - that of the caller. */ -/* NOTE: cagney/2003-01-19: While at present the callers all pop each - frame in turn, the implementor should try to code things so that - any frame can be popped directly. */ -/* FIXME: cagney/2003-01-19: Since both FRAME and REGCACHE refer to a - common register cache, care must be taken when restoring the - registers. The `correct fix' is to first first save the registers - in a scratch cache, and second write that scratch cache back to to - the real register cache. */ - -typedef void (frame_unwind_pop_ftype) (struct frame_info *frame, - void **unwind_cache, - struct regcache *regcache); +/* The following unwind functions assume a chain of frames forming the + sequence: (outer) prev <-> this <-> next (inner). All the + functions are called with called with the next frame's `struct + frame_info' and and this frame's prologue cache. + + THIS frame's register values can be obtained by unwinding NEXT + frame's registers (a recursive operation). + + THIS frame's prologue cache can be used to cache information such + as where this frame's prologue stores the previous frame's + registers. */ + +/* Assuming the frame chain: (outer) prev <-> this <-> next (inner); + use the NEXT frame, and its register unwind method, to determine + the frame ID of THIS frame. + + A frame ID provides an invariant that can be used to re-identify an + instance of a frame. It is a combination of the frame's `base' and + the frame's function's code address. + + Traditionally, THIS frame's ID was determined by examining THIS + frame's function's prologue, and identifying the register/offset + used as THIS frame's base. + + Example: An examination of THIS frame's prologue reveals that, on + entry, it saves the PC(+12), SP(+8), and R1(+4) registers + (decrementing the SP by 12). Consequently, the frame ID's base can + be determined by adding 12 to the THIS frame's stack-pointer, and + the value of THIS frame's SP can be obtained by unwinding the NEXT + frame's SP. + + THIS_PROLOGUE_CACHE can be used to share any prolog analysis data + with the other unwind methods. Memory for that cache should be + allocated using frame_obstack_zalloc(). */ + +typedef void (frame_this_id_ftype) (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id); + +/* Assuming the frame chain: (outer) prev <-> this <-> next (inner); + use the NEXT frame, and its register unwind method, to unwind THIS + frame's registers (returning the value of the specified register + REGNUM in the previous frame). + + Traditionally, THIS frame's registers were unwound by examining + THIS frame's function's prologue and identifying which registers + that prolog code saved on the stack. + + Example: An examination of THIS frame's prologue reveals that, on + entry, it saves the PC(+12), SP(+8), and R1(+4) registers + (decrementing the SP by 12). Consequently, the value of the PC + register in the previous frame is found in memory at SP+12, and + THIS frame's SP can be obtained by unwinding the NEXT frame's SP. + + Why not pass in THIS_FRAME? By passing in NEXT frame and THIS + cache, the supplied parameters are consistent with the sibling + function THIS_ID. + + Can the code call ``frame_register (get_prev_frame (NEXT_FRAME))''? + Won't the call frame_register (THIS_FRAME) be faster? Well, + ignoring the possability that the previous frame does not yet + exist, the ``frame_register (FRAME)'' function is expanded to + ``frame_register_unwind (get_next_frame (FRAME)'' and hence that + call will expand to ``frame_register_unwind (get_next_frame + (get_prev_frame (NEXT_FRAME)))''. Might as well call + ``frame_register_unwind (NEXT_FRAME)'' directly. + + THIS_PROLOGUE_CACHE can be used to share any prolog analysis data + with the other unwind methods. Memory for that cache should be + allocated using frame_obstack_zalloc(). */ + +typedef void (frame_prev_register_ftype) (struct frame_info *next_frame, + void **this_prologue_cache, + int prev_regnum, + int *optimized, + enum lval_type * lvalp, + CORE_ADDR *addrp, + int *realnump, void *valuep); struct frame_unwind { - /* Should the frame's type go here? */ + /* The frame's type. Should this instead be a collection of + predicates that test the frame for various attributes? */ + enum frame_type type; /* Should an attribute indicating the frame's address-in-block go here? */ - frame_unwind_pop_ftype *pop; - frame_unwind_pc_ftype *pc; - frame_unwind_id_ftype *id; - frame_unwind_reg_ftype *reg; + frame_this_id_ftype *this_id; + frame_prev_register_ftype *prev_register; }; #endif diff --git a/gdb/frame.c b/gdb/frame.c index 5d220c9..3871aa1 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -36,9 +36,101 @@ #include "annotate.h" #include "language.h" #include "frame-unwind.h" +#include "frame-base.h" #include "command.h" #include "gdbcmd.h" +/* We keep a cache of stack frames, each of which is a "struct + frame_info". The innermost one gets allocated (in + wait_for_inferior) each time the inferior stops; current_frame + points to it. Additional frames get allocated (in get_prev_frame) + as needed, and are chained through the next and prev fields. Any + time that the frame cache becomes invalid (most notably when we + execute something, but also if we change how we interpret the + frames (e.g. "set heuristic-fence-post" in mips-tdep.c, or anything + which reads new symbols)), we should call reinit_frame_cache. */ + +struct frame_info +{ + /* Level of this frame. The inner-most (youngest) frame is at level + 0. As you move towards the outer-most (oldest) frame, the level + increases. This is a cached value. It could just as easily be + computed by counting back from the selected frame to the inner + most frame. */ + /* NOTE: cagney/2002-04-05: Perhaphs a level of ``-1'' should be + reserved to indicate a bogus frame - one that has been created + just to keep GDB happy (GDB always needs a frame). For the + moment leave this as speculation. */ + int level; + + /* The frame's type. */ + /* FIXME: cagney/2003-04-02: Should instead be returning + ->unwind->type. Unfortunatly, legacy code is still explicitly + setting the type using the method deprecated_set_frame_type. + Eliminate that method and this field can be eliminated. */ + enum frame_type type; + + /* For each register, address of where it was saved on entry to the + frame, or zero if it was not saved on entry to this frame. This + includes special registers such as pc and fp saved in special + ways in the stack frame. The SP_REGNUM is even more special, the + address here is the sp for the previous frame, not the address + where the sp was saved. */ + /* Allocated by frame_saved_regs_zalloc () which is called / + initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */ + CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/ + + /* Anything extra for this structure that may have been defined in + the machine dependent files. */ + /* Allocated by frame_extra_info_zalloc () which is called / + initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */ + struct frame_extra_info *extra_info; + + /* If dwarf2 unwind frame informations is used, this structure holds + all related unwind data. */ + struct context *context; + + /* The frame's low-level unwinder and corresponding cache. The + low-level unwinder is responsible for unwinding register values + for the previous frame. The low-level unwind methods are + selected based on the presence, or otherwize, of register unwind + information such as CFI. */ + void *prologue_cache; + const struct frame_unwind *unwind; + + /* Cached copy of the previous frame's resume address. */ + struct { + int p; + CORE_ADDR value; + } prev_pc; + + /* Cached copy of the previous frame's function address. */ + struct + { + CORE_ADDR addr; + int p; + } prev_func; + + /* This frame's ID. */ + struct + { + int p; + struct frame_id value; + } this_id; + + /* The frame's high-level base methods, and corresponding cache. + The high level base methods are selected based on the frame's + debug info. */ + const struct frame_base *base; + void *base_cache; + + /* Pointers to the next (down, inner, younger) and previous (up, + outer, older) frame_info's in the frame cache. */ + struct frame_info *next; /* down, inner, younger */ + int prev_p; + struct frame_info *prev; /* up, outer, older */ +}; + /* Flag to control debugging. */ static int frame_debug; @@ -47,6 +139,77 @@ static int frame_debug; static int backtrace_below_main; +static void +fprint_frame_id (struct ui_file *file, struct frame_id id) +{ + fprintf_unfiltered (file, "{stack=0x%s,code=0x%s}", + paddr_nz (id.stack_addr), + paddr_nz (id.code_addr)); +} + +static void +fprint_frame_type (struct ui_file *file, enum frame_type type) +{ + switch (type) + { + case UNKNOWN_FRAME: + fprintf_unfiltered (file, "UNKNOWN_FRAME"); + return; + case NORMAL_FRAME: + fprintf_unfiltered (file, "NORMAL_FRAME"); + return; + case DUMMY_FRAME: + fprintf_unfiltered (file, "DUMMY_FRAME"); + return; + case SIGTRAMP_FRAME: + fprintf_unfiltered (file, "SIGTRAMP_FRAME"); + return; + default: + fprintf_unfiltered (file, "<unknown type>"); + return; + }; +} + +static void +fprint_frame (struct ui_file *file, struct frame_info *fi) +{ + if (fi == NULL) + { + fprintf_unfiltered (file, "<NULL frame>"); + return; + } + fprintf_unfiltered (file, "{"); + fprintf_unfiltered (file, "level=%d", fi->level); + fprintf_unfiltered (file, ","); + fprintf_unfiltered (file, "type="); + fprint_frame_type (file, fi->type); + fprintf_unfiltered (file, ","); + fprintf_unfiltered (file, "unwind="); + if (fi->unwind != NULL) + gdb_print_host_address (fi->unwind, file); + else + fprintf_unfiltered (file, "<unknown>"); + fprintf_unfiltered (file, ","); + fprintf_unfiltered (file, "pc="); + if (fi->next != NULL && fi->next->prev_pc.p) + fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_pc.value)); + else + fprintf_unfiltered (file, "<unknown>"); + fprintf_unfiltered (file, ","); + fprintf_unfiltered (file, "id="); + if (fi->this_id.p) + fprint_frame_id (file, fi->this_id.value); + else + fprintf_unfiltered (file, "<unknown>"); + fprintf_unfiltered (file, ","); + fprintf_unfiltered (file, "func="); + if (fi->next != NULL && fi->next->prev_func.p) + fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_func.addr)); + else + fprintf_unfiltered (file, "<unknown>"); + fprintf_unfiltered (file, "}"); +} + /* Return a frame uniq ID that can be used to, later, re-find the frame. */ @@ -57,52 +220,118 @@ get_frame_id (struct frame_info *fi) { return null_frame_id; } - else + if (!fi->this_id.p) { - struct frame_id id; - id.base = fi->frame; - id.pc = fi->pc; - return id; + gdb_assert (!legacy_frame_p (current_gdbarch)); + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, "{ get_frame_id (fi=%d) ", + fi->level); + /* Find the unwinder. */ + if (fi->unwind == NULL) + { + fi->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (fi)); + /* FIXME: cagney/2003-04-02: Rather than storing the frame's + type in the frame, the unwinder's type should be returned + directly. Unfortunatly, legacy code, called by + legacy_get_prev_frame, explicitly set the frames type + using the method deprecated_set_frame_type(). */ + gdb_assert (fi->unwind->type != UNKNOWN_FRAME); + fi->type = fi->unwind->type; + } + /* Find THIS frame's ID. */ + fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->this_id.value); + fi->this_id.p = 1; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame_id (gdb_stdlog, fi->this_id.value); + fprintf_unfiltered (gdb_stdlog, " }\n"); + } } + return fi->this_id.value; } const struct frame_id null_frame_id; /* All zeros. */ struct frame_id -frame_id_build (CORE_ADDR base, CORE_ADDR func_or_pc) +frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr) { struct frame_id id; - id.base = base; - id.pc = func_or_pc; + id.stack_addr = stack_addr; + id.code_addr = code_addr; return id; } int frame_id_p (struct frame_id l) { - /* The .func can be NULL but the .base cannot. */ - return (l.base != 0); + int p; + /* The .code can be NULL but the .stack cannot. */ + p = (l.stack_addr != 0); + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "{ frame_id_p (l="); + fprint_frame_id (gdb_stdlog, l); + fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", p); + } + return p; } int frame_id_eq (struct frame_id l, struct frame_id r) { - /* If .base is different, the frames are different. */ - if (l.base != r.base) - return 0; - /* Add a test to check that the frame ID's are for the same function - here. */ - return 1; + int eq; + if (l.stack_addr == 0 || r.stack_addr == 0) + /* Like a NaN, if either ID is invalid, the result is false. */ + eq = 0; + else if (l.stack_addr != r.stack_addr) + /* If .stack addresses are different, the frames are different. */ + eq = 0; + else if (l.code_addr == 0 || r.code_addr == 0) + /* A zero code addr is a wild card, always succeed. */ + eq = 1; + else if (l.code_addr == r.code_addr) + /* 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; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "{ frame_id_eq (l="); + fprint_frame_id (gdb_stdlog, l); + fprintf_unfiltered (gdb_stdlog, ",r="); + fprint_frame_id (gdb_stdlog, r); + fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", eq); + } + return eq; } int frame_id_inner (struct frame_id l, struct frame_id r) { - /* Only return non-zero when strictly inner than. Note that, per - comment in "frame.h", there is some fuzz here. Frameless - functions are not strictly inner than (same .base but different - .func). */ - return INNER_THAN (l.base, r.base); + int inner; + if (l.stack_addr == 0 || r.stack_addr == 0) + /* Like NaN, any operation involving an invalid ID always fails. */ + inner = 0; + else + /* Only return non-zero when strictly inner than. Note that, per + comment in "frame.h", there is some fuzz here. Frameless + functions are not strictly inner than (same .stack but + different .code). */ + inner = INNER_THAN (l.stack_addr, r.stack_addr); + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "{ frame_id_inner (l="); + fprint_frame_id (gdb_stdlog, l); + fprintf_unfiltered (gdb_stdlog, ",r="); + fprint_frame_id (gdb_stdlog, r); + fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", inner); + } + return inner; } struct frame_info * @@ -135,26 +364,127 @@ frame_find_by_id (struct frame_id id) } CORE_ADDR -frame_pc_unwind (struct frame_info *frame) +frame_pc_unwind (struct frame_info *this_frame) +{ + if (!this_frame->prev_pc.p) + { + CORE_ADDR pc; + if (gdbarch_unwind_pc_p (current_gdbarch)) + { + /* The right way. The `pure' way. The one true way. This + method depends solely on the register-unwind code to + determine the value of registers in THIS frame, and hence + the value of this frame's PC (resume address). A typical + implementation is no more than: + + frame_unwind_register (this_frame, ISA_PC_REGNUM, buf); + return extract_address (buf, size of ISA_PC_REGNUM); + + Note: this method is very heavily dependent on a correct + register-unwind implementation, it pays to fix that + method first; this method is frame type agnostic, since + it only deals with register values, it works with any + frame. This is all in stark contrast to the old + FRAME_SAVED_PC which would try to directly handle all the + different ways that a PC could be unwound. */ + pc = gdbarch_unwind_pc (current_gdbarch, this_frame); + } + else if (this_frame->level < 0) + { + /* FIXME: cagney/2003-03-06: Old code and and a sentinel + frame. Do like was always done. Fetch the PC's value + direct from the global registers array (via read_pc). + This assumes that this frame belongs to the current + global register cache. The assumption is dangerous. */ + pc = read_pc (); + } + else if (DEPRECATED_FRAME_SAVED_PC_P ()) + { + /* FIXME: cagney/2003-03-06: Old code, but not a sentinel + frame. Do like was always done. Note that this method, + unlike unwind_pc(), tries to handle all the different + frame cases directly. It fails. */ + pc = DEPRECATED_FRAME_SAVED_PC (this_frame); + } + else + internal_error (__FILE__, __LINE__, "No gdbarch_unwind_pc method"); + this_frame->prev_pc.value = pc; + this_frame->prev_pc.p = 1; + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, + "{ frame_pc_unwind (this_frame=%d) -> 0x%s }\n", + this_frame->level, + paddr_nz (this_frame->prev_pc.value)); + } + return this_frame->prev_pc.value; +} + +CORE_ADDR +frame_func_unwind (struct frame_info *fi) { - if (!frame->pc_unwind_cache_p) + if (!fi->prev_func.p) { - frame->pc_unwind_cache = frame->unwind->pc (frame, &frame->unwind_cache); - frame->pc_unwind_cache_p = 1; + fi->prev_func.p = 1; + fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi)); + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, + "{ frame_func_unwind (fi=%d) -> 0x%s }\n", + fi->level, paddr_nz (fi->prev_func.addr)); } - return frame->pc_unwind_cache; + return fi->prev_func.addr; +} + +CORE_ADDR +get_frame_func (struct frame_info *fi) +{ + return frame_func_unwind (fi->next); +} + +static int +do_frame_unwind_register (void *src, int regnum, void *buf) +{ + frame_unwind_register (src, regnum, buf); + return 1; } void -frame_pop (struct frame_info *frame) -{ - /* FIXME: cagney/2003-01-18: There is probably a chicken-egg problem - with passing in current_regcache. The pop function needs to be - written carefully so as to not overwrite registers whose [old] - values are needed to restore other registers. Instead, this code - should pass in a scratch cache and, as a second step, restore the - registers using that. */ - frame->unwind->pop (frame, &frame->unwind_cache, current_regcache); +frame_pop (struct frame_info *this_frame) +{ + struct regcache *scratch_regcache; + struct cleanup *cleanups; + + if (DEPRECATED_POP_FRAME_P ()) + { + /* A legacy architecture that has implemented a custom pop + function. All new architectures should instead be using the + generic code below. */ + DEPRECATED_POP_FRAME; + } + else + { + /* Make a copy of all the register values unwound from this + frame. Save them in a scratch buffer so that there isn't a + race betweening trying to extract the old values from the + current_regcache while, at the same time writing new values + into that same cache. */ + struct regcache *scratch = regcache_xmalloc (current_gdbarch); + struct cleanup *cleanups = make_cleanup_regcache_xfree (scratch); + regcache_save (scratch, do_frame_unwind_register, this_frame); + /* FIXME: cagney/2003-03-16: It should be possible to tell the + target's register cache that it is about to be hit with a + burst register transfer and that the sequence of register + writes should be batched. The pair target_prepare_to_store() + and target_store_registers() kind of suggest this + functionality. Unfortunatly, they don't implement it. Their + lack of a formal definition can lead to targets writing back + bogus values (arguably a bug in the target code mind). */ + /* Now copy those saved registers into the current regcache. + Here, regcache_cpy() calls regcache_restore(). */ + regcache_cpy (current_regcache, scratch); + do_cleanups (cleanups); + } + /* We've made right mess of GDB's local state, just discard + everything. */ flush_cached_frames (); } @@ -165,6 +495,13 @@ frame_register_unwind (struct frame_info *frame, int regnum, { struct frame_unwind_cache *cache; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, + "{ frame_register_unwind (frame=%d,regnum=\"%s\",...) ", + frame->level, frame_map_regnum_to_name (regnum)); + } + /* Require all but BUFFERP to be valid. A NULL BUFFERP indicates that the value proper does not need to be fetched. */ gdb_assert (optimizedp != NULL); @@ -179,9 +516,46 @@ frame_register_unwind (struct frame_info *frame, int regnum, detected the problem before calling here. */ gdb_assert (frame != NULL); - /* Ask this frame to unwind its register. */ - frame->unwind->reg (frame, &frame->unwind_cache, regnum, - optimizedp, lvalp, addrp, realnump, bufferp); + /* Find the unwinder. */ + if (frame->unwind == NULL) + { + frame->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (frame)); + /* FIXME: cagney/2003-04-02: Rather than storing the frame's + type in the frame, the unwinder's type should be returned + directly. Unfortunatly, legacy code, called by + legacy_get_prev_frame, explicitly set the frames type using + the method deprecated_set_frame_type(). */ + gdb_assert (frame->unwind->type != UNKNOWN_FRAME); + frame->type = frame->unwind->type; + } + + /* Ask this frame to unwind its register. See comment in + "frame-unwind.h" for why NEXT frame and this unwind cace are + passed in. */ + frame->unwind->prev_register (frame->next, &frame->prologue_cache, regnum, + optimizedp, lvalp, addrp, realnump, bufferp); + + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "->"); + fprintf_unfiltered (gdb_stdlog, " *optimizedp=%d", (*optimizedp)); + fprintf_unfiltered (gdb_stdlog, " *lvalp=%d", (int) (*lvalp)); + fprintf_unfiltered (gdb_stdlog, " *addrp=0x%s", paddr_nz ((*addrp))); + fprintf_unfiltered (gdb_stdlog, " *bufferp="); + if (bufferp == NULL) + fprintf_unfiltered (gdb_stdlog, "<NULL>"); + else + { + int i; + const char *buf = bufferp; + fprintf_unfiltered (gdb_stdlog, "["); + for (i = 0; i < register_size (current_gdbarch, regnum); i++) + fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]); + fprintf_unfiltered (gdb_stdlog, "]"); + } + fprintf_unfiltered (gdb_stdlog, " }\n"); + } } void @@ -200,9 +574,10 @@ frame_register (struct frame_info *frame, int regnum, /* Ulgh! Old code that, for lval_register, sets ADDRP to the offset of the register in the register cache. It should instead return the REGNUM corresponding to that register. Translate the . */ - if (GET_SAVED_REGISTER_P ()) + if (DEPRECATED_GET_SAVED_REGISTER_P ()) { - GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame, regnum, lvalp); + DEPRECATED_GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame, + regnum, lvalp); /* Compute the REALNUM if the caller wants it. */ if (*lvalp == lval_register) { @@ -330,23 +705,6 @@ generic_unwind_get_saved_register (char *raw_buffer, &realnumx, raw_buffer); } -void -get_saved_register (char *raw_buffer, - int *optimized, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, - enum lval_type *lval) -{ - if (GET_SAVED_REGISTER_P ()) - { - GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval); - return; - } - generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, - regnum, lval); -} - /* frame_register_read () Find and return the value of REGNUM for the specified stack frame. @@ -431,18 +789,22 @@ create_sentinel_frame (struct regcache *regcache) /* Explicitly initialize the sentinel frame's cache. Provide it with the underlying regcache. In the future additional information, such as the frame's thread will be added. */ - frame->unwind_cache = sentinel_frame_cache (regcache); + frame->prologue_cache = sentinel_frame_cache (regcache); /* For the moment there is only one sentinel frame implementation. */ frame->unwind = sentinel_frame_unwind; /* Link this frame back to itself. The frame is self referential (the unwound PC is the same as the pc), so make it so. */ frame->next = frame; - /* Always unwind the PC as part of creating this frame. This - ensures that the frame's PC points at something valid. */ - /* FIXME: cagney/2003-01-10: Problem here. Unwinding a sentinel - frame's PC may require information such as the frame's thread's - stop reason. Is it possible to get to that? */ - frame->pc = frame_pc_unwind (frame); + /* Make the sentinel frame's ID valid, but invalid. That way all + comparisons with it should fail. */ + frame->this_id.p = 1; + frame->this_id.value = null_frame_id; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "{ create_sentinel_frame (...) -> "); + fprint_frame (gdb_stdlog, frame); + fprintf_unfiltered (gdb_stdlog, " }\n"); + } return frame; } @@ -498,10 +860,15 @@ unwind_to_current_frame (struct ui_out *ui_out, void *args) struct frame_info * get_current_frame (void) { - if (!target_has_stack) - error ("No stack."); + /* First check, and report, the lack of registers. Having GDB + report "No stack!" or "No memory" when the target doesn't even + have registers is very confusing. Besides, "printcmd.exp" + explicitly checks that ``print $pc'' with no registers prints "No + registers". */ if (!target_has_registers) error ("No registers."); + if (!target_has_stack) + error ("No stack."); if (!target_has_memory) error ("No memory."); if (current_frame == NULL) @@ -567,7 +934,7 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { - s = find_pc_symtab (fi->pc); + s = find_pc_symtab (get_frame_pc (fi)); if (s && s->language != current_language->la_language && s->language != language_unknown @@ -583,19 +950,20 @@ select_frame (struct frame_info *fi) most frame. */ static void -frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, - int regnum, int *optimizedp, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *bufferp) +legacy_saved_regs_prev_register (struct frame_info *next_frame, + void **this_prologue_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp) { - /* There is always a frame at this point. And THIS is the frame - we're interested in. */ + /* HACK: New code is passed the next frame and this cache. + Unfortunatly, old code expects this frame. Since this is a + backward compatibility hack, cheat by walking one level along the + prologue chain to the frame the old code expects. + + Do not try this at home. Professional driver, closed course. */ + struct frame_info *frame = next_frame->prev; gdb_assert (frame != NULL); - /* If we're using generic dummy frames, we'd better not be in a call - dummy. (generic_call_dummy_register_unwind ought to have been called - instead.) */ - gdb_assert (!(DEPRECATED_USE_GENERIC_DUMMY_FRAMES - && (get_frame_type (frame) == DUMMY_FRAME))); /* Only (older) architectures that implement the DEPRECATED_FRAME_INIT_SAVED_REGS method should be using this @@ -633,13 +1001,13 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, #if 1 /* Save each register value, as it is read in, in a frame based cache. */ - void **regs = (*cache); + void **regs = (*this_prologue_cache); if (regs == NULL) { int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (void *)); regs = frame_obstack_zalloc (sizeof_cache); - (*cache) = regs; + (*this_prologue_cache) = regs; } if (regs[regnum] == NULL) { @@ -659,102 +1027,35 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, return; } - /* No luck, assume this and the next frame have the same register - value. Pass the request down the frame chain to the next frame. - Hopefully that will find the register's location, either in a - register or in memory. */ - frame_register (frame, regnum, optimizedp, lvalp, addrp, realnump, - bufferp); + /* No luck. Assume this and the next frame have the same register + value. Pass the unwind request down the frame chain to the next + frame. Hopefully that frame will find the register's location. */ + frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp, + realnump, bufferp); } -static CORE_ADDR -frame_saved_regs_pc_unwind (struct frame_info *frame, void **cache) -{ - gdb_assert (FRAME_SAVED_PC_P ()); - return FRAME_SAVED_PC (frame); -} - static void -frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache, - struct frame_id *id) +legacy_saved_regs_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *id) { - int fromleaf; - CORE_ADDR base; - CORE_ADDR pc; - - /* Start out by assuming it's NULL. */ - (*id) = null_frame_id; - - if (frame_relative_level (next_frame) <= 0) - /* FIXME: 2002-11-09: Frameless functions can occure anywhere in - the frame chain, not just the inner most frame! The generic, - per-architecture, frame code should handle this and the below - should simply be removed. */ - fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame); - else - fromleaf = 0; - - if (fromleaf) - /* A frameless inner-most frame. The `FP' (which isn't an - architecture frame-pointer register!) of the caller is the same - as the callee. */ - /* FIXME: 2002-11-09: There isn't any reason to special case this - edge condition. Instead the per-architecture code should hande - it locally. */ - base = get_frame_base (next_frame); - else - { - /* Two macros defined in tm.h specify the machine-dependent - actions to be performed here. - - First, get the frame's chain-pointer. - - If that is zero, the frame is the outermost frame or a leaf - called by the outermost frame. This means that if start - calls main without a frame, we'll return 0 (which is fine - anyway). - - Nope; there's a problem. This also returns when the current - routine is a leaf of main. This is unacceptable. We move - this to after the ffi test; I'd rather have backtraces from - start go curfluy than have an abort called from main not show - main. */ - gdb_assert (FRAME_CHAIN_P ()); - base = FRAME_CHAIN (next_frame); - - if (!frame_chain_valid (base, next_frame)) - return; - } - if (base == 0) - return; - - /* FIXME: cagney/2002-06-08: This should probably return the frame's - function and not the PC (a.k.a. resume address). */ - pc = frame_pc_unwind (next_frame); - id->pc = pc; - id->base = base; + /* legacy_get_prev_frame() always sets ->this_id.p, hence this is + never needed. */ + internal_error (__FILE__, __LINE__, "legacy_saved_regs_this_id() called"); } -static void -frame_saved_regs_pop (struct frame_info *fi, void **cache, - struct regcache *regcache) -{ - gdb_assert (POP_FRAME_P ()); - POP_FRAME; -} - -const struct frame_unwind trad_frame_unwinder = { - frame_saved_regs_pop, - frame_saved_regs_pc_unwind, - frame_saved_regs_id_unwind, - frame_saved_regs_register_unwind +const struct frame_unwind legacy_saved_regs_unwinder = { + /* Not really. It gets overridden by legacy_get_prev_frame. */ + UNKNOWN_FRAME, + legacy_saved_regs_this_id, + legacy_saved_regs_prev_register }; -const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder; +const struct frame_unwind *legacy_saved_regs_unwind = &legacy_saved_regs_unwinder; -/* Function: get_saved_register +/* Function: deprecated_generic_get_saved_register Find register number REGNUM relative to FRAME and put its (raw, - target format) contents in *RAW_BUFFER. + target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable was optimized out (and thus can't be fetched). Note that this is never set to anything other than zero @@ -770,10 +1071,6 @@ const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder; offset into the registers array. If the value is stored in a dummy frame, set *ADDRP to zero. - To use this implementation, define a function called - "get_saved_register" in your target code, which simply passes all - of its arguments to this function. - The argument RAW_BUFFER must point to aligned memory. */ void @@ -888,31 +1185,51 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) { struct frame_info *fi; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, + "{ create_new_frame (addr=0x%s, pc=0x%s) ", + paddr_nz (addr), paddr_nz (pc)); + } + fi = frame_obstack_zalloc (sizeof (struct frame_info)); - fi->frame = addr; - fi->pc = pc; fi->next = create_sentinel_frame (current_regcache); - fi->type = frame_type_from_pc (pc); + + /* Select/initialize both the unwind function and the frame's type + based on the PC. */ + fi->unwind = frame_unwind_find_by_pc (current_gdbarch, pc); + if (fi->unwind->type != UNKNOWN_FRAME) + fi->type = fi->unwind->type; + else + fi->type = frame_type_from_pc (pc); + + fi->this_id.p = 1; + deprecated_update_frame_base_hack (fi, addr); + deprecated_update_frame_pc_hack (fi, pc); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi); - /* Select/initialize an unwind function. */ - fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc); + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, fi); + fprintf_unfiltered (gdb_stdlog, " }\n"); + } return fi; } -/* Return the frame that FRAME calls (NULL if FRAME is the innermost - frame). Be careful to not fall off the bottom of the frame chain - and onto the sentinel frame. */ +/* Return the frame that THIS_FRAME calls (NULL if THIS_FRAME is the + innermost frame). Be careful to not fall off the bottom of the + frame chain and onto the sentinel frame. */ struct frame_info * -get_next_frame (struct frame_info *frame) +get_next_frame (struct frame_info *this_frame) { - if (frame->level > 0) - return frame->next; + if (this_frame->level > 0) + return this_frame->next; else return NULL; } @@ -929,6 +1246,8 @@ flush_cached_frames (void) current_frame = NULL; /* Invalidate cache */ select_frame (NULL); annotate_frames_invalid (); + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, "{ flush_cached_frames () }\n"); } /* Flush the frame cache, and start a new one if necessary. */ @@ -949,15 +1268,183 @@ reinit_frame_cache (void) INIT_EXTRA_INFO, INIT_FRAME_PC and INIT_FRAME_PC_FIRST. */ static struct frame_info * -legacy_get_prev_frame (struct frame_info *next_frame) +legacy_get_prev_frame (struct frame_info *this_frame) { CORE_ADDR address = 0; struct frame_info *prev; int fromleaf; + /* Don't frame_debug print legacy_get_prev_frame() here, just + confuses the output. */ + + /* Allocate the new frame. + + There is no reason to worry about memory leaks, should the + remainder of the function fail. The allocated memory will be + quickly reclaimed when the frame cache is flushed, and the `we've + been here before' check, in get_prev_frame will stop repeated + memory allocation calls. */ + prev = FRAME_OBSTACK_ZALLOC (struct frame_info); + prev->level = this_frame->level + 1; + + /* Do not completly wire it in to the frame chain. Some (bad) code + in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull + some fancy tricks (of course such code is, by definition, + recursive). + + On the other hand, methods, such as get_frame_pc() and + get_frame_base() rely on being able to walk along the frame + chain. Make certain that at least they work by providing that + link. Of course things manipulating prev can't go back. */ + prev->next = this_frame; + + /* NOTE: cagney/2002-11-18: Should have been correctly setting the + frame's type here, before anything else, and not last, at the + bottom of this function. The various + DEPRECATED_INIT_EXTRA_FRAME_INFO, DEPRECATED_INIT_FRAME_PC, + DEPRECATED_INIT_FRAME_PC_FIRST and + DEPRECATED_FRAME_INIT_SAVED_REGS methods are full of work-arounds + that handle the frame not being correctly set from the start. + Unfortunatly those same work-arounds rely on the type defaulting + to NORMAL_FRAME. Ulgh! The new frame code does not have this + problem. */ + prev->type = UNKNOWN_FRAME; + + /* A legacy frame's ID is always computed here. Mark it as valid. */ + prev->this_id.p = 1; + + /* Handle sentinel frame unwind as a special case. */ + if (this_frame->level < 0) + { + /* Try to unwind the PC. If that doesn't work, assume we've reached + the oldest frame and simply return. Is there a better sentinal + value? The unwound PC value is then used to initialize the new + previous frame's type. + + Note that the pc-unwind is intentionally performed before the + frame chain. This is ok since, for old targets, both + frame_pc_unwind (nee, DEPRECATED_FRAME_SAVED_PC) and + DEPRECATED_FRAME_CHAIN()) assume THIS_FRAME's data structures + have already been initialized (using + DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order + doesn't matter. + + By unwinding the PC first, it becomes possible to, in the case of + a dummy frame, avoid also unwinding the frame ID. This is + because (well ignoring the PPC) a dummy frame can be located + using THIS_FRAME's frame ID. */ + + deprecated_update_frame_pc_hack (prev, frame_pc_unwind (this_frame)); + if (get_frame_pc (prev) == 0) + { + /* The allocated PREV_FRAME will be reclaimed when the frame + obstack is next purged. */ + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, + " // unwound legacy PC zero }\n"); + } + return NULL; + } + + /* Set the unwind functions based on that identified PC. Ditto + for the "type" but strongly prefer the unwinder's frame type. */ + prev->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (prev)); + if (prev->unwind->type == UNKNOWN_FRAME) + prev->type = frame_type_from_pc (get_frame_pc (prev)); + else + prev->type = prev->unwind->type; + + /* Find the prev's frame's ID. */ + if (prev->type == DUMMY_FRAME + && gdbarch_unwind_dummy_id_p (current_gdbarch)) + { + /* When unwinding a normal frame, the stack structure is + determined by analyzing the frame's function's code (be + it using brute force prologue analysis, or the dwarf2 + CFI). In the case of a dummy frame, that simply isn't + possible. The The PC is either the program entry point, + or some random address on the stack. Trying to use that + PC to apply standard frame ID unwind techniques is just + asking for trouble. */ + /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS, + previously saved the dummy frame's ID. Things only work + if the two return the same value. */ + gdb_assert (SAVE_DUMMY_FRAME_TOS_P ()); + /* Use an architecture specific method to extract the prev's + dummy ID from the next frame. Note that this method uses + frame_register_unwind to obtain the register values + needed to determine the dummy frame's ID. */ + prev->this_id.value = gdbarch_unwind_dummy_id (current_gdbarch, + this_frame); + } + else + { + /* We're unwinding a sentinel frame, the PC of which is + pointing at a stack dummy. Fake up the dummy frame's ID + 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 ()); + } + + /* Check that the unwound ID is valid. */ + if (!frame_id_p (prev->this_id.value)) + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, + " // unwound legacy ID invalid }\n"); + } + return NULL; + } + + /* Check that the new frame isn't inner to (younger, below, + next) the old frame. If that happens the frame unwind is + going backwards. */ + /* FIXME: cagney/2003-02-25: Ignore the sentinel frame since + that doesn't have a valid frame ID. Should instead set the + sentinel frame's frame ID to a `sentinel'. Leave it until + after the switch to storing the frame ID, instead of the + frame base, in the frame object. */ + + /* Link it in. */ + this_frame->prev = prev; + + /* FIXME: cagney/2002-01-19: This call will go away. Instead of + initializing extra info, all frames will use the frame_cache + (passed to the unwind functions) to store additional frame + info. Unfortunatly legacy targets can't use + legacy_get_prev_frame() to unwind the sentinel frame and, + consequently, are forced to take this code path and rely on + the below call to DEPRECATED_INIT_EXTRA_FRAME_INFO to + initialize the inner-most frame. */ + if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) + { + DEPRECATED_INIT_EXTRA_FRAME_INFO (0, prev); + } + + if (prev->type == NORMAL_FRAME) + prev->this_id.value.code_addr + = get_pc_function_start (prev->this_id.value.code_addr); + + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, prev); + fprintf_unfiltered (gdb_stdlog, " } // legacy innermost frame\n"); + } + return prev; + } + /* This code only works on normal frames. A sentinel frame, where the level is -1, should never reach this code. */ - gdb_assert (next_frame->level >= 0); + gdb_assert (this_frame->level >= 0); /* On some machines it is possible to call a function without setting up a stack frame for it. On these machines, we @@ -966,14 +1453,14 @@ legacy_get_prev_frame (struct frame_info *next_frame) or isn't leafless. */ /* Still don't want to worry about this except on the innermost - frame. This macro will set FROMLEAF if NEXT_FRAME is a frameless + frame. This macro will set FROMLEAF if THIS_FRAME is a frameless function invocation. */ - if (next_frame->level == 0) + if (this_frame->level == 0) /* FIXME: 2002-11-09: Frameless functions can occure anywhere in the frame chain, not just the inner most frame! The generic, per-architecture, frame code should handle this and the below should simply be removed. */ - fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame); + fromleaf = FRAMELESS_FUNCTION_INVOCATION (this_frame); else fromleaf = 0; @@ -984,7 +1471,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) /* FIXME: 2002-11-09: There isn't any reason to special case this edge condition. Instead the per-architecture code should hande it locally. */ - address = get_frame_base (next_frame); + address = get_frame_base (this_frame); else { /* Two macros defined in tm.h specify the machine-dependent @@ -1002,28 +1489,36 @@ legacy_get_prev_frame (struct frame_info *next_frame) this to after the ffi test; I'd rather have backtraces from start go curfluy than have an abort called from main not show main. */ - gdb_assert (FRAME_CHAIN_P ()); - address = FRAME_CHAIN (next_frame); + gdb_assert (DEPRECATED_FRAME_CHAIN_P ()); + address = DEPRECATED_FRAME_CHAIN (this_frame); - if (!frame_chain_valid (address, next_frame)) - return 0; + if (!legacy_frame_chain_valid (address, this_frame)) + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, + " // legacy frame chain invalid }\n"); + } + return NULL; + } } if (address == 0) - return 0; - - /* Create an initially zero previous frame. */ - prev = frame_obstack_zalloc (sizeof (struct frame_info)); + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, + " // legacy frame chain NULL }\n"); + } + return NULL; + } - /* Link it in. */ - next_frame->prev = prev; - prev->next = next_frame; - prev->frame = address; - prev->level = next_frame->level + 1; - /* FIXME: cagney/2002-11-18: Should be setting the frame's type - here, before anything else, and not last. Various INIT functions - are full of work-arounds for the frames type not being set - correctly from the word go. Ulgh! */ - prev->type = NORMAL_FRAME; + /* Link in the already allocated prev frame. */ + this_frame->prev = prev; + deprecated_update_frame_base_hack (prev, address); /* This change should not be needed, FIXME! We should determine whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen @@ -1059,10 +1554,11 @@ legacy_get_prev_frame (struct frame_info *next_frame) DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC. This should also return a flag saying whether to keep the new frame, or whether to discard it, because on some machines (e.g. - mips) it is really awkward to have FRAME_CHAIN_VALID called - BEFORE DEPRECATED_INIT_EXTRA_FRAME_INFO (there is no good way to - get information deduced in FRAME_CHAIN_VALID into the extra - fields of the new frame). std_frame_pc(fromleaf, prev) + mips) it is really awkward to have DEPRECATED_FRAME_CHAIN_VALID + called BEFORE DEPRECATED_INIT_EXTRA_FRAME_INFO (there is no good + way to get information deduced in DEPRECATED_FRAME_CHAIN_VALID + into the extra fields of the new frame). std_frame_pc(fromleaf, + prev) This is the default setting for INIT_PREV_FRAME. It just does what the default DEPRECATED_INIT_FRAME_PC does. Some machines @@ -1083,21 +1579,24 @@ legacy_get_prev_frame (struct frame_info *next_frame) inner most and any other case. Since there is always a frame to unwind from, there is always - somewhere (NEXT_FRAME) to store all the info needed to construct + somewhere (THIS_FRAME) to store all the info needed to construct a new (previous) frame without having to first create it. This means that the convolution below - needing to carefully order a frame's initialization - isn't needed. - The irony here though, is that FRAME_CHAIN(), at least for a more - up-to-date architecture, always calls FRAME_SAVED_PC(), and - FRAME_SAVED_PC() computes the PC but without first needing the - frame! Instead of the convolution below, we could have simply - called FRAME_SAVED_PC() and been done with it! Note that - FRAME_SAVED_PC() is being superseed by frame_pc_unwind() and that - function does have somewhere to cache that PC value. */ + The irony here though, is that DEPRECATED_FRAME_CHAIN(), at least + for a more up-to-date architecture, always calls + FRAME_SAVED_PC(), and FRAME_SAVED_PC() computes the PC but + without first needing the frame! Instead of the convolution + below, we could have simply called FRAME_SAVED_PC() and been done + with it! Note that FRAME_SAVED_PC() is being superseed by + frame_pc_unwind() and that function does have somewhere to cache + that PC value. */ if (DEPRECATED_INIT_FRAME_PC_FIRST_P ()) - prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev)); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, + prev)); if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev); @@ -1106,17 +1605,27 @@ legacy_get_prev_frame (struct frame_info *next_frame) FRAME_SAVED_PC may use that queue to figure out its value (see tm-sparc.h). We want the pc saved in the inferior frame. */ if (DEPRECATED_INIT_FRAME_PC_P ()) - prev->pc = DEPRECATED_INIT_FRAME_PC (fromleaf, prev); + deprecated_update_frame_pc_hack (prev, + DEPRECATED_INIT_FRAME_PC (fromleaf, + prev)); /* If ->frame and ->pc are unchanged, we are in the process of getting ourselves into an infinite backtrace. Some architectures - check this in FRAME_CHAIN or thereabouts, but it seems like there - is no reason this can't be an architecture-independent check. */ - if (prev->frame == next_frame->frame - && prev->pc == next_frame->pc) + check this in DEPRECATED_FRAME_CHAIN or thereabouts, but it seems + like there is no reason this can't be an architecture-independent + check. */ + if (get_frame_base (prev) == get_frame_base (this_frame) + && get_frame_pc (prev) == get_frame_pc (this_frame)) { - next_frame->prev = NULL; + this_frame->prev = NULL; obstack_free (&frame_cache_obstack, prev); + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, + " // legacy this.id == prev.id }\n"); + } return NULL; } @@ -1124,7 +1633,25 @@ legacy_get_prev_frame (struct frame_info *next_frame) (and probably other architectural information). The PC lets you check things like the debug info at that point (dwarf2cfi?) and use that to decide how the frame should be unwound. */ - prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc); + prev->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (prev)); + + /* If the unwinder provides a frame type, use it. Otherwize + continue on to that heuristic mess. */ + if (prev->unwind->type != UNKNOWN_FRAME) + { + prev->type = prev->unwind->type; + if (prev->type == NORMAL_FRAME) + prev->this_id.value.code_addr + = get_pc_function_start (prev->this_id.value.code_addr); + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, prev); + fprintf_unfiltered (gdb_stdlog, " } // legacy with unwound type\n"); + } + return prev; + } /* NOTE: cagney/2002-11-18: The code segments, found in create_new_frame and get_prev_frame(), that initializes the @@ -1136,8 +1663,8 @@ legacy_get_prev_frame (struct frame_info *next_frame) before the INIT function has been called. */ if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES && (DEPRECATED_PC_IN_CALL_DUMMY_P () - ? DEPRECATED_PC_IN_CALL_DUMMY (prev->pc, 0, 0) - : pc_in_dummy_frame (prev->pc))) + ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0) + : pc_in_dummy_frame (get_frame_pc (prev)))) prev->type = DUMMY_FRAME; else { @@ -1148,8 +1675,8 @@ legacy_get_prev_frame (struct frame_info *next_frame) Unforunatly, its the INIT code that sets the PC (Hmm, catch 22). */ char *name; - find_pc_partial_function (prev->pc, &name, NULL, NULL); - if (PC_IN_SIGTRAMP (prev->pc, name)) + find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL); + if (PC_IN_SIGTRAMP (get_frame_pc (prev), name)) prev->type = SIGTRAMP_FRAME; /* FIXME: cagney/2002-11-11: Leave prev->type alone. Some architectures are forcing the frame's type in INIT so we @@ -1159,18 +1686,39 @@ legacy_get_prev_frame (struct frame_info *next_frame) go away. */ } + if (prev->type == NORMAL_FRAME) + prev->this_id.value.code_addr + = get_pc_function_start (prev->this_id.value.code_addr); + + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, prev); + fprintf_unfiltered (gdb_stdlog, " } // legacy with confused type\n"); + } + return prev; } /* Return a structure containing various interesting information - about the frame that called NEXT_FRAME. Returns NULL + about the frame that called THIS_FRAME. Returns NULL if there is no such frame. */ struct frame_info * -get_prev_frame (struct frame_info *next_frame) +get_prev_frame (struct frame_info *this_frame) { struct frame_info *prev_frame; + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "{ get_prev_frame (this_frame="); + if (this_frame != NULL) + fprintf_unfiltered (gdb_stdlog, "%d", this_frame->level); + else + fprintf_unfiltered (gdb_stdlog, "<NULL>"); + fprintf_unfiltered (gdb_stdlog, ") "); + } + /* Return the inner-most frame, when the caller passes in NULL. */ /* NOTE: cagney/2002-11-09: Not sure how this would happen. The caller should have previously obtained a valid frame using @@ -1189,7 +1737,7 @@ get_prev_frame (struct frame_info *next_frame) that a frame isn't possible, rather than checking that the target has state and then calling get_current_frame() and get_prev_frame(). This is a guess mind. */ - if (next_frame == NULL) + if (this_frame == NULL) { /* NOTE: cagney/2002-11-09: There was a code segment here that would error out when CURRENT_FRAME was NULL. The comment @@ -1202,34 +1750,42 @@ get_prev_frame (struct frame_info *next_frame) thing to do.'' Per the above, this code shouldn't even be called with a NULL - NEXT_FRAME. */ + THIS_FRAME. */ return current_frame; } /* There is always a frame. If this assertion fails, suspect that something should be calling get_selected_frame() or get_current_frame(). */ - gdb_assert (next_frame != NULL); + gdb_assert (this_frame != NULL); - if (next_frame->level >= 0 + if (this_frame->level >= 0 && !backtrace_below_main - && inside_main_func (get_frame_pc (next_frame))) + && inside_main_func (get_frame_pc (this_frame))) /* Don't unwind past main(), bug always unwind the sentinel frame. Note, this is done _before_ the frame has been marked as previously unwound. That way if the user later decides to allow unwinds past main(), that just happens. */ { if (frame_debug) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - inside main func.\n"); + fprintf_unfiltered (gdb_stdlog, "-> NULL // inside main func }\n"); return NULL; } /* Only try to do the unwind once. */ - if (next_frame->prev_p) - return next_frame->prev; - next_frame->prev_p = 1; + if (this_frame->prev_p) + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, this_frame->prev); + fprintf_unfiltered (gdb_stdlog, " // cached \n"); + } + return this_frame->prev; + } + this_frame->prev_p = 1; +#if 0 /* If we're inside the entry file, it isn't valid. Don't apply this test to a dummy frame - dummy frame PC's typically land in the entry file. Don't apply this test to the sentinel frame. @@ -1241,14 +1797,27 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-01-10: If there is a way of disabling this test then it should probably be moved to before the ->prev_p test, above. */ - if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_file (get_frame_pc (next_frame))) + /* NOTE: vinschen/2003-04-01: Disabled. It turns out that the call to + inside_entry_file destroys a meaningful backtrace under some + conditions. E. g. the backtrace tests in the asm-source testcase + are broken for some targets. In this test the functions are all + implemented as part of one file and the testcase is not necessarily + linked with a start file (depending on the target). What happens is, + that the first frame is printed normaly and following frames are + treated as being inside the enttry file then. This way, only the + #0 frame is printed in the backtrace output. */ + if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_file (get_frame_pc (this_frame))) { if (frame_debug) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - inside entry file\n"); + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, " // inside entry file }\n"); + } return NULL; } +#endif /* If we're already inside the entry function for the main objfile, then it isn't valid. Don't apply this test to a dummy frame - @@ -1258,32 +1827,61 @@ get_prev_frame (struct frame_info *next_frame) /* NOTE: cagney/2003-02-25: Don't enable until someone has found hard evidence that this is needed. */ if (0 - && next_frame->type != DUMMY_FRAME && next_frame->level >= 0 - && inside_entry_func (get_frame_pc (next_frame))) + && this_frame->type != DUMMY_FRAME && this_frame->level >= 0 + && inside_entry_func (get_frame_pc (this_frame))) { if (frame_debug) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - inside entry func\n"); + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, "// inside entry func }\n"); + } return NULL; } /* If any of the old frame initialization methods are around, use - the legacy get_prev_frame method. Just don't try to unwind a - sentinel frame using that method - it doesn't work. All sentinal - frames use the new unwind code. */ - if ((DEPRECATED_INIT_FRAME_PC_P () - || DEPRECATED_INIT_FRAME_PC_FIRST_P () - || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () - || FRAME_CHAIN_P ()) - && next_frame->level >= 0) + the legacy get_prev_frame method. */ + if (legacy_frame_p (current_gdbarch)) { - prev_frame = legacy_get_prev_frame (next_frame); - if (frame_debug && prev_frame == NULL) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - legacy_get_prev_frame NULL.\n"); + prev_frame = legacy_get_prev_frame (this_frame); return prev_frame; } + /* Check that this frame's ID was valid. If it wasn't, don't try to + unwind to the prev frame. Be careful to not apply this test to + the sentinel frame. */ + if (this_frame->level >= 0 && !frame_id_p (get_frame_id (this_frame))) + { + if (frame_debug) + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, " // this ID is NULL }\n"); + } + return NULL; + } + + /* Check that this frame's ID isn't inner to (younger, below, next) + the next frame. This happens when frame unwind goes backwards. + Since the sentinel frame isn't valid, don't apply this if this + frame is entier the inner-most or sentinel frame. */ + if (this_frame->level > 0 + && frame_id_inner (get_frame_id (this_frame), + get_frame_id (this_frame->next))) + error ("This frame inner-to next frame (corrupt stack?)"); + + /* Check that this and the next frame are different. If they are + not, there is most likely a stack cycle. As with the inner-than + test, avoid the inner-most and sentinel frames. */ + /* FIXME: cagney/2003-03-17: Can't yet enable this this check. The + frame_id_eq() method doesn't yet use function addresses when + comparing frame IDs. */ + if (0 + && this_frame->level > 0 + && frame_id_eq (get_frame_id (this_frame), + get_frame_id (this_frame->next))) + error ("This frame identical to next frame (corrupt stack?)"); + /* Allocate the new frame but do not wire it in to the frame chain. Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along frame->next to pull some fancy tricks (of course such code is, by @@ -1295,7 +1893,7 @@ get_prev_frame (struct frame_info *next_frame) been here before' check above will stop repeated memory allocation calls. */ prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info); - prev_frame->level = next_frame->level + 1; + prev_frame->level = this_frame->level + 1; /* Try to unwind the PC. If that doesn't work, assume we've reached the oldest frame and simply return. Is there a better sentinal @@ -1304,88 +1902,58 @@ get_prev_frame (struct frame_info *next_frame) Note that the pc-unwind is intentionally performed before the frame chain. This is ok since, for old targets, both - frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume - NEXT_FRAME's data structures have already been initialized (using + frame_pc_unwind (nee, FRAME_SAVED_PC) and + DEPRECATED_FRAME_CHAIN()) assume THIS_FRAME's data structures + have already been initialized (using DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order doesn't matter. By unwinding the PC first, it becomes possible to, in the case of a dummy frame, avoid also unwinding the frame ID. This is because (well ignoring the PPC) a dummy frame can be located - using NEXT_FRAME's frame ID. */ + using THIS_FRAME's frame ID. */ - prev_frame->pc = frame_pc_unwind (next_frame); - if (prev_frame->pc == 0) + if (frame_pc_unwind (this_frame) == 0) { /* The allocated PREV_FRAME will be reclaimed when the frame obstack is next purged. */ if (frame_debug) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - unwound PC zero\n"); - return NULL; - } - prev_frame->type = frame_type_from_pc (prev_frame->pc); - - /* Set the unwind functions based on that identified PC. */ - prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch, - prev_frame->pc); - - /* FIXME: cagney/2003-01-13: A dummy frame doesn't need to unwind - the frame ID because the frame ID comes from the previous frame. - The other frames do though. True? */ - /* FIXME: cagney/2003-03-04: The below call isn't right. It should - instead be doing something like "prev_frame -> unwind -> id - (next_frame, & prev_frame -> unwind_cache, & prev_frame -> id)" - but that requires more extensive (pending) changes. */ - next_frame->unwind->id (next_frame, &next_frame->unwind_cache, - &prev_frame->id); - /* Check that the unwound ID is valid. As of 2003-02-24 the x86-64 - was returning an invalid frame ID when trying to do an unwind a - sentinel frame that belonged to a frame dummy. */ - if (!frame_id_p (prev_frame->id)) - { - if (frame_debug) - fprintf_unfiltered (gdb_stdlog, - "Outermost frame - unwound frame ID invalid\n"); + { + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, NULL); + fprintf_unfiltered (gdb_stdlog, " // unwound PC zero }\n"); + } return NULL; } - /* Check that the new frame isn't inner to (younger, below, next) - the old frame. If that happens the frame unwind is going - backwards. */ - /* FIXME: cagney/2003-02-25: Ignore the sentinel frame since that - doesn't have a valid frame ID. Should instead set the sentinel - frame's frame ID to a `sentinel'. Leave it until after the - switch to storing the frame ID, instead of the frame base, in the - frame object. */ - if (next_frame->level >= 0 - && frame_id_inner (prev_frame->id, get_frame_id (next_frame))) - error ("Unwound frame inner-to selected frame (corrupt stack?)"); - /* Note that, due to frameless functions, the stronger test of the - new frame being outer to the old frame can't be used - frameless - functions differ by only their PC value. */ - - /* FIXME: cagney/2002-12-18: Instead of this hack, should only store - the frame ID in PREV_FRAME. Unfortunatly, some architectures - (HP/UX) still reply on EXTRA_FRAME_INFO and, hence, still poke at - the "struct frame_info" object directly. */ - prev_frame->frame = prev_frame->id.base; + + /* Don't yet compute ->unwind (and hence ->type). It is computed + on-demand in get_frame_type, frame_register_unwind, and + get_frame_id. */ + + /* Don't yet compute the frame's ID. It is computed on-demand by + get_frame_id(). */ + + /* The unwound frame ID is validate at the start of this function, + as part of the logic to decide if that frame should be further + unwound, and not here while the prev frame is being created. + Doing this makes it possible for the user to examine a frame that + has an invalid frame ID. + + The very old VAX frame_args_address_correct() method noted: [...] + For the sake of argument, suppose that the stack is somewhat + trashed (which is one reason that "info frame" exists). So, + return 0 (indicating we don't know the address of the arglist) if + we don't know what frame this frame calls. */ /* Link it in. */ - next_frame->prev = prev_frame; - prev_frame->next = next_frame; - - /* FIXME: cagney/2002-01-19: This call will go away. Instead of - initializing extra info, all frames will use the frame_cache - (passed to the unwind functions) to store additional frame info. - Unfortunatly legacy targets can't use legacy_get_prev_frame() to - unwind the sentinel frame and, consequently, are forced to take - this code path and rely on the below call to - DEPRECATED_INIT_EXTRA_FRAME_INFO to initialize the inner-most - frame. */ - if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()) + this_frame->prev = prev_frame; + prev_frame->next = this_frame; + + if (frame_debug) { - gdb_assert (prev_frame->level == 0); - DEPRECATED_INIT_EXTRA_FRAME_INFO (0, prev_frame); + fprintf_unfiltered (gdb_stdlog, "-> "); + fprint_frame (gdb_stdlog, prev_frame); + fprintf_unfiltered (gdb_stdlog, " }\n"); } return prev_frame; @@ -1394,7 +1962,8 @@ get_prev_frame (struct frame_info *next_frame) CORE_ADDR get_frame_pc (struct frame_info *frame) { - return frame->pc; + gdb_assert (frame->next != NULL); + return frame_pc_unwind (frame->next); } static int @@ -1417,7 +1986,7 @@ pc_notcurrent (struct frame_info *frame) void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal) { - (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame)); + (*sal) = find_pc_line (get_frame_pc (frame), pc_notcurrent (frame)); } /* Per "frame.h", return the ``address'' of the frame. Code should @@ -1425,7 +1994,59 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal) CORE_ADDR get_frame_base (struct frame_info *fi) { - return fi->frame; + return get_frame_id (fi).stack_addr; +} + +/* High-level offsets into the frame. Used by the debug info. */ + +CORE_ADDR +get_frame_base_address (struct frame_info *fi) +{ + if (get_frame_type (fi) != NORMAL_FRAME) + return 0; + if (fi->base == NULL) + fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi)); + /* Sneaky: If the low-level unwind and high-level base code share a + common unwinder, let them share the prologue cache. */ + if (fi->base->unwind == fi->unwind) + return fi->base->this_base (fi->next, &fi->prologue_cache); + return fi->base->this_base (fi->next, &fi->base_cache); +} + +CORE_ADDR +get_frame_locals_address (struct frame_info *fi) +{ + void **cache; + if (get_frame_type (fi) != NORMAL_FRAME) + return 0; + /* If there isn't a frame address method, find it. */ + if (fi->base == NULL) + fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi)); + /* Sneaky: If the low-level unwind and high-level base code share a + common unwinder, let them share the prologue cache. */ + if (fi->base->unwind == fi->unwind) + cache = &fi->prologue_cache; + else + cache = &fi->base_cache; + return fi->base->this_locals (fi->next, cache); +} + +CORE_ADDR +get_frame_args_address (struct frame_info *fi) +{ + void **cache; + if (get_frame_type (fi) != NORMAL_FRAME) + return 0; + /* If there isn't a frame address method, find it. */ + if (fi->base == NULL) + fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi)); + /* Sneaky: If the low-level unwind and high-level base code share a + common unwinder, let them share the prologue cache. */ + if (fi->base->unwind == fi->unwind) + cache = &fi->prologue_cache; + else + cache = &fi->base_cache; + return fi->base->this_args (fi->next, cache); } /* Level of the selected frame: 0 for innermost, 1 for its caller, ... @@ -1448,7 +2069,24 @@ get_frame_type (struct frame_info *frame) if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES && deprecated_frame_in_dummy (frame)) return DUMMY_FRAME; - return frame->type; + if (frame->unwind == NULL) + { + /* Initialize the frame's unwinder because it is that which + provides the frame's type. */ + frame->unwind = frame_unwind_find_by_pc (current_gdbarch, + get_frame_pc (frame)); + /* FIXME: cagney/2003-04-02: Rather than storing the frame's + type in the frame, the unwinder's type should be returned + directly. Unfortunatly, legacy code, called by + legacy_get_prev_frame, explicitly set the frames type using + the method deprecated_set_frame_type(). */ + gdb_assert (frame->unwind->type != UNKNOWN_FRAME); + frame->type = frame->unwind->type; + } + if (frame->type == UNKNOWN_FRAME) + return NORMAL_FRAME; + else + return frame->type; } void @@ -1458,34 +2096,6 @@ deprecated_set_frame_type (struct frame_info *frame, enum frame_type type) frame->type = type; } -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated. This is a compatibility function for targets - that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ -/* Find the addresses in which registers are saved in FRAME. */ - -void -deprecated_get_frame_saved_regs (struct frame_info *frame, - struct frame_saved_regs *saved_regs_addr) -{ - if (frame->saved_regs == NULL) - { - frame->saved_regs = (CORE_ADDR *) - frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS); - } - if (saved_regs_addr == NULL) - { - struct frame_saved_regs saved_regs; - FRAME_FIND_SAVED_REGS (frame, saved_regs); - memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS); - } - else - { - FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr); - memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS); - } -} -#endif - struct frame_extra_info * get_frame_extra_info (struct frame_info *fi) { @@ -1502,21 +2112,33 @@ frame_extra_info_zalloc (struct frame_info *fi, long size) void deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc) { - /* See comment in "frame.h". */ - frame->pc = pc; - /* While we're at it, update this frame's cached PC value, found in - the next frame. Oh, for the day when "struct frame_info" is - opaque and this hack on hack can go. */ - gdb_assert (frame->next != NULL); - frame->next->pc_unwind_cache = pc; - frame->next->pc_unwind_cache_p = 1; + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, + "{ deprecated_update_frame_pc_hack (frame=%d,pc=0x%s) }\n", + frame->level, paddr_nz (pc)); + /* NOTE: cagney/2003-03-11: Some architectures (e.g., Arm) are + maintaining a locally allocated frame object. Since such frame's + are not in the frame chain, it isn't possible to assume that the + frame has a next. Sigh. */ + if (frame->next != NULL) + { + /* While we're at it, update this frame's cached PC value, found + in the next frame. Oh for the day when "struct frame_info" + is opaque and this hack on hack can just go away. */ + frame->next->prev_pc.value = pc; + frame->next->prev_pc.p = 1; + } } void deprecated_update_frame_base_hack (struct frame_info *frame, CORE_ADDR base) { + if (frame_debug) + fprintf_unfiltered (gdb_stdlog, + "{ deprecated_update_frame_base_hack (frame=%d,base=0x%s) }\n", + frame->level, paddr_nz (base)); /* See comment in "frame.h". */ - frame->frame = base; + frame->this_id.value.stack_addr = base; } void @@ -1563,8 +2185,8 @@ deprecated_set_frame_context (struct frame_info *fi, struct frame_info * deprecated_frame_xmalloc (void) { - struct frame_info *frame = XMALLOC (struct frame_info); - memset (frame, 0, sizeof (struct frame_info)); + struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info); + frame->this_id.p = 1; return frame; } @@ -1587,6 +2209,17 @@ deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs, return frame; } +int +legacy_frame_p (struct gdbarch *current_gdbarch) +{ + return (DEPRECATED_INIT_FRAME_PC_P () + || DEPRECATED_INIT_FRAME_PC_FIRST_P () + || DEPRECATED_INIT_EXTRA_FRAME_INFO_P () + || DEPRECATED_FRAME_CHAIN_P () + || !gdbarch_unwind_dummy_id_p (current_gdbarch) + || !SAVE_DUMMY_FRAME_TOS_P ()); +} + void _initialize_frame (void) { diff --git a/gdb/frame.h b/gdb/frame.h index 77db6ba..a39f1ad 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -25,10 +25,13 @@ struct symtab_and_line; struct frame_unwind; +struct frame_base; struct block; +struct gdbarch; -/* The traditional frame unwinder. */ -extern const struct frame_unwind *trad_frame_unwind; +/* A legacy unwinder to prop up architectures using the old style + saved regs array. */ +extern const struct frame_unwind *legacy_saved_regs_unwind; /* The frame object. */ @@ -41,15 +44,24 @@ struct frame_info; struct frame_id { - /* The frame's address. This should be constant through out the - lifetime of a frame. */ + /* The frame's stack address. This shall be constant through out + the lifetime of a frame. Note that this requirement applies to + not just the function body, but also the prologue and (in theory + at least) the epilogue. Since that value needs to fall either on + the boundary, or within the frame's address range, the frame's + outer-most address (the inner-most address of the previous frame) + is used. Watch out for all the legacy targets that still use the + function pointer register or stack pointer register. They are + wrong. */ /* NOTE: cagney/2002-11-16: The ia64 has two stacks and hence two frame bases. This will need to be expanded to accomodate that. */ - CORE_ADDR base; - /* The frame's current PC. While the PC within the function may - change, the function that contains the PC does not. Should this - instead be the frame's function? */ - CORE_ADDR pc; + CORE_ADDR stack_addr; + /* The frame's code address. This shall be constant through out the + lifetime of the frame. While the PC (a.k.a. resume address) + changes as the function is executed, this code address cannot. + Typically, it is set to the address of the entry point of the + frame's function (as returned by frame_func_unwind(). */ + CORE_ADDR code_addr; }; /* Methods for constructing and comparing Frame IDs. @@ -63,12 +75,12 @@ struct frame_id /* For convenience. All fields are zero. */ extern const struct frame_id null_frame_id; -/* Construct a frame ID. The second parameter isn't yet well defined. - It might be the containing function, or the resume PC (see comment - above in `struct frame_id')? A func/pc of zero indicates a - wildcard (i.e., do not use func in frame ID comparisons). */ -extern struct frame_id frame_id_build (CORE_ADDR base, - CORE_ADDR func_or_pc); +/* Construct a frame ID. The first parameter is the frame's constant + stack address (typically the outer-bound), and the second the + frame's constant code address (typically the entry point) (or zero, + to indicate a wild card). */ +extern struct frame_id frame_id_build (CORE_ADDR stack_addr, + CORE_ADDR code_addr); /* Returns non-zero when L is a valid frame (a valid frame has a non-zero .base). */ @@ -144,9 +156,17 @@ extern struct frame_info *frame_find_by_id (struct frame_id id); /* Base attributes of a frame: */ /* The frame's `resume' address. Where the program will resume in - this frame. */ + this frame. + + This replaced: frame->pc; */ extern CORE_ADDR get_frame_pc (struct frame_info *); +/* Following on from the `resume' address. Return the entry point + address of the function containing that resume address, or zero if + that function isn't known. */ +extern CORE_ADDR frame_func_unwind (struct frame_info *fi); +extern CORE_ADDR get_frame_func (struct frame_info *fi); + /* Closely related to the resume address, various symbol table attributes that are determined by the PC. Note that for a normal frame, the PC refers to the resume address after the return, and @@ -168,47 +188,27 @@ extern CORE_ADDR get_frame_pc (struct frame_info *); extern void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal); -/* Return the frame address from FI. Except in the machine-dependent - *FRAME* macros, a frame address has no defined meaning other than - as a magic cookie which identifies a frame over calls to the - inferior (um, SEE NOTE BELOW). The only known exception is - inferior.h (DEPRECATED_PC_IN_CALL_DUMMY) [ON_STACK]; see comments - there. You cannot assume that a frame address contains enough - information to reconstruct the frame; if you want more than just to - identify the frame (e.g. be able to fetch variables relative to - that frame), then save the whole struct frame_info (and the next - struct frame_info, since the latter is used for fetching variables - on some machines) (um, again SEE NOTE BELOW). - - NOTE: cagney/2002-11-18: Actually, the frame address isn't - sufficient for identifying a frame, and the counter examples are - wrong! - - Code that needs to (re)identify a frame must use get_frame_id() and - frame_find_by_id() (and in the future, a frame_compare() function - instead of INNER_THAN()). Two reasons: an architecture (e.g., - ia64) can have more than one frame address (due to multiple stack - pointers) (frame ID is going to be expanded to accomodate this); - successive frameless function calls can only be differientated by - comparing both the frame's base and the frame's enclosing function - (frame_find_by_id() is going to be modified to perform this test). - - The generic dummy frame version of DEPRECATED_PC_IN_CALL_DUMMY() is - able to identify a dummy frame using only the PC value. So the - frame address is not needed. In fact, most - DEPRECATED_PC_IN_CALL_DUMMY() calls now pass zero as the frame/sp - values as the caller knows that those values won't be used. Once - all architectures are using generic dummy frames, - DEPRECATED_PC_IN_CALL_DUMMY() can drop the sp/frame parameters. - When it comes to finding a dummy frame, the next frame's frame ID - (with out duing an unwind) can be used (ok, could if it wasn't for - the need to change the way the PPC defined frame base in a strange - way). - - Modern architectures should be using something like dwarf2's - location expression to describe where a variable lives. Such - expressions specify their own debug info centric frame address. - Consequently, a generic frame address is pretty meaningless. */ +/* Return the frame base (what ever that is) (DEPRECATED). + + Old code was trying to use this single method for two conflicting + purposes. Such code needs to be updated to use either of: + + get_frame_id: A low level frame unique identifier, that consists of + both a stack and a function address, that can be used to uniquely + identify a frame. This value is determined by the frame's + low-level unwinder, the stack part [typically] being the + top-of-stack of the previous frame, and the function part being the + function's start address. Since the correct identification of a + frameless function requires both the a stack and function address, + the old get_frame_base method was not sufficient. + + get_frame_base_address: get_frame_locals_address: + get_frame_args_address: A set of high-level debug-info dependant + addresses that fall within the frame. These addresses almost + certainly will not match the stack address part of a frame ID (as + returned by get_frame_base). + + This replaced: frame->frame; */ extern CORE_ADDR get_frame_base (struct frame_info *); @@ -217,6 +217,25 @@ extern CORE_ADDR get_frame_base (struct frame_info *); FI is NULL, return the null_frame_id. */ extern struct frame_id get_frame_id (struct frame_info *fi); +/* Assuming that a frame is `normal', return its base-address, or 0 if + the information isn't available. NOTE: This address is really only + meaningful to the frame's high-level debug info. */ +extern CORE_ADDR get_frame_base_address (struct frame_info *); + +/* Assuming that a frame is `normal', return the base-address of the + local variables, or 0 if the information isn't available. NOTE: + This address is really only meaningful to the frame's high-level + debug info. Typically, the argument and locals share a single + base-address. */ +extern CORE_ADDR get_frame_locals_address (struct frame_info *); + +/* Assuming that a frame is `normal', return the base-address of the + parameter list, or 0 if that information isn't available. NOTE: + This address is really only meaningful to the frame's high-level + debug info. Typically, the argument and locals share a single + base-address. */ +extern CORE_ADDR get_frame_args_address (struct frame_info *); + /* The frame's level: 0 for innermost, 1 for its caller, ...; or -1 for an invalid frame). */ extern int frame_relative_level (struct frame_info *fi); @@ -226,6 +245,11 @@ extern int frame_relative_level (struct frame_info *fi); enum frame_type { + /* The frame's type hasn't yet been defined. This is a catch-all + for legacy code that uses really strange technicques, such as + deprecated_set_frame_type, to set the frame's type. New code + should not use this value. */ + UNKNOWN_FRAME, /* A true stack frame, created by the target program during normal execution. */ NORMAL_FRAME, @@ -314,111 +338,6 @@ extern CORE_ADDR frame_pc_unwind (struct frame_info *frame); of the caller. */ extern void frame_pop (struct frame_info *frame); -/* Describe the saved registers of a frame. */ - -#if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS) -/* XXXX - deprecated */ -struct frame_saved_regs - { - /* For each register R (except the SP), regs[R] is the address at - which it was saved on entry to the frame, or zero if it was not - saved on entry to this frame. This includes special registers - such as pc and fp saved in special ways in the stack frame. - - regs[SP_REGNUM] is different. It holds the actual SP, not the - address at which it was saved. */ - - CORE_ADDR regs[NUM_REGS]; - }; -#endif - -/* We keep a cache of stack frames, each of which is a "struct - frame_info". The innermost one gets allocated (in - wait_for_inferior) each time the inferior stops; current_frame - points to it. Additional frames get allocated (in - get_prev_frame) as needed, and are chained through the next - and prev fields. Any time that the frame cache becomes invalid - (most notably when we execute something, but also if we change how - we interpret the frames (e.g. "set heuristic-fence-post" in - mips-tdep.c, or anything which reads new symbols)), we should call - reinit_frame_cache. */ - -struct frame_info - { - /* Nominal address of the frame described. See comments at - get_frame_base() about what this means outside the *FRAME* - macros; in the *FRAME* macros, it can mean whatever makes most - sense for this machine. */ - CORE_ADDR frame; - - /* Address at which execution is occurring in this frame. - For the innermost frame, it's the current pc. - For other frames, it is a pc saved in the next frame. */ - CORE_ADDR pc; - - /* Level of this frame. The inner-most (youngest) frame is at - level 0. As you move towards the outer-most (oldest) frame, - the level increases. This is a cached value. It could just as - easily be computed by counting back from the selected frame to - the inner most frame. */ - /* NOTE: cagney/2002-04-05: Perhaphs a level of ``-1'' should be - reserved to indicate a bogus frame - one that has been created - just to keep GDB happy (GDB always needs a frame). For the - moment leave this as speculation. */ - int level; - - /* The frame's type. */ - enum frame_type type; - - /* For each register, address of where it was saved on entry to - the frame, or zero if it was not saved on entry to this frame. - This includes special registers such as pc and fp saved in - special ways in the stack frame. The SP_REGNUM is even more - special, the address here is the sp for the previous frame, not - the address where the sp was saved. */ - /* Allocated by frame_saved_regs_zalloc () which is called / - initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */ - CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/ - -#ifdef EXTRA_FRAME_INFO - /* XXXX - deprecated */ - /* Anything extra for this structure that may have been defined - in the machine dependent files. */ - EXTRA_FRAME_INFO -#endif - - /* Anything extra for this structure that may have been defined - in the machine dependent files. */ - /* Allocated by frame_extra_info_zalloc () which is called / - initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */ - struct frame_extra_info *extra_info; - - /* If dwarf2 unwind frame informations is used, this structure holds all - related unwind data. */ - struct context *context; - - /* Unwind cache shared between the unwind functions - they had - better all agree as to the contents. */ - void *unwind_cache; - - /* The frame's unwinder. */ - const struct frame_unwind *unwind; - - /* Cached copy of the previous frame's resume address. */ - int pc_unwind_cache_p; - CORE_ADDR pc_unwind_cache; - - /* This frame's ID. Note that the frame's ID, base and PC contain - redundant information. */ - struct frame_id id; - - /* Pointers to the next (down, inner, younger) and previous (up, - outer, older) frame_info's in the frame cache. */ - struct frame_info *next; /* down, inner, younger */ - int prev_p; - struct frame_info *prev; /* up, outer, older */ - }; - /* Values for the source flag to be used in print_frame_info_base(). */ enum print_what { @@ -451,21 +370,17 @@ enum print_what extern void *frame_obstack_zalloc (unsigned long size); #define FRAME_OBSTACK_ZALLOC(TYPE) ((TYPE *) frame_obstack_zalloc (sizeof (TYPE))) -/* If FRAME_CHAIN_VALID returns zero it means that the given frame - is the outermost one and has no caller. */ +/* If legacy_frame_chain_valid() returns zero it means that the given + frame is the outermost one and has no caller. -extern int frame_chain_valid (CORE_ADDR, struct frame_info *); + This method has been superseeded by the per-architecture + frame_unwind_pc() (returns 0 to indicate an invalid return address) + and per-frame this_id() (returns a NULL frame ID to indicate an + invalid frame). */ +extern int legacy_frame_chain_valid (CORE_ADDR, struct frame_info *); extern void generic_save_dummy_frame_tos (CORE_ADDR sp); - -#ifdef FRAME_FIND_SAVED_REGS -/* XXX - deprecated */ -#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL) -extern void deprecated_get_frame_saved_regs (struct frame_info *, - struct frame_saved_regs *); -#endif - extern struct block *get_frame_block (struct frame_info *, CORE_ADDR *addr_in_block); @@ -538,14 +453,10 @@ extern int generic_pc_in_call_dummy (CORE_ADDR pc, /* NOTE: cagney/2002-06-26: Targets should no longer use this function. Instead, the contents of a dummy frames registers can be obtained by applying: frame_register_unwind to the dummy frame; or - get_saved_register to the next outer frame. */ + frame_register_unwind() to the next outer frame. */ extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); -extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, - int nargs, struct value **args, - struct type *type, int gcc_p); - void generic_unwind_get_saved_register (char *raw_buffer, int *optimizedp, CORE_ADDR *addrp, @@ -554,21 +465,17 @@ void generic_unwind_get_saved_register (char *raw_buffer, enum lval_type *lvalp); /* The function generic_get_saved_register() has been made obsolete. - GET_SAVED_REGISTER now defaults to the recursive equivalent - - generic_unwind_get_saved_register() - so there is no need to even - set GET_SAVED_REGISTER. Architectures that need to override the - register unwind mechanism should modify frame->unwind(). */ + DEPRECATED_GET_SAVED_REGISTER now defaults to the recursive + equivalent - generic_unwind_get_saved_register() - so there is no + need to even set DEPRECATED_GET_SAVED_REGISTER. Architectures that + need to override the register unwind mechanism should modify + frame->unwind(). */ extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *, struct frame_info *, int, enum lval_type *); extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); -extern void get_saved_register (char *raw_buffer, int *optimized, - CORE_ADDR * addrp, - struct frame_info *frame, - int regnum, enum lval_type *lval); - /* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a function called frame_read_register_p(). This slightly weird (and older) variant of frame_read_register() returns zero (indicating @@ -641,7 +548,9 @@ extern CORE_ADDR *get_frame_saved_regs (struct frame_info *); /* FIXME: cagney/2002-12-06: Has the PC in the current frame changed? "infrun.c", Thanks to DECR_PC_AFTER_BREAK, can change the PC after - the initial frame create. This puts things back in sync. */ + the initial frame create. This puts things back in sync. + + This replaced: frame->pc = ....; */ extern void deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc); @@ -649,7 +558,9 @@ extern void deprecated_update_frame_pc_hack (struct frame_info *frame, 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. */ + from the outset. + + This replaced: frame->frame = ....; */ extern void deprecated_update_frame_base_hack (struct frame_info *frame, CORE_ADDR base); @@ -701,4 +612,8 @@ extern struct context *deprecated_get_frame_context (struct frame_info *fi); extern void deprecated_set_frame_context (struct frame_info *fi, struct context *context); +/* Return non-zero if the architecture is relying on legacy frame + code. */ +extern int legacy_frame_p (struct gdbarch *gdbarch); + #endif /* !defined (FRAME_H) */ diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index d279707..bab3776 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -35,18 +35,13 @@ static gdbarch_register_virtual_size_ftype frv_register_virtual_size; static gdbarch_register_virtual_type_ftype frv_register_virtual_type; static gdbarch_register_byte_ftype frv_register_byte; static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc; -static gdbarch_frame_chain_ftype frv_frame_chain; -static gdbarch_frame_saved_pc_ftype frv_frame_saved_pc; static gdbarch_skip_prologue_ftype frv_skip_prologue; static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address; static gdbarch_use_struct_convention_ftype frv_use_struct_convention; static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation; static gdbarch_init_extra_frame_info_ftype stupid_useless_init_extra_frame_info; -static gdbarch_store_struct_return_ftype frv_store_struct_return; static gdbarch_push_arguments_ftype frv_push_arguments; -static gdbarch_push_return_address_ftype frv_push_return_address; -static gdbarch_pop_frame_ftype frv_pop_frame; static gdbarch_saved_pc_after_call_ftype frv_saved_pc_after_call; static void frv_pop_frame_regular (struct frame_info *frame); @@ -1078,30 +1073,27 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation); - set_gdbarch_saved_pc_after_call (gdbarch, frv_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, frv_saved_pc_after_call); - set_gdbarch_frame_chain (gdbarch, frv_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, frv_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, frv_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, frv_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs); set_gdbarch_use_struct_convention (gdbarch, frv_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value); - set_gdbarch_store_struct_return (gdbarch, frv_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, frv_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); /* Settings for calling functions in the inferior. */ - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, frv_push_arguments); - set_gdbarch_push_return_address (gdbarch, frv_push_return_address); - set_gdbarch_pop_frame (gdbarch, frv_pop_frame); + set_gdbarch_deprecated_push_arguments (gdbarch, frv_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, frv_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, frv_pop_frame); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, frv_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (frv_call_dummy_words)); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, frv_init_extra_frame_info); /* Settings that should be unnecessary. */ @@ -1111,14 +1103,9 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_function_start_offset (gdbarch, 0); @@ -22,6 +22,8 @@ #ifndef GDB_H #define GDB_H +struct ui_out; + /* Return-code (RC) from a gdb library call. (The abreviation RC is taken from the sim/common directory.) */ diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh index ee0d0fb..555098c 100755 --- a/gdb/gdb_indent.sh +++ b/gdb/gdb_indent.sh @@ -73,8 +73,8 @@ esac types="\ -T FILE \ --T bfd -T asection \ --T prgregset_t -T fpregset_t -T gregset_t \ +-T bfd -T asection -T pid_t \ +-T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \ `cat *.h | sed -n \ -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \ -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 68247d6..3b5a807 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -66,6 +66,7 @@ #include "gdb-events.h" #include "reggroups.h" #include "osabi.h" +#include "symfile.h" /* For entry_point_address. */ /* Static function declarations */ @@ -148,7 +149,7 @@ struct gdbarch gdbarch_write_pc_ftype *write_pc; gdbarch_read_fp_ftype *read_fp; gdbarch_read_sp_ftype *read_sp; - gdbarch_write_sp_ftype *write_sp; + gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp; gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer; gdbarch_pseudo_register_read_ftype *pseudo_register_read; gdbarch_pseudo_register_write_ftype *pseudo_register_write; @@ -189,20 +190,17 @@ struct gdbarch gdbarch_call_dummy_address_ftype *call_dummy_address; CORE_ADDR call_dummy_start_offset; CORE_ADDR call_dummy_breakpoint_offset; - int call_dummy_breakpoint_offset_p; int call_dummy_length; gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy; - int call_dummy_p; LONGEST * call_dummy_words; int sizeof_call_dummy_words; - int call_dummy_stack_adjust_p; - int call_dummy_stack_adjust; + int deprecated_call_dummy_stack_adjust; gdbarch_fix_call_dummy_ftype *fix_call_dummy; gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first; gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc; int believe_pcc_promotion; int believe_pcc_promotion_type; - gdbarch_get_saved_register_ftype *get_saved_register; + gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register; gdbarch_register_convertible_ftype *register_convertible; gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; gdbarch_register_convert_to_raw_ftype *register_convert_to_raw; @@ -213,11 +211,12 @@ struct gdbarch gdbarch_address_to_pointer_ftype *address_to_pointer; gdbarch_integer_to_address_ftype *integer_to_address; gdbarch_return_value_on_stack_ftype *return_value_on_stack; - gdbarch_push_arguments_ftype *push_arguments; + gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments; + gdbarch_push_dummy_call_ftype *push_dummy_call; gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame; - gdbarch_push_return_address_ftype *push_return_address; - gdbarch_pop_frame_ftype *pop_frame; - gdbarch_store_struct_return_ftype *store_struct_return; + gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address; + gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame; + gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return; gdbarch_extract_return_value_ftype *extract_return_value; gdbarch_store_return_value_ftype *store_return_value; gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value; @@ -239,18 +238,20 @@ struct gdbarch gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address; CORE_ADDR frame_args_skip; gdbarch_frameless_function_invocation_ftype *frameless_function_invocation; - gdbarch_frame_chain_ftype *frame_chain; - gdbarch_frame_chain_valid_ftype *frame_chain_valid; - gdbarch_frame_saved_pc_ftype *frame_saved_pc; + gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain; + gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid; + gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc; + gdbarch_unwind_pc_ftype *unwind_pc; gdbarch_frame_args_address_ftype *frame_args_address; gdbarch_frame_locals_address_ftype *frame_locals_address; - gdbarch_saved_pc_after_call_ftype *saved_pc_after_call; + gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call; gdbarch_frame_num_args_ftype *frame_num_args; gdbarch_stack_align_ftype *stack_align; gdbarch_frame_align_ftype *frame_align; - int extra_stack_alignment_needed; + int deprecated_extra_stack_alignment_needed; gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr; gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos; + gdbarch_unwind_dummy_id_ftype *unwind_dummy_id; int parm_boundary; const struct floatformat * float_format; const struct floatformat * double_format; @@ -355,7 +356,6 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - 0, generic_pc_in_call_dummy, 0, 0, @@ -431,6 +431,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -500,7 +501,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->write_pc = generic_target_write_pc; current_gdbarch->read_fp = generic_target_read_fp; current_gdbarch->read_sp = generic_target_read_sp; - current_gdbarch->write_sp = generic_target_write_sp; current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer; current_gdbarch->num_regs = -1; current_gdbarch->sp_regnum = -1; @@ -526,15 +526,10 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->cannot_store_register = cannot_register_not; current_gdbarch->deprecated_use_generic_dummy_frames = 1; current_gdbarch->call_dummy_location = AT_ENTRY_POINT; - current_gdbarch->call_dummy_start_offset = -1; - current_gdbarch->call_dummy_breakpoint_offset = -1; - current_gdbarch->call_dummy_breakpoint_offset_p = -1; - current_gdbarch->call_dummy_length = -1; + current_gdbarch->call_dummy_address = entry_point_address; current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy; - current_gdbarch->call_dummy_p = -1; current_gdbarch->call_dummy_words = legacy_call_dummy_words; current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words; - current_gdbarch->call_dummy_stack_adjust_p = -1; current_gdbarch->register_convertible = generic_register_convertible_not; current_gdbarch->convert_register_p = legacy_convert_register_p; current_gdbarch->register_to_value = legacy_register_to_value; @@ -542,7 +537,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->pointer_to_address = unsigned_pointer_to_address; current_gdbarch->address_to_pointer = unsigned_address_to_pointer; current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not; - current_gdbarch->push_arguments = default_push_arguments; current_gdbarch->extract_return_value = legacy_extract_return_value; current_gdbarch->store_return_value = legacy_store_return_value; current_gdbarch->use_struct_convention = generic_use_struct_convention; @@ -558,7 +552,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; current_gdbarch->frame_args_address = get_frame_base; current_gdbarch->frame_locals_address = get_frame_base; - current_gdbarch->extra_stack_alignment_needed = 1; current_gdbarch->convert_from_func_ptr_addr = core_addr_identity; current_gdbarch->addr_bits_remove = core_addr_identity; current_gdbarch->smash_text_address = core_addr_identity; @@ -631,7 +624,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of write_pc, invalid_p == 0 */ /* Skip verify of read_fp, invalid_p == 0 */ /* Skip verify of read_sp, invalid_p == 0 */ - /* Skip verify of write_sp, invalid_p == 0 */ + /* Skip verify of deprecated_dummy_write_sp, has predicate */ /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ /* Skip verify of pseudo_register_read, has predicate */ /* Skip verify of pseudo_register_write, has predicate */ @@ -675,39 +668,15 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of get_longjmp_target, has predicate */ /* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */ /* Skip verify of call_dummy_location, invalid_p == 0 */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0)) - fprintf_unfiltered (log, "\n\tcall_dummy_address"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_start_offset == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_start_offset"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset"); - if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_breakpoint_offset_p == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset_p"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_length == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_length"); + /* Skip verify of call_dummy_address, invalid_p == 0 */ /* Skip verify of deprecated_pc_in_call_dummy, has predicate */ - if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_p == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_p"); /* Skip verify of call_dummy_words, invalid_p == 0 */ /* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */ - if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_stack_adjust_p == -1)) - fprintf_unfiltered (log, "\n\tcall_dummy_stack_adjust_p"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0)) - fprintf_unfiltered (log, "\n\tcall_dummy_stack_adjust"); - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->fix_call_dummy == 0)) - fprintf_unfiltered (log, "\n\tfix_call_dummy"); + /* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */ + /* Skip verify of fix_call_dummy, has predicate */ /* Skip verify of deprecated_init_frame_pc_first, has predicate */ /* Skip verify of deprecated_init_frame_pc, has predicate */ - /* Skip verify of get_saved_register, has predicate */ + /* Skip verify of deprecated_get_saved_register, has predicate */ /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ @@ -718,13 +687,12 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_to_pointer, invalid_p == 0 */ /* Skip verify of integer_to_address, has predicate */ /* Skip verify of return_value_on_stack, invalid_p == 0 */ - /* Skip verify of push_arguments, invalid_p == 0 */ + /* Skip verify of deprecated_push_arguments, has predicate */ + /* Skip verify of push_dummy_call, has predicate */ /* Skip verify of deprecated_push_dummy_frame, has predicate */ - /* Skip verify of push_return_address, has predicate */ - /* Skip verify of pop_frame, has predicate */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->store_struct_return == 0)) - fprintf_unfiltered (log, "\n\tstore_struct_return"); + /* Skip verify of deprecated_push_return_address, has predicate */ + /* Skip verify of deprecated_pop_frame, has predicate */ + /* Skip verify of deprecated_store_struct_return, has predicate */ /* Skip verify of extract_return_value, invalid_p == 0 */ /* Skip verify of store_return_value, invalid_p == 0 */ /* Skip verify of extract_struct_value_address, has predicate */ @@ -754,22 +722,22 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->frame_args_skip == -1)) fprintf_unfiltered (log, "\n\tframe_args_skip"); /* Skip verify of frameless_function_invocation, invalid_p == 0 */ - /* Skip verify of frame_chain, has predicate */ - /* Skip verify of frame_chain_valid, has predicate */ - /* Skip verify of frame_saved_pc, has predicate */ + /* Skip verify of deprecated_frame_chain, has predicate */ + /* Skip verify of deprecated_frame_chain_valid, has predicate */ + /* Skip verify of deprecated_frame_saved_pc, has predicate */ + /* Skip verify of unwind_pc, has predicate */ /* Skip verify of frame_args_address, invalid_p == 0 */ /* Skip verify of frame_locals_address, invalid_p == 0 */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->saved_pc_after_call == 0)) - fprintf_unfiltered (log, "\n\tsaved_pc_after_call"); + /* Skip verify of deprecated_saved_pc_after_call, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->frame_num_args == 0)) fprintf_unfiltered (log, "\n\tframe_num_args"); /* Skip verify of stack_align, has predicate */ /* Skip verify of frame_align, has predicate */ - /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ + /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */ /* Skip verify of reg_struct_has_addr, has predicate */ /* Skip verify of save_dummy_frame_tos, has predicate */ + /* Skip verify of unwind_dummy_id, has predicate */ if (gdbarch->float_format == 0) gdbarch->float_format = default_float_format (gdbarch); if (gdbarch->double_format == 0) @@ -958,27 +926,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET # %s\n", XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET)); - if (CALL_DUMMY_BREAKPOINT_OFFSET_P) - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n", - (long) CALL_DUMMY_BREAKPOINT_OFFSET); -#endif -#ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P # %s\n", - XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET_P)); fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P = %d\n", - CALL_DUMMY_BREAKPOINT_OFFSET_P); + "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = %ld\n", + (long) CALL_DUMMY_BREAKPOINT_OFFSET); #endif #ifdef CALL_DUMMY_LENGTH fprintf_unfiltered (file, "gdbarch_dump: CALL_DUMMY_LENGTH # %s\n", XSTRING (CALL_DUMMY_LENGTH)); - if (gdbarch->call_dummy_length >= 0) - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n", - CALL_DUMMY_LENGTH); + fprintf_unfiltered (file, + "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n", + CALL_DUMMY_LENGTH); #endif #ifdef CALL_DUMMY_LOCATION fprintf_unfiltered (file, @@ -988,37 +946,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: CALL_DUMMY_LOCATION = %d\n", CALL_DUMMY_LOCATION); #endif -#ifdef CALL_DUMMY_P - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_P # %s\n", - XSTRING (CALL_DUMMY_P)); - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_P = %d\n", - CALL_DUMMY_P); -#endif -#ifdef CALL_DUMMY_STACK_ADJUST - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_STACK_ADJUST # %s\n", - XSTRING (CALL_DUMMY_STACK_ADJUST)); - if (CALL_DUMMY_STACK_ADJUST_P) - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n", - (long) CALL_DUMMY_STACK_ADJUST); -#endif -#ifdef CALL_DUMMY_STACK_ADJUST_P - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P # %s\n", - XSTRING (CALL_DUMMY_STACK_ADJUST_P)); - fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n", - (long) CALL_DUMMY_STACK_ADJUST_P); -#endif #ifdef CALL_DUMMY_START_OFFSET fprintf_unfiltered (file, "gdbarch_dump: CALL_DUMMY_START_OFFSET # %s\n", XSTRING (CALL_DUMMY_START_OFFSET)); fprintf_unfiltered (file, - "gdbarch_dump: CALL_DUMMY_START_OFFSET = 0x%08lx\n", + "gdbarch_dump: CALL_DUMMY_START_OFFSET = %ld\n", (long) CALL_DUMMY_START_OFFSET); #endif #ifdef CALL_DUMMY_WORDS @@ -1107,6 +1040,23 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n", (long) DECR_PC_AFTER_BREAK); #endif +#ifdef DEPRECATED_CALL_DUMMY_STACK_ADJUST_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_CALL_DUMMY_STACK_ADJUST_P()", + XSTRING (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() = %d\n", + DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()); +#endif +#ifdef DEPRECATED_CALL_DUMMY_STACK_ADJUST + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST # %s\n", + XSTRING (DEPRECATED_CALL_DUMMY_STACK_ADJUST)); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST = %d\n", + DEPRECATED_CALL_DUMMY_STACK_ADJUST); +#endif #ifdef DEPRECATED_DO_REGISTERS_INFO_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1130,6 +1080,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_do_registers_info /*DEPRECATED_DO_REGISTERS_INFO ()*/); #endif +#ifdef DEPRECATED_DUMMY_WRITE_SP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DUMMY_WRITE_SP_P()", + XSTRING (DEPRECATED_DUMMY_WRITE_SP_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP_P() = %d\n", + DEPRECATED_DUMMY_WRITE_SP_P ()); +#endif +#ifdef DEPRECATED_DUMMY_WRITE_SP +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_DUMMY_WRITE_SP(val)", + XSTRING (DEPRECATED_DUMMY_WRITE_SP (val))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP = <0x%08lx>\n", + (long) current_gdbarch->deprecated_dummy_write_sp + /*DEPRECATED_DUMMY_WRITE_SP ()*/); +#endif #ifdef DEPRECATED_EXTRACT_RETURN_VALUE #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1164,6 +1137,54 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_extract_struct_value_address /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); #endif +#ifdef DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", + XSTRING (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", + DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED); +#endif +#ifdef DEPRECATED_FRAME_CHAIN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_P()", + XSTRING (DEPRECATED_FRAME_CHAIN_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_CHAIN_P() = %d\n", + DEPRECATED_FRAME_CHAIN_P ()); +#endif +#ifdef DEPRECATED_FRAME_CHAIN + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN(frame)", + XSTRING (DEPRECATED_FRAME_CHAIN (frame))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_CHAIN = <0x%08lx>\n", + (long) current_gdbarch->deprecated_frame_chain + /*DEPRECATED_FRAME_CHAIN ()*/); +#endif +#ifdef DEPRECATED_FRAME_CHAIN_VALID_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_VALID_P()", + XSTRING (DEPRECATED_FRAME_CHAIN_VALID_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_CHAIN_VALID_P() = %d\n", + DEPRECATED_FRAME_CHAIN_VALID_P ()); +#endif +#ifdef DEPRECATED_FRAME_CHAIN_VALID + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe)", + XSTRING (DEPRECATED_FRAME_CHAIN_VALID (chain, thisframe))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_CHAIN_VALID = <0x%08lx>\n", + (long) current_gdbarch->deprecated_frame_chain_valid + /*DEPRECATED_FRAME_CHAIN_VALID ()*/); +#endif #ifdef DEPRECATED_FRAME_INIT_SAVED_REGS_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1187,6 +1208,49 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_frame_init_saved_regs /*DEPRECATED_FRAME_INIT_SAVED_REGS ()*/); #endif +#ifdef DEPRECATED_FRAME_SAVED_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC_P()", + XSTRING (DEPRECATED_FRAME_SAVED_PC_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC_P() = %d\n", + DEPRECATED_FRAME_SAVED_PC_P ()); +#endif +#ifdef DEPRECATED_FRAME_SAVED_PC + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_FRAME_SAVED_PC(fi)", + XSTRING (DEPRECATED_FRAME_SAVED_PC (fi))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC = <0x%08lx>\n", + (long) current_gdbarch->deprecated_frame_saved_pc + /*DEPRECATED_FRAME_SAVED_PC ()*/); +#endif +#ifdef DEPRECATED_GET_SAVED_REGISTER_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_GET_SAVED_REGISTER_P()", + XSTRING (DEPRECATED_GET_SAVED_REGISTER_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_GET_SAVED_REGISTER_P() = %d\n", + DEPRECATED_GET_SAVED_REGISTER_P ()); +#endif +#ifdef DEPRECATED_GET_SAVED_REGISTER +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)", + XSTRING (DEPRECATED_GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_GET_SAVED_REGISTER = <0x%08lx>\n", + (long) current_gdbarch->deprecated_get_saved_register + /*DEPRECATED_GET_SAVED_REGISTER ()*/); +#endif #ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1304,6 +1368,49 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_pc_in_call_dummy /*DEPRECATED_PC_IN_CALL_DUMMY ()*/); #endif +#ifdef DEPRECATED_POP_FRAME_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_POP_FRAME_P()", + XSTRING (DEPRECATED_POP_FRAME_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_POP_FRAME_P() = %d\n", + DEPRECATED_POP_FRAME_P ()); +#endif +#ifdef DEPRECATED_POP_FRAME +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_POP_FRAME(-)", + XSTRING (DEPRECATED_POP_FRAME (-))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_POP_FRAME = <0x%08lx>\n", + (long) current_gdbarch->deprecated_pop_frame + /*DEPRECATED_POP_FRAME ()*/); +#endif +#ifdef DEPRECATED_PUSH_ARGUMENTS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS_P()", + XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS_P() = %d\n", + DEPRECATED_PUSH_ARGUMENTS_P ()); +#endif +#ifdef DEPRECATED_PUSH_ARGUMENTS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)", + XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS = <0x%08lx>\n", + (long) current_gdbarch->deprecated_push_arguments + /*DEPRECATED_PUSH_ARGUMENTS ()*/); +#endif #ifdef DEPRECATED_PUSH_DUMMY_FRAME_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1327,6 +1434,46 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_push_dummy_frame /*DEPRECATED_PUSH_DUMMY_FRAME ()*/); #endif +#ifdef DEPRECATED_PUSH_RETURN_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_RETURN_ADDRESS_P()", + XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS_P() = %d\n", + DEPRECATED_PUSH_RETURN_ADDRESS_P ()); +#endif +#ifdef DEPRECATED_PUSH_RETURN_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp)", + XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS (pc, sp))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS = <0x%08lx>\n", + (long) current_gdbarch->deprecated_push_return_address + /*DEPRECATED_PUSH_RETURN_ADDRESS ()*/); +#endif +#ifdef DEPRECATED_SAVED_PC_AFTER_CALL_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVED_PC_AFTER_CALL_P()", + XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_SAVED_PC_AFTER_CALL_P() = %d\n", + DEPRECATED_SAVED_PC_AFTER_CALL_P ()); +#endif +#ifdef DEPRECATED_SAVED_PC_AFTER_CALL + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_SAVED_PC_AFTER_CALL(frame)", + XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL (frame))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_SAVED_PC_AFTER_CALL = <0x%08lx>\n", + (long) current_gdbarch->deprecated_saved_pc_after_call + /*DEPRECATED_SAVED_PC_AFTER_CALL ()*/); +#endif #ifdef DEPRECATED_STORE_RETURN_VALUE #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1341,6 +1488,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_store_return_value /*DEPRECATED_STORE_RETURN_VALUE ()*/); #endif +#ifdef DEPRECATED_STORE_STRUCT_RETURN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STORE_STRUCT_RETURN_P()", + XSTRING (DEPRECATED_STORE_STRUCT_RETURN_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_STORE_STRUCT_RETURN_P() = %d\n", + DEPRECATED_STORE_STRUCT_RETURN_P ()); +#endif +#ifdef DEPRECATED_STORE_STRUCT_RETURN +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_STORE_STRUCT_RETURN(addr, sp)", + XSTRING (DEPRECATED_STORE_STRUCT_RETURN (addr, sp))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_STORE_STRUCT_RETURN = <0x%08lx>\n", + (long) current_gdbarch->deprecated_store_struct_return + /*DEPRECATED_STORE_STRUCT_RETURN ()*/); +#endif #ifdef DEPRECATED_USE_GENERIC_DUMMY_FRAMES fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_USE_GENERIC_DUMMY_FRAMES # %s\n", @@ -1453,13 +1623,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->extract_struct_value_address /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); #endif -#ifdef EXTRA_STACK_ALIGNMENT_NEEDED +#ifdef FIX_CALL_DUMMY_P fprintf_unfiltered (file, - "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", - XSTRING (EXTRA_STACK_ALIGNMENT_NEEDED)); + "gdbarch_dump: %s # %s\n", + "FIX_CALL_DUMMY_P()", + XSTRING (FIX_CALL_DUMMY_P ())); fprintf_unfiltered (file, - "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %d\n", - EXTRA_STACK_ALIGNMENT_NEEDED); + "gdbarch_dump: FIX_CALL_DUMMY_P() = %d\n", + FIX_CALL_DUMMY_P ()); #endif #ifdef FIX_CALL_DUMMY #if GDB_MULTI_ARCH @@ -1521,46 +1692,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: FRAME_ARGS_SKIP = %ld\n", (long) FRAME_ARGS_SKIP); #endif -#ifdef FRAME_CHAIN_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_CHAIN_P()", - XSTRING (FRAME_CHAIN_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_CHAIN_P() = %d\n", - FRAME_CHAIN_P ()); -#endif -#ifdef FRAME_CHAIN - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_CHAIN(frame)", - XSTRING (FRAME_CHAIN (frame))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_CHAIN = <0x%08lx>\n", - (long) current_gdbarch->frame_chain - /*FRAME_CHAIN ()*/); -#endif -#ifdef FRAME_CHAIN_VALID_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_CHAIN_VALID_P()", - XSTRING (FRAME_CHAIN_VALID_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_CHAIN_VALID_P() = %d\n", - FRAME_CHAIN_VALID_P ()); -#endif -#ifdef FRAME_CHAIN_VALID - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_CHAIN_VALID(chain, thisframe)", - XSTRING (FRAME_CHAIN_VALID (chain, thisframe))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_CHAIN_VALID = <0x%08lx>\n", - (long) current_gdbarch->frame_chain_valid - /*FRAME_CHAIN_VALID ()*/); -#endif #ifdef FRAME_LOCALS_ADDRESS fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1583,26 +1714,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->frame_num_args /*FRAME_NUM_ARGS ()*/); #endif -#ifdef FRAME_SAVED_PC_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_SAVED_PC_P()", - XSTRING (FRAME_SAVED_PC_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_SAVED_PC_P() = %d\n", - FRAME_SAVED_PC_P ()); -#endif -#ifdef FRAME_SAVED_PC - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "FRAME_SAVED_PC(fi)", - XSTRING (FRAME_SAVED_PC (fi))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: FRAME_SAVED_PC = <0x%08lx>\n", - (long) current_gdbarch->frame_saved_pc - /*FRAME_SAVED_PC ()*/); -#endif #ifdef FUNCTION_START_OFFSET fprintf_unfiltered (file, "gdbarch_dump: FUNCTION_START_OFFSET # %s\n", @@ -1631,29 +1742,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->get_longjmp_target /*GET_LONGJMP_TARGET ()*/); #endif -#ifdef GET_SAVED_REGISTER_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "GET_SAVED_REGISTER_P()", - XSTRING (GET_SAVED_REGISTER_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: GET_SAVED_REGISTER_P() = %d\n", - GET_SAVED_REGISTER_P ()); -#endif -#ifdef GET_SAVED_REGISTER -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)", - XSTRING (GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: GET_SAVED_REGISTER = <0x%08lx>\n", - (long) current_gdbarch->get_saved_register - /*GET_SAVED_REGISTER ()*/); -#endif #ifdef HAVE_NONSTEPPABLE_WATCHPOINT fprintf_unfiltered (file, "gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n", @@ -1807,29 +1895,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->pointer_to_address /*POINTER_TO_ADDRESS ()*/); #endif -#ifdef POP_FRAME_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "POP_FRAME_P()", - XSTRING (POP_FRAME_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: POP_FRAME_P() = %d\n", - POP_FRAME_P ()); -#endif -#ifdef POP_FRAME -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "POP_FRAME(-)", - XSTRING (POP_FRAME (-))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: POP_FRAME = <0x%08lx>\n", - (long) current_gdbarch->pop_frame - /*POP_FRAME ()*/); -#endif #ifdef PREPARE_TO_PROCEED fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1880,37 +1945,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: PS_REGNUM = %d\n", PS_REGNUM); #endif -#ifdef PUSH_ARGUMENTS - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)", - XSTRING (PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr))); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: PUSH_ARGUMENTS = <0x%08lx>\n", - (long) current_gdbarch->push_arguments - /*PUSH_ARGUMENTS ()*/); -#endif -#ifdef PUSH_RETURN_ADDRESS_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PUSH_RETURN_ADDRESS_P()", - XSTRING (PUSH_RETURN_ADDRESS_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: PUSH_RETURN_ADDRESS_P() = %d\n", - PUSH_RETURN_ADDRESS_P ()); -#endif -#ifdef PUSH_RETURN_ADDRESS - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PUSH_RETURN_ADDRESS(pc, sp)", - XSTRING (PUSH_RETURN_ADDRESS (pc, sp))); + "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n", + gdbarch_push_dummy_call_p (current_gdbarch)); if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: PUSH_RETURN_ADDRESS = <0x%08lx>\n", - (long) current_gdbarch->push_return_address - /*PUSH_RETURN_ADDRESS ()*/); -#endif + "gdbarch_dump: push_dummy_call = 0x%08lx\n", + (long) current_gdbarch->push_dummy_call); #ifdef REGISTER_BYTE fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2128,17 +2170,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->return_value_on_stack /*RETURN_VALUE_ON_STACK ()*/); #endif -#ifdef SAVED_PC_AFTER_CALL - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "SAVED_PC_AFTER_CALL(frame)", - XSTRING (SAVED_PC_AFTER_CALL (frame))); - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: SAVED_PC_AFTER_CALL = <0x%08lx>\n", - (long) current_gdbarch->saved_pc_after_call - /*SAVED_PC_AFTER_CALL ()*/); -#endif #ifdef SAVE_DUMMY_FRAME_TOS_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2218,8 +2249,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS # %s\n", XSTRING (SIZEOF_CALL_DUMMY_WORDS)); fprintf_unfiltered (file, - "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n", - (long) SIZEOF_CALL_DUMMY_WORDS); + "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = %d\n", + SIZEOF_CALL_DUMMY_WORDS); #endif #ifdef SKIP_PROLOGUE fprintf_unfiltered (file, @@ -2330,20 +2361,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->store_return_value /*STORE_RETURN_VALUE ()*/); #endif -#ifdef STORE_STRUCT_RETURN -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "STORE_STRUCT_RETURN(addr, sp)", - XSTRING (STORE_STRUCT_RETURN (addr, sp))); -#endif - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: STORE_STRUCT_RETURN = <0x%08lx>\n", - (long) current_gdbarch->store_struct_return - /*STORE_STRUCT_RETURN ()*/); -#endif #ifdef TARGET_ADDR_BIT fprintf_unfiltered (file, "gdbarch_dump: TARGET_ADDR_BIT # %s\n", @@ -2553,20 +2570,22 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->write_pc /*TARGET_WRITE_PC ()*/); #endif -#ifdef TARGET_WRITE_SP -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "TARGET_WRITE_SP(val)", - XSTRING (TARGET_WRITE_SP (val))); -#endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: TARGET_WRITE_SP = <0x%08lx>\n", - (long) current_gdbarch->write_sp - /*TARGET_WRITE_SP ()*/); -#endif + "gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n", + gdbarch_unwind_dummy_id_p (current_gdbarch)); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: unwind_dummy_id = 0x%08lx\n", + (long) current_gdbarch->unwind_dummy_id); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n", + gdbarch_unwind_pc_p (current_gdbarch)); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: unwind_pc = 0x%08lx\n", + (long) current_gdbarch->unwind_pc); #ifdef USE_STRUCT_CONVENTION fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2899,23 +2918,30 @@ set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch->read_sp = read_sp; } +int +gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_dummy_write_sp != 0; +} + void -gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val) +gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val) { gdb_assert (gdbarch != NULL); - if (gdbarch->write_sp == 0) + if (gdbarch->deprecated_dummy_write_sp == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_write_sp invalid"); + "gdbarch: gdbarch_deprecated_dummy_write_sp invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n"); - gdbarch->write_sp (val); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n"); + gdbarch->deprecated_dummy_write_sp (val); } void -set_gdbarch_write_sp (struct gdbarch *gdbarch, - gdbarch_write_sp_ftype write_sp) +set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, + gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp) { - gdbarch->write_sp = write_sp; + gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp; } void @@ -3697,9 +3723,6 @@ CORE_ADDR gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_start_offset == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_start_offset invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n"); return gdbarch->call_dummy_start_offset; @@ -3716,9 +3739,6 @@ CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_breakpoint_offset invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n"); return gdbarch->call_dummy_breakpoint_offset; @@ -3732,31 +3752,9 @@ set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, } int -gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_breakpoint_offset_p == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n"); - return gdbarch->call_dummy_breakpoint_offset_p; -} - -void -set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, - int call_dummy_breakpoint_offset_p) -{ - gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p; -} - -int gdbarch_call_dummy_length (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_length == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_length invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n"); return gdbarch->call_dummy_length; @@ -3796,25 +3794,6 @@ set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy; } -int -gdbarch_call_dummy_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_p == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_p invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n"); - return gdbarch->call_dummy_p; -} - -void -set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, - int call_dummy_p) -{ - gdbarch->call_dummy_p = call_dummy_p; -} - LONGEST * gdbarch_call_dummy_words (struct gdbarch *gdbarch) { @@ -3850,41 +3829,33 @@ set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, } int -gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch) +gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_stack_adjust_p == -1) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_stack_adjust_p invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust_p called\n"); - return gdbarch->call_dummy_stack_adjust_p; -} - -void -set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, - int call_dummy_stack_adjust_p) -{ - gdbarch->call_dummy_stack_adjust_p = call_dummy_stack_adjust_p; + return gdbarch->deprecated_call_dummy_stack_adjust != 0; } int -gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch) +gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_call_dummy_stack_adjust invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust called\n"); - return gdbarch->call_dummy_stack_adjust; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_stack_adjust called\n"); + return gdbarch->deprecated_call_dummy_stack_adjust; } void -set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch, - int call_dummy_stack_adjust) +set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch, + int deprecated_call_dummy_stack_adjust) +{ + gdbarch->deprecated_call_dummy_stack_adjust = deprecated_call_dummy_stack_adjust; +} + +int +gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch) { - gdbarch->call_dummy_stack_adjust = call_dummy_stack_adjust; + gdb_assert (gdbarch != NULL); + return gdbarch->fix_call_dummy != 0; } void @@ -3991,29 +3962,29 @@ set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, } int -gdbarch_get_saved_register_p (struct gdbarch *gdbarch) +gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->get_saved_register != 0; + return gdbarch->deprecated_get_saved_register != 0; } void -gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) +gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) { gdb_assert (gdbarch != NULL); - if (gdbarch->get_saved_register == 0) + if (gdbarch->deprecated_get_saved_register == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_get_saved_register invalid"); + "gdbarch: gdbarch_deprecated_get_saved_register invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_get_saved_register called\n"); - gdbarch->get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_get_saved_register called\n"); + gdbarch->deprecated_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval); } void -set_gdbarch_get_saved_register (struct gdbarch *gdbarch, - gdbarch_get_saved_register_ftype get_saved_register) +set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, + gdbarch_deprecated_get_saved_register_ftype deprecated_get_saved_register) { - gdbarch->get_saved_register = get_saved_register; + gdbarch->deprecated_get_saved_register = deprecated_get_saved_register; } int @@ -4213,23 +4184,56 @@ set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch->return_value_on_stack = return_value_on_stack; } +int +gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_push_arguments != 0; +} + +CORE_ADDR +gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_push_arguments == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_push_arguments invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n"); + return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr); +} + +void +set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, + gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments) +{ + gdbarch->deprecated_push_arguments = deprecated_push_arguments; +} + +int +gdbarch_push_dummy_call_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->push_dummy_call != 0; +} + CORE_ADDR -gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) +gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { gdb_assert (gdbarch != NULL); - if (gdbarch->push_arguments == 0) + if (gdbarch->push_dummy_call == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_push_arguments invalid"); + "gdbarch: gdbarch_push_dummy_call invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n"); - return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr); + fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n"); + return gdbarch->push_dummy_call (gdbarch, regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr); } void -set_gdbarch_push_arguments (struct gdbarch *gdbarch, - gdbarch_push_arguments_ftype push_arguments) +set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, + gdbarch_push_dummy_call_ftype push_dummy_call) { - gdbarch->push_arguments = push_arguments; + gdbarch->push_dummy_call = push_dummy_call; } int @@ -4259,74 +4263,81 @@ set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, } int -gdbarch_push_return_address_p (struct gdbarch *gdbarch) +gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->push_return_address != 0; + return gdbarch->deprecated_push_return_address != 0; } CORE_ADDR -gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) +gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp) { gdb_assert (gdbarch != NULL); - if (gdbarch->push_return_address == 0) + if (gdbarch->deprecated_push_return_address == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_push_return_address invalid"); + "gdbarch: gdbarch_deprecated_push_return_address invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n"); - return gdbarch->push_return_address (pc, sp); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n"); + return gdbarch->deprecated_push_return_address (pc, sp); } void -set_gdbarch_push_return_address (struct gdbarch *gdbarch, - gdbarch_push_return_address_ftype push_return_address) +set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, + gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address) { - gdbarch->push_return_address = push_return_address; + gdbarch->deprecated_push_return_address = deprecated_push_return_address; } int -gdbarch_pop_frame_p (struct gdbarch *gdbarch) +gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->pop_frame != 0; + return gdbarch->deprecated_pop_frame != 0; } void -gdbarch_pop_frame (struct gdbarch *gdbarch) +gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - if (gdbarch->pop_frame == 0) + if (gdbarch->deprecated_pop_frame == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_pop_frame invalid"); + "gdbarch: gdbarch_deprecated_pop_frame invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_pop_frame called\n"); - gdbarch->pop_frame (); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_pop_frame called\n"); + gdbarch->deprecated_pop_frame (); } void -set_gdbarch_pop_frame (struct gdbarch *gdbarch, - gdbarch_pop_frame_ftype pop_frame) +set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch, + gdbarch_deprecated_pop_frame_ftype deprecated_pop_frame) { - gdbarch->pop_frame = pop_frame; + gdbarch->deprecated_pop_frame = deprecated_pop_frame; +} + +int +gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_store_struct_return != 0; } void -gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) +gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) { gdb_assert (gdbarch != NULL); - if (gdbarch->store_struct_return == 0) + if (gdbarch->deprecated_store_struct_return == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_store_struct_return invalid"); + "gdbarch: gdbarch_deprecated_store_struct_return invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_store_struct_return called\n"); - gdbarch->store_struct_return (addr, sp); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_struct_return called\n"); + gdbarch->deprecated_store_struct_return (addr, sp); } void -set_gdbarch_store_struct_return (struct gdbarch *gdbarch, - gdbarch_store_struct_return_ftype store_struct_return) +set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, + gdbarch_deprecated_store_struct_return_ftype deprecated_store_struct_return) { - gdbarch->store_struct_return = store_struct_return; + gdbarch->deprecated_store_struct_return = deprecated_store_struct_return; } void @@ -4757,81 +4768,107 @@ set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, } int -gdbarch_frame_chain_p (struct gdbarch *gdbarch) +gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->frame_chain != 0; + return gdbarch->deprecated_frame_chain != 0; } CORE_ADDR -gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) +gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) { gdb_assert (gdbarch != NULL); - if (gdbarch->frame_chain == 0) + if (gdbarch->deprecated_frame_chain == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_frame_chain invalid"); + "gdbarch: gdbarch_deprecated_frame_chain invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain called\n"); - return gdbarch->frame_chain (frame); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain called\n"); + return gdbarch->deprecated_frame_chain (frame); } void -set_gdbarch_frame_chain (struct gdbarch *gdbarch, - gdbarch_frame_chain_ftype frame_chain) +set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_chain_ftype deprecated_frame_chain) +{ + gdbarch->deprecated_frame_chain = deprecated_frame_chain; +} + +int +gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch) { - gdbarch->frame_chain = frame_chain; + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_chain_valid != 0; } int -gdbarch_frame_chain_valid_p (struct gdbarch *gdbarch) +gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe) { gdb_assert (gdbarch != NULL); - return gdbarch->frame_chain_valid != 0; + if (gdbarch->deprecated_frame_chain_valid == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_frame_chain_valid invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain_valid called\n"); + return gdbarch->deprecated_frame_chain_valid (chain, thisframe); +} + +void +set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_chain_valid_ftype deprecated_frame_chain_valid) +{ + gdbarch->deprecated_frame_chain_valid = deprecated_frame_chain_valid; } int -gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe) +gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_frame_saved_pc != 0; +} + +CORE_ADDR +gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) { gdb_assert (gdbarch != NULL); - if (gdbarch->frame_chain_valid == 0) + if (gdbarch->deprecated_frame_saved_pc == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_frame_chain_valid invalid"); + "gdbarch: gdbarch_deprecated_frame_saved_pc invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain_valid called\n"); - return gdbarch->frame_chain_valid (chain, thisframe); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_saved_pc called\n"); + return gdbarch->deprecated_frame_saved_pc (fi); } void -set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, - gdbarch_frame_chain_valid_ftype frame_chain_valid) +set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, + gdbarch_deprecated_frame_saved_pc_ftype deprecated_frame_saved_pc) { - gdbarch->frame_chain_valid = frame_chain_valid; + gdbarch->deprecated_frame_saved_pc = deprecated_frame_saved_pc; } int -gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch) +gdbarch_unwind_pc_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->frame_saved_pc != 0; + return gdbarch->unwind_pc != 0; } CORE_ADDR -gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) +gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { gdb_assert (gdbarch != NULL); - if (gdbarch->frame_saved_pc == 0) + if (gdbarch->unwind_pc == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_frame_saved_pc invalid"); + "gdbarch: gdbarch_unwind_pc invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n"); - return gdbarch->frame_saved_pc (fi); + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n"); + return gdbarch->unwind_pc (gdbarch, next_frame); } void -set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, - gdbarch_frame_saved_pc_ftype frame_saved_pc) +set_gdbarch_unwind_pc (struct gdbarch *gdbarch, + gdbarch_unwind_pc_ftype unwind_pc) { - gdbarch->frame_saved_pc = frame_saved_pc; + gdbarch->unwind_pc = unwind_pc; } CORE_ADDR @@ -4872,23 +4909,30 @@ set_gdbarch_frame_locals_address (struct gdbarch *gdbarch, gdbarch->frame_locals_address = frame_locals_address; } +int +gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_saved_pc_after_call != 0; +} + CORE_ADDR -gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame) +gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame) { gdb_assert (gdbarch != NULL); - if (gdbarch->saved_pc_after_call == 0) + if (gdbarch->deprecated_saved_pc_after_call == 0) internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_saved_pc_after_call invalid"); + "gdbarch: gdbarch_deprecated_saved_pc_after_call invalid"); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_saved_pc_after_call called\n"); - return gdbarch->saved_pc_after_call (frame); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_saved_pc_after_call called\n"); + return gdbarch->deprecated_saved_pc_after_call (frame); } void -set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, - gdbarch_saved_pc_after_call_ftype saved_pc_after_call) +set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, + gdbarch_deprecated_saved_pc_after_call_ftype deprecated_saved_pc_after_call) { - gdbarch->saved_pc_after_call = saved_pc_after_call; + gdbarch->deprecated_saved_pc_after_call = deprecated_saved_pc_after_call; } int @@ -4963,20 +5007,20 @@ set_gdbarch_frame_align (struct gdbarch *gdbarch, } int -gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch) +gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */ + /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */ if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_extra_stack_alignment_needed called\n"); - return gdbarch->extra_stack_alignment_needed; + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extra_stack_alignment_needed called\n"); + return gdbarch->deprecated_extra_stack_alignment_needed; } void -set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, - int extra_stack_alignment_needed) +set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, + int deprecated_extra_stack_alignment_needed) { - gdbarch->extra_stack_alignment_needed = extra_stack_alignment_needed; + gdbarch->deprecated_extra_stack_alignment_needed = deprecated_extra_stack_alignment_needed; } int @@ -5032,6 +5076,32 @@ set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, } int +gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->unwind_dummy_id != 0; +} + +struct frame_id +gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->unwind_dummy_id == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_unwind_dummy_id invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n"); + return gdbarch->unwind_dummy_id (gdbarch, info); +} + +void +set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, + gdbarch_unwind_dummy_id_ftype unwind_dummy_id) +{ + gdbarch->unwind_dummy_id = unwind_dummy_id; +} + +int gdbarch_parm_boundary (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 59dd3d6..7b2641b 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -39,8 +39,11 @@ #if !GDB_MULTI_ARCH /* Pull in function declarations refered to, indirectly, via macros. */ #include "inferior.h" /* For unsigned_address_to_pointer(). */ +#include "symfile.h" /* For entry_point_address(). */ #endif +struct floatformat; +struct ui_file; struct frame_info; struct value; struct objfile; @@ -54,18 +57,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif @@ -388,20 +379,42 @@ extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype #endif #endif +/* The dummy call frame SP should be set by push_dummy_call. */ + +#if defined (DEPRECATED_DUMMY_WRITE_SP) +/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */ +#if !defined (DEPRECATED_DUMMY_WRITE_SP_P) +#define DEPRECATED_DUMMY_WRITE_SP_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP_P) +#define DEPRECATED_DUMMY_WRITE_SP_P() (0) +#endif + +extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P) +#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP_P) +#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_SP) -#define TARGET_WRITE_SP(val) (generic_target_write_sp (val)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP) +#define DEPRECATED_DUMMY_WRITE_SP(val) (internal_error (__FILE__, __LINE__, "DEPRECATED_DUMMY_WRITE_SP"), 0) #endif -typedef void (gdbarch_write_sp_ftype) (CORE_ADDR val); -extern void gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val); -extern void set_gdbarch_write_sp (struct gdbarch *gdbarch, gdbarch_write_sp_ftype *write_sp); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_WRITE_SP) -#error "Non multi-arch definition of TARGET_WRITE_SP" +typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val); +extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val); +extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP) +#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_SP) -#define TARGET_WRITE_SP(val) (gdbarch_write_sp (current_gdbarch, val)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP) +#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val)) #endif #endif @@ -1093,14 +1106,12 @@ extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch); extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) +#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch)) #endif -#endif /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION) @@ -1109,13 +1120,16 @@ extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdb extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION) #error "Non multi-arch definition of CALL_DUMMY_LOCATION" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION) +#if !defined (CALL_DUMMY_LOCATION) #define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch)) #endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS) +#define CALL_DUMMY_ADDRESS() (entry_point_address ()) #endif typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) (void); @@ -1135,44 +1149,27 @@ extern void set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_A #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_START_OFFSET) #error "Non multi-arch definition of CALL_DUMMY_START_OFFSET" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_START_OFFSET) +#if !defined (CALL_DUMMY_START_OFFSET) #define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch)) #endif -#endif extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET) #error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET) +#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET) #define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch)) #endif -#endif - -extern int gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch); -extern void set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) -#error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET_P" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P) -#define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch)) -#endif -#endif extern int gdbarch_call_dummy_length (struct gdbarch *gdbarch); extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dummy_length); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LENGTH) #error "Non multi-arch definition of CALL_DUMMY_LENGTH" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LENGTH) +#if !defined (CALL_DUMMY_LENGTH) #define CALL_DUMMY_LENGTH (gdbarch_call_dummy_length (current_gdbarch)) #endif -#endif /* NOTE: cagney/2002-11-24: This function with predicate has a valid (callable) initial value. As a consequence, even when the predicate @@ -1193,10 +1190,10 @@ extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dum #endif extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P) #define DEPRECATED_PC_IN_CALL_DUMMY_P() (gdbarch_deprecated_pc_in_call_dummy_p (current_gdbarch)) #endif @@ -1208,26 +1205,15 @@ extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch); typedef int (gdbarch_deprecated_pc_in_call_dummy_ftype) (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern int gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address); extern void set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY) #error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY) #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_deprecated_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address)) #endif #endif -extern int gdbarch_call_dummy_p (struct gdbarch *gdbarch); -extern void set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, int call_dummy_p); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_P) -#error "Non multi-arch definition of CALL_DUMMY_P" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P) -#define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch)) -#endif -#endif - /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_WORDS) #define CALL_DUMMY_WORDS (legacy_call_dummy_words) @@ -1238,11 +1224,9 @@ extern void set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, LONGEST * cal #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_WORDS) #error "Non multi-arch definition of CALL_DUMMY_WORDS" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_WORDS) +#if !defined (CALL_DUMMY_WORDS) #define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch)) #endif -#endif /* Default (value) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (SIZEOF_CALL_DUMMY_WORDS) @@ -1254,34 +1238,71 @@ extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int si #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIZEOF_CALL_DUMMY_WORDS) #error "Non multi-arch definition of SIZEOF_CALL_DUMMY_WORDS" #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIZEOF_CALL_DUMMY_WORDS) +#if !defined (SIZEOF_CALL_DUMMY_WORDS) #define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch)) #endif + +#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST) +/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */ +#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P) +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (1) +#endif #endif -extern int gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch); -extern void set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, int call_dummy_stack_adjust_p); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST_P) -#error "Non multi-arch definition of CALL_DUMMY_STACK_ADJUST_P" +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P) +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (0) #endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST_P) -#define CALL_DUMMY_STACK_ADJUST_P (gdbarch_call_dummy_stack_adjust_p (current_gdbarch)) + +extern int gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P) +#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST" #endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P) +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (gdbarch_deprecated_call_dummy_stack_adjust_p (current_gdbarch)) #endif -extern int gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch); -extern void set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch, int call_dummy_stack_adjust); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST) -#error "Non multi-arch definition of CALL_DUMMY_STACK_ADJUST" +/* Default (value) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST) +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (0) +#endif + +extern int gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch, int deprecated_call_dummy_stack_adjust); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST) +#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST) -#define CALL_DUMMY_STACK_ADJUST (gdbarch_call_dummy_stack_adjust (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST) +#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (gdbarch_deprecated_call_dummy_stack_adjust (current_gdbarch)) +#endif +#endif + +#if defined (FIX_CALL_DUMMY) +/* Legacy for systems yet to multi-arch FIX_CALL_DUMMY */ +#if !defined (FIX_CALL_DUMMY_P) +#define FIX_CALL_DUMMY_P() (1) #endif #endif +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY_P) +#define FIX_CALL_DUMMY_P() (0) +#endif + +extern int gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FIX_CALL_DUMMY_P) +#error "Non multi-arch definition of FIX_CALL_DUMMY" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FIX_CALL_DUMMY_P) +#define FIX_CALL_DUMMY_P() (gdbarch_fix_call_dummy_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY) +#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0) +#endif + typedef void (gdbarch_fix_call_dummy_ftype) (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p); extern void gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p); extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_call_dummy_ftype *fix_call_dummy); @@ -1388,40 +1409,40 @@ extern void set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, int #define BELIEVE_PCC_PROMOTION_TYPE (gdbarch_believe_pcc_promotion_type (current_gdbarch)) #endif -#if defined (GET_SAVED_REGISTER) -/* Legacy for systems yet to multi-arch GET_SAVED_REGISTER */ -#if !defined (GET_SAVED_REGISTER_P) -#define GET_SAVED_REGISTER_P() (1) +#if defined (DEPRECATED_GET_SAVED_REGISTER) +/* Legacy for systems yet to multi-arch DEPRECATED_GET_SAVED_REGISTER */ +#if !defined (DEPRECATED_GET_SAVED_REGISTER_P) +#define DEPRECATED_GET_SAVED_REGISTER_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER_P) -#define GET_SAVED_REGISTER_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_GET_SAVED_REGISTER_P) +#define DEPRECATED_GET_SAVED_REGISTER_P() (0) #endif -extern int gdbarch_get_saved_register_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER_P) -#error "Non multi-arch definition of GET_SAVED_REGISTER" +extern int gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER_P) +#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER_P) -#define GET_SAVED_REGISTER_P() (gdbarch_get_saved_register_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_GET_SAVED_REGISTER_P) +#define DEPRECATED_GET_SAVED_REGISTER_P() (gdbarch_deprecated_get_saved_register_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER) -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (internal_error (__FILE__, __LINE__, "GET_SAVED_REGISTER"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_GET_SAVED_REGISTER) +#define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (internal_error (__FILE__, __LINE__, "DEPRECATED_GET_SAVED_REGISTER"), 0) #endif -typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); -extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); -extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) -#error "Non multi-arch definition of GET_SAVED_REGISTER" +typedef void (gdbarch_deprecated_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); +extern void gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); +extern void set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER) +#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_GET_SAVED_REGISTER) +#define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_deprecated_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) #endif #endif @@ -1615,23 +1636,51 @@ extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_ #endif #endif +/* Replaced by PUSH_DUMMY_CALL */ + +#if defined (DEPRECATED_PUSH_ARGUMENTS) +/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */ +#if !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (0) +#endif + +extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P) +#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS) -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS) +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0) #endif -typedef CORE_ADDR (gdbarch_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); -extern CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); -extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS) -#error "Non multi-arch definition of PUSH_ARGUMENTS" +typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS) +#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS) -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS) +#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr)) #endif #endif +extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr); +extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call); + #if defined (DEPRECATED_PUSH_DUMMY_FRAME) /* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */ #if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P) @@ -1655,7 +1704,6 @@ extern int gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch); /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME) #define DEPRECATED_PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_DUMMY_FRAME"), 0) -#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch)) #endif typedef void (gdbarch_deprecated_push_dummy_frame_ftype) (void); @@ -1670,90 +1718,118 @@ extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gd #endif #endif -#if defined (PUSH_RETURN_ADDRESS) -/* Legacy for systems yet to multi-arch PUSH_RETURN_ADDRESS */ -#if !defined (PUSH_RETURN_ADDRESS_P) -#define PUSH_RETURN_ADDRESS_P() (1) +/* NOTE: This can be handled directly in push_dummy_call. */ + +#if defined (DEPRECATED_PUSH_RETURN_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */ +#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS_P) -#define PUSH_RETURN_ADDRESS_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (0) #endif -extern int gdbarch_push_return_address_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS_P) -#error "Non multi-arch definition of PUSH_RETURN_ADDRESS" +extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS_P) -#define PUSH_RETURN_ADDRESS_P() (gdbarch_push_return_address_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P) +#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS) -#define PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "PUSH_RETURN_ADDRESS"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS) +#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_RETURN_ADDRESS"), 0) #endif -typedef CORE_ADDR (gdbarch_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp); -extern CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp); -extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS) -#error "Non multi-arch definition of PUSH_RETURN_ADDRESS" +typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp); +extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp); +extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS) -#define PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_push_return_address (current_gdbarch, pc, sp)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS) +#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp)) #endif #endif -#if defined (POP_FRAME) -/* Legacy for systems yet to multi-arch POP_FRAME */ -#if !defined (POP_FRAME_P) -#define POP_FRAME_P() (1) +#if defined (DEPRECATED_POP_FRAME) +/* Legacy for systems yet to multi-arch DEPRECATED_POP_FRAME */ +#if !defined (DEPRECATED_POP_FRAME_P) +#define DEPRECATED_POP_FRAME_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME_P) -#define POP_FRAME_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_POP_FRAME_P) +#define DEPRECATED_POP_FRAME_P() (0) #endif -extern int gdbarch_pop_frame_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME_P) -#error "Non multi-arch definition of POP_FRAME" +extern int gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME_P) +#error "Non multi-arch definition of DEPRECATED_POP_FRAME" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME_P) -#define POP_FRAME_P() (gdbarch_pop_frame_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_POP_FRAME_P) +#define DEPRECATED_POP_FRAME_P() (gdbarch_deprecated_pop_frame_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME) -#define POP_FRAME (internal_error (__FILE__, __LINE__, "POP_FRAME"), 0) -#define POP_FRAME (gdbarch_pop_frame (current_gdbarch)) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_POP_FRAME) +#define DEPRECATED_POP_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_POP_FRAME"), 0) #endif -typedef void (gdbarch_pop_frame_ftype) (void); -extern void gdbarch_pop_frame (struct gdbarch *gdbarch); -extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME) -#error "Non multi-arch definition of POP_FRAME" +typedef void (gdbarch_deprecated_pop_frame_ftype) (void); +extern void gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch, gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME) +#error "Non multi-arch definition of DEPRECATED_POP_FRAME" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME) -#define POP_FRAME (gdbarch_pop_frame (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_POP_FRAME) +#define DEPRECATED_POP_FRAME (gdbarch_deprecated_pop_frame (current_gdbarch)) +#endif +#endif + +/* NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. */ + +#if defined (DEPRECATED_STORE_STRUCT_RETURN) +/* Legacy for systems yet to multi-arch DEPRECATED_STORE_STRUCT_RETURN */ +#if !defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#define DEPRECATED_STORE_STRUCT_RETURN_P() (1) +#endif #endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#define DEPRECATED_STORE_STRUCT_RETURN_P() (0) +#endif + +extern int gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_STORE_STRUCT_RETURN_P) +#define DEPRECATED_STORE_STRUCT_RETURN_P() (gdbarch_deprecated_store_struct_return_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_STORE_STRUCT_RETURN) +#define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_STORE_STRUCT_RETURN"), 0) #endif -typedef void (gdbarch_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp); -extern void gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp); -extern void set_gdbarch_store_struct_return (struct gdbarch *gdbarch, gdbarch_store_struct_return_ftype *store_struct_return); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STORE_STRUCT_RETURN) -#error "Non multi-arch definition of STORE_STRUCT_RETURN" +typedef void (gdbarch_deprecated_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp); +extern void gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp); +extern void set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN) +#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_STRUCT_RETURN) -#define STORE_STRUCT_RETURN(addr, sp) (gdbarch_store_struct_return (current_gdbarch, addr, sp)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_STORE_STRUCT_RETURN) +#define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (gdbarch_deprecated_store_struct_return (current_gdbarch, addr, sp)) #endif #endif @@ -2156,117 +2232,127 @@ extern void set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, #endif #endif -#if defined (FRAME_CHAIN) -/* Legacy for systems yet to multi-arch FRAME_CHAIN */ -#if !defined (FRAME_CHAIN_P) -#define FRAME_CHAIN_P() (1) +#if defined (DEPRECATED_FRAME_CHAIN) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN */ +#if !defined (DEPRECATED_FRAME_CHAIN_P) +#define DEPRECATED_FRAME_CHAIN_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_P) -#define FRAME_CHAIN_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_P) +#define DEPRECATED_FRAME_CHAIN_P() (0) #endif -extern int gdbarch_frame_chain_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_P) -#error "Non multi-arch definition of FRAME_CHAIN" +extern int gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_P) -#define FRAME_CHAIN_P() (gdbarch_frame_chain_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_P) +#define DEPRECATED_FRAME_CHAIN_P() (gdbarch_deprecated_frame_chain_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN) -#define FRAME_CHAIN(frame) (internal_error (__FILE__, __LINE__, "FRAME_CHAIN"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN) +#define DEPRECATED_FRAME_CHAIN(frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_CHAIN"), 0) #endif -typedef CORE_ADDR (gdbarch_frame_chain_ftype) (struct frame_info *frame); -extern CORE_ADDR gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame); -extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chain_ftype *frame_chain); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN) -#error "Non multi-arch definition of FRAME_CHAIN" +typedef CORE_ADDR (gdbarch_deprecated_frame_chain_ftype) (struct frame_info *frame); +extern CORE_ADDR gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN) -#define FRAME_CHAIN(frame) (gdbarch_frame_chain (current_gdbarch, frame)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN) +#define DEPRECATED_FRAME_CHAIN(frame) (gdbarch_deprecated_frame_chain (current_gdbarch, frame)) #endif #endif -#if defined (FRAME_CHAIN_VALID) -/* Legacy for systems yet to multi-arch FRAME_CHAIN_VALID */ -#if !defined (FRAME_CHAIN_VALID_P) -#define FRAME_CHAIN_VALID_P() (1) +#if defined (DEPRECATED_FRAME_CHAIN_VALID) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN_VALID */ +#if !defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#define DEPRECATED_FRAME_CHAIN_VALID_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID_P) -#define FRAME_CHAIN_VALID_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#define DEPRECATED_FRAME_CHAIN_VALID_P() (0) #endif -extern int gdbarch_frame_chain_valid_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID_P) -#error "Non multi-arch definition of FRAME_CHAIN_VALID" +extern int gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID_P) -#define FRAME_CHAIN_VALID_P() (gdbarch_frame_chain_valid_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_VALID_P) +#define DEPRECATED_FRAME_CHAIN_VALID_P() (gdbarch_deprecated_frame_chain_valid_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID) -#define FRAME_CHAIN_VALID(chain, thisframe) (internal_error (__FILE__, __LINE__, "FRAME_CHAIN_VALID"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_VALID) +#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_CHAIN_VALID"), 0) #endif -typedef int (gdbarch_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe); -extern int gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe); -extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_frame_chain_valid_ftype *frame_chain_valid); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID) -#error "Non multi-arch definition of FRAME_CHAIN_VALID" +typedef int (gdbarch_deprecated_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe); +extern int gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe); +extern void set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID) +#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID) -#define FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_frame_chain_valid (current_gdbarch, chain, thisframe)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_VALID) +#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_deprecated_frame_chain_valid (current_gdbarch, chain, thisframe)) #endif #endif -#if defined (FRAME_SAVED_PC) -/* Legacy for systems yet to multi-arch FRAME_SAVED_PC */ -#if !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (1) +/* DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please + note, per UNWIND_PC's doco, that while the two have similar + interfaces they have very different underlying implementations. */ + +#if defined (DEPRECATED_FRAME_SAVED_PC) +/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_SAVED_PC */ +#if !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (1) #endif #endif /* Default predicate for non- multi-arch targets. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (0) #endif -extern int gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC_P) -#error "Non multi-arch definition of FRAME_SAVED_PC" +extern int gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC_P) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC_P) -#define FRAME_SAVED_PC_P() (gdbarch_frame_saved_pc_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC_P) +#define DEPRECATED_FRAME_SAVED_PC_P() (gdbarch_deprecated_frame_saved_pc_p (current_gdbarch)) #endif /* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC) -#define FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "FRAME_SAVED_PC"), 0) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC) +#define DEPRECATED_FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_SAVED_PC"), 0) #endif -typedef CORE_ADDR (gdbarch_frame_saved_pc_ftype) (struct frame_info *fi); -extern CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); -extern void set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC) -#error "Non multi-arch definition of FRAME_SAVED_PC" +typedef CORE_ADDR (gdbarch_deprecated_frame_saved_pc_ftype) (struct frame_info *fi); +extern CORE_ADDR gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); +extern void set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC) +#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC) -#define FRAME_SAVED_PC(fi) (gdbarch_frame_saved_pc (current_gdbarch, fi)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC) +#define DEPRECATED_FRAME_SAVED_PC(fi) (gdbarch_deprecated_frame_saved_pc (current_gdbarch, fi)) #endif #endif +extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch); + +typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame); +extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc); + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (FRAME_ARGS_ADDRESS) #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi)) @@ -2301,15 +2387,40 @@ extern void set_gdbarch_frame_locals_address (struct gdbarch *gdbarch, gdbarch_f #endif #endif -typedef CORE_ADDR (gdbarch_saved_pc_after_call_ftype) (struct frame_info *frame); -extern CORE_ADDR gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame); -extern void set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_saved_pc_after_call_ftype *saved_pc_after_call); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SAVED_PC_AFTER_CALL) -#error "Non multi-arch definition of SAVED_PC_AFTER_CALL" +#if defined (DEPRECATED_SAVED_PC_AFTER_CALL) +/* Legacy for systems yet to multi-arch DEPRECATED_SAVED_PC_AFTER_CALL */ +#if !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (0) +#endif + +extern int gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P) +#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (gdbarch_deprecated_saved_pc_after_call_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVED_PC_AFTER_CALL) +#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_SAVED_PC_AFTER_CALL"), 0) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_saved_pc_after_call_ftype) (struct frame_info *frame); +extern CORE_ADDR gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame); +extern void set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL) +#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVED_PC_AFTER_CALL) -#define SAVED_PC_AFTER_CALL(frame) (gdbarch_saved_pc_after_call (current_gdbarch, frame)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_SAVED_PC_AFTER_CALL) +#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (gdbarch_deprecated_saved_pc_after_call (current_gdbarch, frame)) #endif #endif @@ -2368,19 +2479,21 @@ typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADD extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address); extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align); +/* NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. */ + /* Default (value) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#define EXTRA_STACK_ALIGNMENT_NEEDED (1) +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (0) #endif -extern int gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch); -extern void set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, int extra_stack_alignment_needed); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#error "Non multi-arch definition of EXTRA_STACK_ALIGNMENT_NEEDED" +extern int gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch); +extern void set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, int deprecated_extra_stack_alignment_needed); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#error "Non multi-arch definition of DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRA_STACK_ALIGNMENT_NEEDED) -#define EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_extra_stack_alignment_needed (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED) +#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_deprecated_extra_stack_alignment_needed (current_gdbarch)) #endif #endif @@ -2421,6 +2534,9 @@ extern void set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_re #endif #endif +/* FIXME: kettenis/2003-03-08: This should be replaced by a function + parametrized with (at least) the regcache. */ + #if defined (SAVE_DUMMY_FRAME_TOS) /* Legacy for systems yet to multi-arch SAVE_DUMMY_FRAME_TOS */ #if !defined (SAVE_DUMMY_FRAME_TOS_P) @@ -2458,6 +2574,12 @@ extern void set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_s #endif #endif +extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch); + +typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info); +extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info); +extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id); + extern int gdbarch_parm_boundary (struct gdbarch *gdbarch); extern void set_gdbarch_parm_boundary (struct gdbarch *gdbarch, int parm_boundary); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PARM_BOUNDARY) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 12953c2..7a17b63 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -430,7 +430,8 @@ f:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc: f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0 f:2:TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0 f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0 -f:2:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0 +# The dummy call frame SP should be set by push_dummy_call. +F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val # Function for getting target's idea of a frame pointer. FIXME: GDB's # whole scheme for dealing with "frames" and "frame pointers" needs a # serious shakedown. @@ -517,31 +518,28 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0 # behaviour here (and hence entrench it further) gdbarch simply # reqires that these methods be set up from the word go. This also # avoids any potential problems with moving beyond multi-arch partial. -v:1:DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 -v:1:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 -f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0 -v:2:CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset::::0:-1:::0x%08lx -v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1::gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1:0x%08lx::CALL_DUMMY_BREAKPOINT_OFFSET_P -v:1:CALL_DUMMY_BREAKPOINT_OFFSET_P:int:call_dummy_breakpoint_offset_p::::0:-1 -v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::gdbarch->call_dummy_length >= 0 +v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0 +v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0 +f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0 +v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset +v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset +v::CALL_DUMMY_LENGTH:int:call_dummy_length # NOTE: cagney/2002-11-24: This function with predicate has a valid # (callable) initial value. As a consequence, even when the predicate # is false, the corresponding function works. This simplifies the # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(), # doesn't need to be modified. -F:1:DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy -v:1:CALL_DUMMY_P:int:call_dummy_p::::0:-1 -v:2:CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx -v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0:0x%08lx -v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx -v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P -f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0 +F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy +v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx +v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0 +V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0 +F::FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev # v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v::BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: -F:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval +F:2:DEPRECATED_GET_SAVED_REGISTER:void:deprecated_get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval # f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 @@ -556,12 +554,15 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf # f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 -f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0 +# Replaced by PUSH_DUMMY_CALL +F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr +M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0 -F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 -F:2:POP_FRAME:void:pop_frame:void:-:::0 -# -f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 +# NOTE: This can be handled directly in push_dummy_call. +F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 +F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0 +# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. +F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 # f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0 f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0 @@ -589,19 +590,27 @@ f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR g # v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 -F:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 -F:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0 -F:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 +F:2:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame::0:0 +F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0 +# DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please +# note, per UNWIND_PC's doco, that while the two have similar +# interfaces they have very different underlying implementations. +F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi::0:0 +M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame: f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0 -f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:frame::0:0 +F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0 # F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0 M:::CORE_ADDR:frame_align:CORE_ADDR address:address -v:2:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0::: +# NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. +v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0::: F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0 +# FIXME: kettenis/2003-03-08: This should be replaced by a function +# parametrized with (at least) the regcache. F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0 +M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0 v:2:PARM_BOUNDARY:int:parm_boundary # v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name @@ -795,8 +804,11 @@ cat <<EOF #if !GDB_MULTI_ARCH /* Pull in function declarations refered to, indirectly, via macros. */ #include "inferior.h" /* For unsigned_address_to_pointer(). */ +#include "symfile.h" /* For entry_point_address(). */ #endif +struct floatformat; +struct ui_file; struct frame_info; struct value; struct objfile; @@ -810,18 +822,6 @@ extern struct gdbarch *current_gdbarch; /* If any of the following are defined, the target wasn't correctly converted. */ -#if GDB_MULTI_ARCH -#if defined (EXTRA_FRAME_INFO) -#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info" -#endif -#endif - -#if GDB_MULTI_ARCH -#if defined (FRAME_FIND_SAVED_REGS) -#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS" -#endif -#endif - #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE) #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file." #endif @@ -938,7 +938,6 @@ do if [ "x${actual}" = "x-" ] then printf "#define ${macro} (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n" - printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" else printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n" fi @@ -1296,6 +1295,7 @@ cat <<EOF #include "gdb-events.h" #include "reggroups.h" #include "osabi.h" +#include "symfile.h" /* For entry_point_address. */ /* Static function declarations */ diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index 8c4490e..e626eb5 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -98,6 +98,10 @@ extern struct cmd_list_element *maintenanceinfolist; extern struct cmd_list_element *maintenanceprintlist; +/* Chain containing all defined "maintenance list" subcommands. */ + +extern struct cmd_list_element *maintenancelistlist; + extern struct cmd_list_element *setprintlist; extern struct cmd_list_element *showprintlist; diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index e359b3d..e03ebf4 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -24,6 +24,8 @@ #if !defined (GDBCORE_H) #define GDBCORE_H 1 +struct type; + #include "bfd.h" /* Return the name of the executable file as a string. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 9a02977..63ec899 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,14 @@ +2003-03-26 Daniel Jacobowitz <drow@mvista.com> + + * linux-low.c (linux_create_inferior): Use __SIGRTMIN. + (linux_wait_for_event, linux_init_signals): Likewise. + +2003-03-17 Daniel Jacobowitz <drow@mvista.com> + + * configure.in: Check for stdlib.h. + * configure: Regenerated. + * config.in: Regenerated. + 2003-01-04 Andreas Schwab <schwab@suse.de> * linux-m68k-low.c (m68k_num_regs): Define to 29 instead of 31. diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index e5cb0a7..5141263 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -25,6 +25,9 @@ /* Define if you have the <sgtty.h> header file. */ #undef HAVE_SGTTY_H +/* Define if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + /* Define if you have the <string.h> header file. */ #undef HAVE_STRING_H diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index f88f4ac..0b9bee4 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -1105,7 +1105,7 @@ EOF fi -for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h +for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h stdlib.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in index cb6feed..9c3106d 100644 --- a/gdb/gdbserver/configure.in +++ b/gdb/gdbserver/configure.in @@ -31,7 +31,8 @@ AC_PROG_INSTALL AC_HEADER_STDC AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl - proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h) + proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl + stdlib.h unistd.h) . ${srcdir}/configure.srv diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 2cb592a..95bf969 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -147,7 +147,7 @@ linux_create_inferior (char *program, char **allargs) { ptrace (PTRACE_TRACEME, 0, 0, 0); - signal (SIGRTMIN + 1, SIG_DFL); + signal (__SIGRTMIN + 1, SIG_DFL); setpgid (0, 0); @@ -493,8 +493,8 @@ linux_wait_for_event (struct thread_info *child) /* FIXME drow/2002-06-09: Get signal numbers from the inferior's thread library? */ if (WIFSTOPPED (wstat) - && (WSTOPSIG (wstat) == SIGRTMIN - || WSTOPSIG (wstat) == SIGRTMIN + 1)) + && (WSTOPSIG (wstat) == __SIGRTMIN + || WSTOPSIG (wstat) == __SIGRTMIN + 1)) { if (debug_threads) fprintf (stderr, "Ignored signal %d for %d (LWP %d).\n", @@ -1248,7 +1248,7 @@ linux_init_signals () { /* FIXME drow/2002-06-09: As above, we should check with LinuxThreads to find what the cancel signal actually is. */ - signal (SIGRTMIN+1, SIG_IGN); + signal (__SIGRTMIN+1, SIG_IGN); } void diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index e3df58b..f336d91 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -25,6 +25,10 @@ #ifndef GDBTHREAD_H #define GDBTHREAD_H +struct breakpoint; +struct frame_id; +struct symtab; + /* For bpstat */ #include "breakpoint.h" @@ -40,7 +44,6 @@ struct thread_info int num; /* Convenient handle (GDB thread id) */ /* State from wait_for_inferior */ CORE_ADDR prev_pc; - CORE_ADDR prev_func_start; char *prev_func_name; struct breakpoint *step_resume_breakpoint; struct breakpoint *through_sigtramp_breakpoint; @@ -114,7 +117,6 @@ extern struct thread_info *iterate_over_threads (thread_callback_func, void *); /* infrun context switch: save the debugger state for the given thread. */ extern void save_infrun_state (ptid_t ptid, CORE_ADDR prev_pc, - CORE_ADDR prev_func_start, char *prev_func_name, int trap_expected, struct breakpoint *step_resume_breakpoint, @@ -135,7 +137,6 @@ extern void save_infrun_state (ptid_t ptid, for the given thread. */ extern void load_infrun_state (ptid_t ptid, CORE_ADDR *prev_pc, - CORE_ADDR *prev_func_start, char **prev_func_name, int *trap_expected, struct breakpoint **step_resume_breakpoint, diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index fa5907e..56ca42d 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -26,6 +26,7 @@ #define GDBTYPES_H 1 /* Forward declarations for prototypes. */ +struct field; struct block; /* Codes for `fundamental types'. This is a monstrosity based on the @@ -1251,7 +1252,7 @@ extern void recursive_dump_type (struct type *, int); /* printcmd.c */ -extern void print_scalar_formatted (char *, struct type *, int, int, +extern void print_scalar_formatted (void *, struct type *, int, int, struct ui_file *); extern int can_dereference (struct type *); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index b90f6ed..2423a9a 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1120,9 +1120,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) */ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info); - set_gdbarch_frame_chain (gdbarch, h8300_frame_chain); - set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, h8300_frame_chain); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue); set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address); @@ -1148,25 +1148,16 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * Call Dummies * * These values and methods are used when gdb calls a target function. */ - set_gdbarch_push_return_address (gdbarch, h8300_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, h8300_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value); - set_gdbarch_push_arguments (gdbarch, h8300_push_arguments); - set_gdbarch_pop_frame (gdbarch, h8300_pop_frame); - set_gdbarch_store_struct_return (gdbarch, h8300_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments); + set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame); + set_gdbarch_deprecated_store_struct_return (gdbarch, h8300_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - /* set_gdbarch_call_dummy_stack_adjust */ - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc); set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); @@ -1175,9 +1166,11 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT); /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */ - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_believe_pcc_promotion (gdbarch, 1); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index 66b7b61..cc50e02 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -1,5 +1,6 @@ /* Target-dependent code for HPUX running on PA-RISC, for GDB. - Copyright 2002 Free Software Foundation, Inc. + + Copyright 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -21,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "arch-utils.h" #include "gdbcore.h" #include "osabi.h" +#include "gdb_string.h" /* Forward declarations. */ extern void _initialize_hppa_hpux_tdep (void); @@ -34,7 +36,7 @@ void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, CORE_ADDR *tmp); void hppa_hpux_frame_find_saved_regs_in_sigtramp - (struct frame_info *fi, struct frame_saved_regs *fsr); + (struct frame_info *fi, CORE_ADDR *fsr); int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name) @@ -66,29 +68,29 @@ hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name) void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, CORE_ADDR *tmp) { - *tmp = read_memory_integer (fi->frame + (43 * 4), 4); + *tmp = read_memory_integer (get_frame_base (fi) + (43 * 4), 4); } void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi, CORE_ADDR *tmp) { - *tmp = read_memory_integer (fi->frame + (40 * 4), 4); + *tmp = read_memory_integer (get_frame_base (fi) + (40 * 4), 4); } void hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi, - struct frame_saved_regs *fsr) + CORE_ADDR *fsr) { int i; - const CORE_ADDR tmp = (fi)->frame + (10 * 4); + const CORE_ADDR tmp = get_frame_base (fi) + (10 * 4); for (i = 0; i < NUM_REGS; i++) { if (i == SP_REGNUM) - (fsr)->regs[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); + fsr[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4); else - (fsr)->regs[i] = tmp + i * 4; + fsr[i] = tmp + i * 4; } } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index a03f850..4a094c1 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -32,7 +32,8 @@ #include "completer.h" #include "language.h" #include "osabi.h" - +#include "gdb_assert.h" +#include "infttrace.h" /* For argument passing to the inferior */ #include "symtab.h" @@ -77,8 +78,7 @@ static unsigned extract_5R_store (unsigned int); static unsigned extract_5r_store (unsigned int); -static void find_dummy_frame_regs (struct frame_info *, - struct frame_saved_regs *); +static void find_dummy_frame_regs (struct frame_info *, CORE_ADDR *); static int find_proc_framesize (CORE_ADDR); @@ -102,7 +102,7 @@ static int low_sign_extend (unsigned int, unsigned int); static int sign_extend (unsigned int, unsigned int); -static int restore_pc_queue (struct frame_saved_regs *); +static int restore_pc_queue (CORE_ADDR *); static int hppa_alignof (struct type *); @@ -164,7 +164,7 @@ CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame); CORE_ADDR hppa_frame_args_address (struct frame_info *fi); CORE_ADDR hppa_frame_locals_address (struct frame_info *fi); int hppa_frame_num_args (struct frame_info *frame); -void hppa_push_dummy_frame (struct inferior_status *inf_status); +void hppa_push_dummy_frame (void); void hppa_pop_frame (void); CORE_ADDR hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, @@ -848,7 +848,7 @@ hppa_frameless_function_invocation (struct frame_info *frame) { struct unwind_table_entry *u; - u = find_unwind_entry (frame->pc); + u = find_unwind_entry (get_frame_pc (frame)); if (u == 0) return 0; @@ -875,7 +875,7 @@ hppa_saved_pc_after_call (struct frame_info *frame) the stub will return to out of the stack. */ u = find_unwind_entry (pc); if (u && u->stub_unwind.stub_type != 0) - return FRAME_SAVED_PC (frame); + return DEPRECATED_FRAME_SAVED_PC (frame); else return pc; } @@ -885,7 +885,7 @@ hppa_frame_saved_pc (struct frame_info *frame) { CORE_ADDR pc = get_frame_pc (frame); struct unwind_table_entry *u; - CORE_ADDR old_pc; + CORE_ADDR old_pc = 0; int spun_around_loop = 0; int rp_offset = 0; @@ -894,26 +894,27 @@ hppa_frame_saved_pc (struct frame_info *frame) are saved in the exact same order as GDB numbers registers. How convienent. */ if (pc_in_interrupt_handler (pc)) - return read_memory_integer (frame->frame + PC_REGNUM * 4, + return read_memory_integer (get_frame_base (frame) + PC_REGNUM * 4, TARGET_PTR_BIT / 8) & ~0x3; - if ((frame->pc >= frame->frame - && frame->pc <= (frame->frame - /* A call dummy is sized in words, but it is - actually a series of instructions. Account - for that scaling factor. */ - + ((REGISTER_SIZE / INSTRUCTION_SIZE) - * CALL_DUMMY_LENGTH) - /* Similarly we have to account for 64bit - wide register saves. */ - + (32 * REGISTER_SIZE) - /* We always consider FP regs 8 bytes long. */ - + (NUM_REGS - FP0_REGNUM) * 8 - /* Similarly we have to account for 64bit - wide register saves. */ - + (6 * REGISTER_SIZE)))) + if ((get_frame_pc (frame) >= get_frame_base (frame) + && (get_frame_pc (frame) + <= (get_frame_base (frame) + /* A call dummy is sized in words, but it is actually a + series of instructions. Account for that scaling + factor. */ + + ((REGISTER_SIZE / INSTRUCTION_SIZE) + * CALL_DUMMY_LENGTH) + /* Similarly we have to account for 64bit wide register + saves. */ + + (32 * REGISTER_SIZE) + /* We always consider FP regs 8 bytes long. */ + + (NUM_REGS - FP0_REGNUM) * 8 + /* Similarly we have to account for 64bit wide register + saves. */ + + (6 * REGISTER_SIZE))))) { - return read_memory_integer ((frame->frame + return read_memory_integer ((get_frame_base (frame) + (TARGET_PTR_BIT == 64 ? -16 : -20)), TARGET_PTR_BIT / 8) & ~0x3; } @@ -938,29 +939,29 @@ hppa_frame_saved_pc (struct frame_info *frame) handler caller, then we need to look in the saved register area to get the return pointer (the values in the registers may not correspond to anything useful). */ - if (frame->next - && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) - || pc_in_interrupt_handler (frame->next->pc))) + if (get_next_frame (frame) + && ((get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME) + || pc_in_interrupt_handler (get_frame_pc (get_next_frame (frame))))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (get_next_frame (frame)); + saved_regs = get_frame_saved_regs (get_next_frame (frame)); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself with a return pointer in %rp and the kernel call with a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ - if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + if (pc == get_frame_pc (frame)) + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else @@ -978,29 +979,29 @@ hppa_frame_saved_pc (struct frame_info *frame) frame is a signal or interrupt handler, then dig the right information out of the saved register info. */ if (rp_offset == 0 - && frame->next - && ((get_frame_type (frame->next) == SIGTRAMP_FRAME) - || pc_in_interrupt_handler (frame->next->pc))) + && get_next_frame (frame) + && ((get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME) + || pc_in_interrupt_handler (get_frame_pc (get_next_frame (frame))))) { - struct frame_saved_regs saved_regs; - - deprecated_get_frame_saved_regs (frame->next, &saved_regs); - if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + CORE_ADDR *saved_regs; + hppa_frame_init_saved_regs (get_next_frame (frame)); + saved_regs = get_frame_saved_regs (get_next_frame (frame)); + if (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2) { - pc = read_memory_integer (saved_regs.regs[31], + pc = read_memory_integer (saved_regs[31], TARGET_PTR_BIT / 8) & ~0x3; /* Syscalls are really two frames. The syscall stub itself with a return pointer in %rp and the kernel call with a return pointer in %r31. We return the %rp variant if %r31 is the same as frame->pc. */ - if (pc == frame->pc) - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + if (pc == get_frame_pc (frame)) + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else - pc = read_memory_integer (saved_regs.regs[RP_REGNUM], + pc = read_memory_integer (saved_regs[RP_REGNUM], TARGET_PTR_BIT / 8) & ~0x3; } else if (rp_offset == 0) @@ -1011,7 +1012,7 @@ hppa_frame_saved_pc (struct frame_info *frame) else { old_pc = pc; - pc = read_memory_integer (frame->frame + rp_offset, + pc = read_memory_integer (get_frame_base (frame) + rp_offset, TARGET_PTR_BIT / 8) & ~0x3; } } @@ -1065,32 +1066,33 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame) int flags; int framesize; - if (frame->next && !fromleaf) + if (get_next_frame (frame) && !fromleaf) return; - /* If the next frame represents a frameless function invocation - then we have to do some adjustments that are normally done by - FRAME_CHAIN. (FRAME_CHAIN is not called in this case.) */ + /* If the next frame represents a frameless function invocation then + we have to do some adjustments that are normally done by + DEPRECATED_FRAME_CHAIN. (DEPRECATED_FRAME_CHAIN is not called in + this case.) */ if (fromleaf) { /* Find the framesize of *this* frame without peeking at the PC in the current frame structure (it isn't set yet). */ - framesize = find_proc_framesize (FRAME_SAVED_PC (get_next_frame (frame))); + framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (get_next_frame (frame))); /* Now adjust our base frame accordingly. If we have a frame pointer use it, else subtract the size of this frame from the current frame. (we always want frame->frame to point at the lowest address in the frame). */ if (framesize == -1) - frame->frame = TARGET_READ_FP (); + deprecated_update_frame_base_hack (frame, TARGET_READ_FP ()); else - frame->frame -= framesize; + deprecated_update_frame_base_hack (frame, get_frame_base (frame) - framesize); return; } flags = read_register (FLAGS_REGNUM); if (flags & 2) /* In system call? */ - frame->pc = read_register (31) & ~0x3; + deprecated_update_frame_pc_hack (frame, read_register (31) & ~0x3); /* The outermost frame is always derived from PC-framesize @@ -1101,11 +1103,11 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame) explain, but the parent *always* creates some stack space for the child. So the child actually does have a frame of some sorts, and its base is the high address in its parent's frame. */ - framesize = find_proc_framesize (frame->pc); + framesize = find_proc_framesize (get_frame_pc (frame)); if (framesize == -1) - frame->frame = TARGET_READ_FP (); + deprecated_update_frame_base_hack (frame, TARGET_READ_FP ()); else - frame->frame = read_register (SP_REGNUM) - framesize; + deprecated_update_frame_base_hack (frame, read_register (SP_REGNUM) - framesize); } /* Given a GDB frame, determine the address of the calling function's @@ -1127,9 +1129,9 @@ hppa_frame_chain (struct frame_info *frame) /* A frame in the current frame list, or zero. */ struct frame_info *saved_regs_frame = 0; - /* Where the registers were saved in saved_regs_frame. - If saved_regs_frame is zero, this is garbage. */ - struct frame_saved_regs saved_regs; + /* Where the registers were saved in saved_regs_frame. If + saved_regs_frame is zero, this is garbage. */ + CORE_ADDR *saved_regs = NULL; CORE_ADDR caller_pc; @@ -1140,8 +1142,8 @@ hppa_frame_chain (struct frame_info *frame) /* If this is a threaded application, and we see the routine "__pthread_exit", treat it as the stack root for this thread. */ - min_frame_symbol = lookup_minimal_symbol_by_pc (frame->pc); - frame_symbol = find_pc_function (frame->pc); + min_frame_symbol = lookup_minimal_symbol_by_pc (get_frame_pc (frame)); + frame_symbol = find_pc_function (get_frame_pc (frame)); if ((min_frame_symbol != 0) /* && (frame_symbol == 0) */ ) { @@ -1170,8 +1172,8 @@ hppa_frame_chain (struct frame_info *frame) are easy; at *sp we have a full save state strucutre which we can pull the old stack pointer from. Also see frame_saved_pc for code to dig a saved PC out of the save state structure. */ - if (pc_in_interrupt_handler (frame->pc)) - frame_base = read_memory_integer (frame->frame + SP_REGNUM * 4, + if (pc_in_interrupt_handler (get_frame_pc (frame))) + frame_base = read_memory_integer (get_frame_base (frame) + SP_REGNUM * 4, TARGET_PTR_BIT / 8); #ifdef FRAME_BASE_BEFORE_SIGTRAMP else if ((get_frame_type (frame) == SIGTRAMP_FRAME)) @@ -1180,12 +1182,12 @@ hppa_frame_chain (struct frame_info *frame) } #endif else - frame_base = frame->frame; + frame_base = get_frame_base (frame); /* Get frame sizes for the current frame and the frame of the caller. */ - my_framesize = find_proc_framesize (frame->pc); - caller_pc = FRAME_SAVED_PC (frame); + my_framesize = find_proc_framesize (get_frame_pc (frame)); + caller_pc = DEPRECATED_FRAME_SAVED_PC (frame); /* If we can't determine the caller's PC, then it's not likely we can really determine anything meaningful about its frame. We'll consider @@ -1193,7 +1195,7 @@ hppa_frame_chain (struct frame_info *frame) if (caller_pc == (CORE_ADDR) 0) return (CORE_ADDR) 0; - caller_framesize = find_proc_framesize (FRAME_SAVED_PC (frame)); + caller_framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (frame)); /* If caller does not have a frame pointer, then its frame can be found at current_frame - caller_framesize. */ @@ -1224,9 +1226,9 @@ hppa_frame_chain (struct frame_info *frame) We use information from unwind descriptors to determine if %r3 is saved into the stack (Entry_GR field has this information). */ - for (tmp_frame = frame; tmp_frame; tmp_frame = tmp_frame->next) + for (tmp_frame = frame; tmp_frame; tmp_frame = get_next_frame (tmp_frame)) { - u = find_unwind_entry (tmp_frame->pc); + u = find_unwind_entry (get_frame_pc (tmp_frame)); if (!u) { @@ -1239,14 +1241,14 @@ hppa_frame_chain (struct frame_info *frame) the dynamic linker will give you a PC that has none. Thus, I've disabled this warning. */ #if 0 - warning ("Unable to find unwind for PC 0x%x -- Help!", tmp_frame->pc); + warning ("Unable to find unwind for PC 0x%x -- Help!", get_frame_pc (tmp_frame)); #endif return (CORE_ADDR) 0; } if (u->Save_SP || (get_frame_type (tmp_frame) == SIGTRAMP_FRAME) - || pc_in_interrupt_handler (tmp_frame->pc)) + || pc_in_interrupt_handler (get_frame_pc (tmp_frame))) break; /* Entry_GR specifies the number of callee-saved general registers @@ -1256,11 +1258,12 @@ hppa_frame_chain (struct frame_info *frame) /* The unwind entry claims that r3 is saved here. However, in optimized code, GCC often doesn't actually save r3. We'll discover this if we look at the prologue. */ - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); saved_regs_frame = tmp_frame; /* If we have an address for r3, that's good. */ - if (saved_regs.regs[FP_REGNUM]) + if (saved_regs[FP_REGNUM]) break; } } @@ -1271,9 +1274,9 @@ hppa_frame_chain (struct frame_info *frame) pointer. */ if (u->Save_SP && !(get_frame_type (tmp_frame) == SIGTRAMP_FRAME) - && !pc_in_interrupt_handler (tmp_frame->pc)) + && !pc_in_interrupt_handler (get_frame_pc (tmp_frame))) { - return read_memory_integer (tmp_frame->frame, TARGET_PTR_BIT / 8); + return read_memory_integer (get_frame_base (tmp_frame), TARGET_PTR_BIT / 8); } /* %r3 was saved somewhere in the stack. Dig it out. */ else @@ -1305,21 +1308,24 @@ hppa_frame_chain (struct frame_info *frame) system call has a variable sized stack frame. */ if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { - u = find_unwind_entry (FRAME_SAVED_PC (frame)); + u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1328,7 +1334,7 @@ hppa_frame_chain (struct frame_info *frame) } } - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } } @@ -1336,25 +1342,28 @@ hppa_frame_chain (struct frame_info *frame) { /* Get the innermost frame. */ tmp_frame = frame; - while (tmp_frame->next != NULL) - tmp_frame = tmp_frame->next; + while (get_next_frame (tmp_frame) != NULL) + tmp_frame = get_next_frame (tmp_frame); if (tmp_frame != saved_regs_frame) - deprecated_get_frame_saved_regs (tmp_frame, &saved_regs); + { + hppa_frame_init_saved_regs (tmp_frame); + saved_regs = get_frame_saved_regs (tmp_frame); + } /* Abominable hack. See above. */ if (current_target.to_has_execution == 0 - && ((saved_regs.regs[FLAGS_REGNUM] - && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], + && ((saved_regs[FLAGS_REGNUM] + && (read_memory_integer (saved_regs[FLAGS_REGNUM], TARGET_PTR_BIT / 8) & 0x2)) - || (saved_regs.regs[FLAGS_REGNUM] == 0 + || (saved_regs[FLAGS_REGNUM] == 0 && read_register (FLAGS_REGNUM) & 0x2))) { - u = find_unwind_entry (FRAME_SAVED_PC (frame)); + u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame)); if (!u) { - return read_memory_integer (saved_regs.regs[FP_REGNUM], + return read_memory_integer (saved_regs[FP_REGNUM], TARGET_PTR_BIT / 8); } else @@ -1381,7 +1390,7 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) struct unwind_table_entry *u, *next_u = NULL; struct frame_info *next; - u = find_unwind_entry (thisframe->pc); + u = find_unwind_entry (get_frame_pc (thisframe)); if (u == NULL) return 1; @@ -1392,7 +1401,7 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) indistinguishable (as nearly as I can tell) from the symbol for a function which is (legitimately, since it is in the user's namespace) named Ltext_end, so we can't just ignore it. */ - msym_us = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe)); + msym_us = lookup_minimal_symbol_by_pc (DEPRECATED_FRAME_SAVED_PC (thisframe)); msym_start = lookup_minimal_symbol ("_start", NULL, NULL); if (msym_us && msym_start @@ -1409,61 +1418,44 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) next = get_next_frame (thisframe); if (next) - next_u = find_unwind_entry (next->pc); + next_u = find_unwind_entry (get_frame_pc (next)); /* If this frame does not save SP, has no stack, isn't a stub, and doesn't "call" an interrupt routine or signal handler caller, then its not valid. */ if (u->Save_SP || u->Total_frame_size || u->stub_unwind.stub_type != 0 - || (thisframe->next && (get_frame_type (thisframe->next) == SIGTRAMP_FRAME)) + || (get_next_frame (thisframe) && (get_frame_type (get_next_frame (thisframe)) == SIGTRAMP_FRAME)) || (next_u && next_u->HP_UX_interrupt_marker)) return 1; - if (pc_in_linker_stub (thisframe->pc)) + if (pc_in_linker_stub (get_frame_pc (thisframe))) return 1; return 0; } -/* - These functions deal with saving and restoring register state - around a function call in the inferior. They keep the stack - double-word aligned; eventually, on an hp700, the stack will have - to be aligned to a 64-byte boundary. */ +/* These functions deal with saving and restoring register state + around a function call in the inferior. They keep the stack + double-word aligned; eventually, on an hp700, the stack will have + to be aligned to a 64-byte boundary. */ void -hppa_push_dummy_frame (struct inferior_status *inf_status) +hppa_push_dummy_frame (void) { CORE_ADDR sp, pc, pcspace; register int regnum; CORE_ADDR int_buffer; double freg_buffer; - /* Oh, what a hack. If we're trying to perform an inferior call - while the inferior is asleep, we have to make sure to clear - the "in system call" bit in the flag register (the call will - start after the syscall returns, so we're no longer in the system - call!) This state is kept in "inf_status", change it there. - - We also need a number of horrid hacks to deal with lossage in the - PC queue registers (apparently they're not valid when the in syscall - bit is set). */ pc = hppa_target_read_pc (inferior_ptid); int_buffer = read_register (FLAGS_REGNUM); if (int_buffer & 0x2) { - unsigned int sid; - int_buffer &= ~0x2; - write_inferior_status_register (inf_status, 0, int_buffer); - write_inferior_status_register (inf_status, PCOQ_HEAD_REGNUM, pc + 0); - write_inferior_status_register (inf_status, PCOQ_TAIL_REGNUM, pc + 4); - sid = (pc >> 30) & 0x3; + const unsigned int sid = (pc >> 30) & 0x3; if (sid == 0) pcspace = read_register (SR4_REGNUM); else pcspace = read_register (SR4_REGNUM + 4 + sid); - write_inferior_status_register (inf_status, PCSQ_HEAD_REGNUM, pcspace); - write_inferior_status_register (inf_status, PCSQ_TAIL_REGNUM, pcspace); } else pcspace = read_register (PCSQ_HEAD_REGNUM); @@ -1511,26 +1503,26 @@ hppa_push_dummy_frame (struct inferior_status *inf_status) static void find_dummy_frame_regs (struct frame_info *frame, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { - CORE_ADDR fp = frame->frame; + CORE_ADDR fp = get_frame_base (frame); int i; /* The 32bit and 64bit ABIs save RP into different locations. */ if (REGISTER_SIZE == 8) - frame_saved_regs->regs[RP_REGNUM] = (fp - 16) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 16) & ~0x3; else - frame_saved_regs->regs[RP_REGNUM] = (fp - 20) & ~0x3; + frame_saved_regs[RP_REGNUM] = (fp - 20) & ~0x3; - frame_saved_regs->regs[FP_REGNUM] = fp; + frame_saved_regs[FP_REGNUM] = fp; - frame_saved_regs->regs[1] = fp + (2 * REGISTER_SIZE); + frame_saved_regs[1] = fp + (2 * REGISTER_SIZE); for (fp += 3 * REGISTER_SIZE, i = 3; i < 32; i++) { if (i != FP_REGNUM) { - frame_saved_regs->regs[i] = fp; + frame_saved_regs[i] = fp; fp += REGISTER_SIZE; } } @@ -1540,14 +1532,14 @@ find_dummy_frame_regs (struct frame_info *frame, fp += 4; for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8) - frame_saved_regs->regs[i] = fp; - - frame_saved_regs->regs[IPSW_REGNUM] = fp; - frame_saved_regs->regs[SAR_REGNUM] = fp + REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; - frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; - frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; + frame_saved_regs[i] = fp; + + frame_saved_regs[IPSW_REGNUM] = fp; + frame_saved_regs[SAR_REGNUM] = fp + REGISTER_SIZE; + frame_saved_regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE; + frame_saved_regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE; + frame_saved_regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE; + frame_saved_regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE; } void @@ -1556,44 +1548,45 @@ hppa_pop_frame (void) register struct frame_info *frame = get_current_frame (); register CORE_ADDR fp, npc, target_pc; register int regnum; - struct frame_saved_regs fsr; + CORE_ADDR *fsr; double freg_buffer; fp = get_frame_base (frame); - deprecated_get_frame_saved_regs (frame, &fsr); + hppa_frame_init_saved_regs (frame); + fsr = get_frame_saved_regs (frame); #ifndef NO_PC_SPACE_QUEUE_RESTORE - if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */ - restore_pc_queue (&fsr); + if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */ + restore_pc_queue (fsr); #endif for (regnum = 31; regnum > 0; regnum--) - if (fsr.regs[regnum]) - write_register (regnum, read_memory_integer (fsr.regs[regnum], + if (fsr[regnum]) + write_register (regnum, read_memory_integer (fsr[regnum], REGISTER_SIZE)); for (regnum = NUM_REGS - 1; regnum >= FP0_REGNUM; regnum--) - if (fsr.regs[regnum]) + if (fsr[regnum]) { - read_memory (fsr.regs[regnum], (char *) &freg_buffer, 8); + read_memory (fsr[regnum], (char *) &freg_buffer, 8); deprecated_write_register_bytes (REGISTER_BYTE (regnum), (char *) &freg_buffer, 8); } - if (fsr.regs[IPSW_REGNUM]) + if (fsr[IPSW_REGNUM]) write_register (IPSW_REGNUM, - read_memory_integer (fsr.regs[IPSW_REGNUM], + read_memory_integer (fsr[IPSW_REGNUM], REGISTER_SIZE)); - if (fsr.regs[SAR_REGNUM]) + if (fsr[SAR_REGNUM]) write_register (SAR_REGNUM, - read_memory_integer (fsr.regs[SAR_REGNUM], + read_memory_integer (fsr[SAR_REGNUM], REGISTER_SIZE)); /* If the PC was explicitly saved, then just restore it. */ - if (fsr.regs[PCOQ_TAIL_REGNUM]) + if (fsr[PCOQ_TAIL_REGNUM]) { - npc = read_memory_integer (fsr.regs[PCOQ_TAIL_REGNUM], + npc = read_memory_integer (fsr[PCOQ_TAIL_REGNUM], REGISTER_SIZE); write_register (PCOQ_TAIL_REGNUM, npc); } @@ -1606,7 +1599,7 @@ hppa_pop_frame (void) write_register (FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE)); - if (fsr.regs[IPSW_REGNUM]) /* call dummy */ + if (fsr[IPSW_REGNUM]) /* call dummy */ write_register (SP_REGNUM, fp - 48); else write_register (SP_REGNUM, fp); @@ -1619,7 +1612,7 @@ hppa_pop_frame (void) Don't skip through the trampoline if we're popping a dummy frame. */ target_pc = SKIP_TRAMPOLINE_CODE (npc & ~0x3) & ~0x3; - if (target_pc && !fsr.regs[IPSW_REGNUM]) + if (target_pc && !fsr[IPSW_REGNUM]) { struct symtab_and_line sal; struct breakpoint *breakpoint; @@ -1650,10 +1643,10 @@ hppa_pop_frame (void) queue space registers. */ static int -restore_pc_queue (struct frame_saved_regs *fsr) +restore_pc_queue (CORE_ADDR *fsr) { CORE_ADDR pc = read_pc (); - CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM], + CORE_ADDR new_pc = read_memory_integer (fsr[PCOQ_HEAD_REGNUM], TARGET_PTR_BIT / 8); struct target_waitstatus w; int insn_count; @@ -1672,7 +1665,7 @@ restore_pc_queue (struct frame_saved_regs *fsr) So, load up the registers and single step until we are in the right place. */ - write_register (21, read_memory_integer (fsr->regs[PCSQ_HEAD_REGNUM], + write_register (21, read_memory_integer (fsr[PCSQ_HEAD_REGNUM], REGISTER_SIZE)); write_register (22, new_pc); @@ -3856,15 +3849,15 @@ hppa_skip_prologue (CORE_ADDR pc) return (skip_prologue_hard_way (pc)); } -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ +/* Put here the code to store, into the SAVED_REGS, the addresses of + the saved registers of frame described by FRAME_INFO. This + includes special registers such as pc and fp saved in special ways + in the stack frame. sp is even more special: the address we return + for it IS the sp for the next frame. */ void hppa_frame_find_saved_regs (struct frame_info *frame_info, - struct frame_saved_regs *frame_saved_regs) + CORE_ADDR frame_saved_regs[]) { CORE_ADDR pc; struct unwind_table_entry *u; @@ -3875,42 +3868,43 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, int final_iteration; /* Zero out everything. */ - memset (frame_saved_regs, '\0', sizeof (struct frame_saved_regs)); + memset (frame_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); /* Call dummy frames always look the same, so there's no need to examine the dummy code to determine locations of saved registers; instead, let find_dummy_frame_regs fill in the correct offsets for the saved registers. */ - if ((frame_info->pc >= frame_info->frame - && frame_info->pc <= (frame_info->frame - /* A call dummy is sized in words, but it is - actually a series of instructions. Account - for that scaling factor. */ - + ((REGISTER_SIZE / INSTRUCTION_SIZE) - * CALL_DUMMY_LENGTH) - /* Similarly we have to account for 64bit - wide register saves. */ - + (32 * REGISTER_SIZE) - /* We always consider FP regs 8 bytes long. */ - + (NUM_REGS - FP0_REGNUM) * 8 - /* Similarly we have to account for 64bit - wide register saves. */ - + (6 * REGISTER_SIZE)))) + if ((get_frame_pc (frame_info) >= get_frame_base (frame_info) + && (get_frame_pc (frame_info) + <= (get_frame_base (frame_info) + /* A call dummy is sized in words, but it is actually a + series of instructions. Account for that scaling + factor. */ + + ((REGISTER_SIZE / INSTRUCTION_SIZE) + * CALL_DUMMY_LENGTH) + /* Similarly we have to account for 64bit wide register + saves. */ + + (32 * REGISTER_SIZE) + /* We always consider FP regs 8 bytes long. */ + + (NUM_REGS - FP0_REGNUM) * 8 + /* Similarly we have to account for 64bit wide register + saves. */ + + (6 * REGISTER_SIZE))))) find_dummy_frame_regs (frame_info, frame_saved_regs); /* Interrupt handlers are special too. They lay out the register state in the exact same order as the register numbers in GDB. */ - if (pc_in_interrupt_handler (frame_info->pc)) + if (pc_in_interrupt_handler (get_frame_pc (frame_info))) { for (i = 0; i < NUM_REGS; i++) { /* SP is a little special. */ if (i == SP_REGNUM) - frame_saved_regs->regs[SP_REGNUM] - = read_memory_integer (frame_info->frame + SP_REGNUM * 4, + frame_saved_regs[SP_REGNUM] + = read_memory_integer (get_frame_base (frame_info) + SP_REGNUM * 4, TARGET_PTR_BIT / 8); else - frame_saved_regs->regs[i] = frame_info->frame + i * 4; + frame_saved_regs[i] = get_frame_base (frame_info) + i * 4; } return; } @@ -3926,7 +3920,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Get the starting address of the function referred to by the PC saved in frame. */ - pc = get_pc_function_start (frame_info->pc); + pc = get_frame_func (frame_info); /* Yow! */ u = find_unwind_entry (pc); @@ -3959,7 +3953,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* The frame always represents the value of %sp at entry to the current function (and is thus equivalent to the "saved" stack pointer. */ - frame_saved_regs->regs[SP_REGNUM] = frame_info->frame; + frame_saved_regs[SP_REGNUM] = get_frame_base (frame_info); /* Loop until we find everything of interest or hit a branch. @@ -3977,7 +3971,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, GCC code. */ final_iteration = 0; while ((save_gr || save_fr || save_rp || save_sp || stack_remaining > 0) - && pc <= frame_info->pc) + && pc <= get_frame_pc (frame_info)) { status = target_read_memory (pc, buf, 4); inst = extract_unsigned_integer (buf, 4); @@ -3994,12 +3988,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, if (inst == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 20; + frame_saved_regs[RP_REGNUM] = get_frame_base (frame_info) - 20; } else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */ { save_rp = 0; - frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 16; + frame_saved_regs[RP_REGNUM] = get_frame_base (frame_info) - 16; } /* Note if we saved SP into the stack. This also happens to indicate @@ -4007,7 +4001,7 @@ 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->regs[FP_REGNUM] = frame_info->frame; + frame_saved_regs[FP_REGNUM] = get_frame_base (frame_info); save_sp = 0; } @@ -4021,10 +4015,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* stwm with a positive displacement is a *post modify*. */ if ((inst >> 26) == 0x1b && extract_14 (inst) >= 0) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = get_frame_base (frame_info); /* A std has explicit post_modify forms. */ else if ((inst & 0xfc00000c0) == 0x70000008) - frame_saved_regs->regs[reg] = frame_info->frame; + frame_saved_regs[reg] = get_frame_base (frame_info); else { CORE_ADDR offset; @@ -4038,11 +4032,11 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* Handle code with and without frame pointers. */ if (u->Save_SP) - frame_saved_regs->regs[reg] - = frame_info->frame + offset; + frame_saved_regs[reg] + = get_frame_base (frame_info) + offset; else - frame_saved_regs->regs[reg] - = (frame_info->frame + (u->Total_frame_size << 3) + frame_saved_regs[reg] + = (get_frame_base (frame_info) + (u->Total_frame_size << 3) + offset); } } @@ -4074,13 +4068,13 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, /* 1st HP CC FP register store. After this instruction we've set enough state that the GCC and HPCC code are both handled in the same manner. */ - frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame_info->frame; + frame_saved_regs[reg + FP4_REGNUM + 4] = get_frame_base (frame_info); fp_loc = 8; } else { - frame_saved_regs->regs[reg + FP0_REGNUM + 4] - = frame_info->frame + fp_loc; + frame_saved_regs[reg + FP0_REGNUM + 4] + = get_frame_base (frame_info) + fp_loc; fp_loc += 8; } } @@ -4099,6 +4093,17 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info, } } +/* XXX - deprecated. This is a compatibility function for targets + that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */ +/* Find the addresses in which registers are saved in FRAME. */ + +void +hppa_frame_init_saved_regs (struct frame_info *frame) +{ + if (get_frame_saved_regs (frame) == NULL) + frame_saved_regs_zalloc (frame); + hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame)); +} /* Exception handling support for the HP-UX ANSI C++ compiler. The compiler (aCC) provides a callback for exception events; @@ -4540,7 +4545,7 @@ child_get_current_exception_event (void) return (struct exception_event_record *) NULL; select_frame (fi); - throw_addr = fi->pc; + throw_addr = get_frame_pc (fi); /* Go back to original (top) frame */ select_frame (curr_frame); @@ -4915,13 +4920,13 @@ hppa_cannot_store_register (int regnum) CORE_ADDR hppa_frame_args_address (struct frame_info *fi) { - return fi->frame; + return get_frame_base (fi); } CORE_ADDR hppa_frame_locals_address (struct frame_info *fi) { - return fi->frame; + return get_frame_base (fi); } int @@ -4976,10 +4981,9 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_in_solib_call_trampoline (gdbarch, hppa_in_solib_call_trampoline); set_gdbarch_in_solib_return_trampoline (gdbarch, hppa_in_solib_return_trampoline); - set_gdbarch_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call); set_gdbarch_inner_than (gdbarch, hppa_inner_than); set_gdbarch_stack_align (gdbarch, hppa_stack_align); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_num_regs (gdbarch, hppa_num_regs); @@ -4995,7 +4999,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type); - set_gdbarch_store_struct_return (gdbarch, hppa_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, hppa_extract_return_value); set_gdbarch_use_struct_convention (gdbarch, hppa_use_struct_convention); @@ -5004,21 +5008,20 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) (gdbarch, hppa_extract_struct_value_address); set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info); - set_gdbarch_frame_chain (gdbarch, hppa_frame_chain); - set_gdbarch_frame_chain_valid (gdbarch, hppa_frame_chain_valid); + set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain); + set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid); set_gdbarch_frameless_function_invocation (gdbarch, hppa_frameless_function_invocation); - set_gdbarch_frame_saved_pc (gdbarch, hppa_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, hppa_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address); set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args); set_gdbarch_frame_args_skip (gdbarch, 0); - /* set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); */ - set_gdbarch_pop_frame (gdbarch, hppa_pop_frame); + set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame); set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); /* set_gdbarch_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */ - set_gdbarch_push_arguments (gdbarch, hppa_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments); set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_read_pc (gdbarch, hppa_target_read_pc); diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c index 51b74fc..b953d25 100644 --- a/gdb/hppah-nat.c +++ b/gdb/hppah-nat.c @@ -31,6 +31,7 @@ #include "gdbcore.h" #include "gdb_wait.h" #include "regcache.h" +#include "gdb_string.h" #include <signal.h> extern CORE_ADDR text_end; @@ -785,8 +786,6 @@ startup_semaphore_t; static startup_semaphore_t startup_semaphore; -extern int parent_attach_all (int, PTRACE_ARG3_TYPE, int); - #ifdef PT_SETTRC /* This function causes the caller's process to be traced by its parent. This is intended to be called after GDB forks itself, @@ -907,14 +906,13 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type) } int -hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, - enum bptype type) +hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type) { error ("Hardware watchpoints not implemented on this platform."); } int -hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot) +hppa_can_use_hw_watchpoint (int type, int cnt, int ot) { return 0; } diff --git a/gdb/hpread.c b/gdb/hpread.c index 9ad2100..daa42c0 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -35,6 +35,8 @@ #include "gdb-stabs.h" #include "gdbtypes.h" #include "demangle.h" +#include "somsolib.h" +#include "gdb_assert.h" /* Private information attached to an objfile which we use to find and internalize the HP C debug symbols within that objfile. */ @@ -1024,7 +1026,7 @@ hpread_quick_traverse (struct objfile *objfile, char *gntt_bits, while (VALID_CURR_FILE || VALID_CURR_MODULE) { - char *mod_name_string; + char *mod_name_string = NULL; char *full_name_string; /* First check for modules like "version.c", which have no code @@ -2321,7 +2323,7 @@ static unsigned long hpread_get_textlow (int global, int index, struct objfile *objfile, int symcount) { - union dnttentry *dn_bufp; + union dnttentry *dn_bufp = NULL; struct minimal_symbol *msymbol; /* Look for a DNTT_TYPE_FUNCTION symbol. */ @@ -2340,6 +2342,11 @@ hpread_get_textlow (int global, int index, struct objfile *objfile, && index < symcount); } + /* NOTE: cagney/2003-03-29: If !(index < symcount), dn_bufp is left + undefined and that means that the test below is using a garbage + pointer from the stack. */ + gdb_assert (dn_bufp != NULL); + /* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This might happen when a sourcefile has no functions. */ if (dn_bufp->dblock.kind == DNTT_TYPE_END) @@ -3358,10 +3365,10 @@ static struct type * hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, struct objfile *objfile, int newblock) { - struct type *type, *type1; struct pending *syms; struct pending *local_list = NULL; int nsyms = 0; + struct type *type; dnttpointer param; union dnttentry *paramp; char *name; @@ -3377,11 +3384,17 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, } else { + struct type *type1 = NULL; /* Nope, so read it in and store it away. */ if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION || dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC) type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval, objfile)); + /* NOTE: cagney/2003-03-29: Oh, no not again. TYPE1 is + potentially left undefined here. Assert it isn't and hope + the assert never fails ... */ + gdb_assert (type1 != NULL); + replace_type (type, type1); /* Mark it -- in the middle of processing */ diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c index b9ad2ff..7713863 100644 --- a/gdb/i386-interix-tdep.c +++ b/gdb/i386-interix-tdep.c @@ -149,7 +149,7 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame) if (fromleaf) { - frame->pc = SAVED_PC_AFTER_CALL (frame->next); + frame->pc = DEPRECATED_SAVED_PC_AFTER_CALL (frame->next); return; } @@ -162,7 +162,7 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame) { /* We know we're in a system call mini-frame; was it NullApi or something else? */ - ra = SAVED_PC_AFTER_CALL (frame); + ra = DEPRECATED_SAVED_PC_AFTER_CALL (frame); if (ra >= null_start && ra < null_end) deprecated_set_frame_type (frame, SIGTRAMP_FRAME); /* There might also be an indirect call to the mini-frame, @@ -224,10 +224,10 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame) /* No... We must be pointing at the frame that was called by PdxSignalDeliverer; back up across the whole mess. */ - /* Extract the frame for PdxSignalDeliverer. - Note: FRAME_CHAIN used the "old" frame pointer because we were - a deliverer. Get the address of the context record that's on - here frameless. */ + /* Extract the frame for PdxSignalDeliverer. Note: + DEPRECATED_FRAME_CHAIN used the "old" frame pointer because + we were a deliverer. Get the address of the context record + that's on here frameless. */ context = read_memory_integer (frame->frame, 4); /* an Arg */ /* Now extract the frame pointer contained in the context. */ @@ -333,8 +333,8 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) i386_interix_skip_trampoline_code); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, i386_interix_back_one_frame); set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); - set_gdbarch_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid); - set_gdbarch_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc); + set_gdbarch_deprecated_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc); set_gdbarch_name_of_malloc (gdbarch, "_malloc"); } diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 5ea7802..3744124 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -107,10 +107,13 @@ static int regmap[] = /* Which ptrace request retrieves which registers? These apply to the corresponding SET requests as well. */ + #define GETREGS_SUPPLIES(regno) \ ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM) + #define GETFPREGS_SUPPLIES(regno) \ (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM) + #define GETFPXREGS_SUPPLIES(regno) \ (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM) @@ -178,8 +181,9 @@ fetch_register (int regno) } /* GNU/Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); @@ -203,14 +207,15 @@ store_register (int regno) return; /* GNU/Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; regcache_collect (regno, &val); ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val); if (errno != 0) - error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno), + error ("Couldn't write register %s (#%d): %s.", REGISTER_NAME (regno), regno, safe_strerror (errno)); } @@ -522,8 +527,9 @@ fetch_inferior_registers (int regno) } /* GNU/Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the @@ -593,8 +599,9 @@ store_inferior_registers (int regno) } /* GNU/Linux LWP ID's are process ID's. */ - if ((tid = TIDGET (inferior_ptid)) == 0) - tid = PIDGET (inferior_ptid); /* Not a threaded program. */ + tid = TIDGET (inferior_ptid); + if (tid == 0) + tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_SETFPXREGS requests whenever possible, since it transfers more registers in one system call. But remember that diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index f92f1ea..2fe4d04 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -374,7 +374,7 @@ skip_hurd_resolver (CORE_ADDR pc) = lookup_minimal_symbol ("fixup", NULL, objfile); if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc) - return (SAVED_PC_AFTER_CALL (get_current_frame ())); + return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ())); } return 0; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 018f073..475f89c 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame) return (get_next_frame (frame) && get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME && (frameless_look_for_prologue (frame) - || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame)))); + || get_frame_pc (frame) == get_frame_func (frame))); } /* Return the chain-pointer for FRAME. In the case of the i386, the @@ -636,10 +636,10 @@ i386_frame_num_args (struct frame_info *fi) if (pfi == 0) { /* NOTE: This can happen if we are looking at the frame for - main, because FRAME_CHAIN_VALID won't let us go into start. - If we have debugging symbols, that's not really a big deal; - it just means it will only show as many arguments to main as - are declared. */ + main, because DEPRECATED_FRAME_CHAIN_VALID won't let us go + into start. If we have debugging symbols, that's not really + a big deal; it just means it will only show as many arguments + to main as are declared. */ return -1; } else @@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip) frame_saved_regs_zalloc (fip); - pc = get_pc_function_start (get_frame_pc (fip)); + pc = get_frame_func (fip); if (pc != 0) locals = i386_get_frame_setup (pc); @@ -925,7 +925,7 @@ static CORE_ADDR i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr); + sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr); if (struct_return) { @@ -939,12 +939,6 @@ i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp, return sp; } -static void -i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -{ - /* Do nothing. Everything was already done by i386_push_arguments. */ -} - /* These registers are used for returning integers (and on some targets also for returning `struct' and `union' values when their size and alignment match an integer type). */ @@ -1129,7 +1123,7 @@ i386_use_struct_convention (int gcc_p, struct type *type) potentially they could be used for things other than address. */ static struct type * -i386_register_virtual_type (int regnum) +i386_register_type (struct gdbarch *gdbarch, int regnum) { if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) return lookup_pointer_type (builtin_type_void); @@ -1558,25 +1552,15 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_name (gdbarch, i386_register_name); set_gdbarch_register_size (gdbarch, 4); set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS); - set_gdbarch_deprecated_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE); - set_gdbarch_deprecated_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE); - set_gdbarch_register_virtual_type (gdbarch, i386_register_virtual_type); + set_gdbarch_register_type (gdbarch, i386_register_type); set_gdbarch_print_float_info (gdbarch, i387_print_float_info); set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); /* Call dummy code. */ - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, NULL); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_register_convertible (gdbarch, i386_register_convertible); set_gdbarch_register_convert_to_virtual (gdbarch, @@ -1589,10 +1573,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_parm_boundary (gdbarch, 32); set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value); - set_gdbarch_push_arguments (gdbarch, i386_push_arguments); - set_gdbarch_push_return_address (gdbarch, i386_push_return_address); - set_gdbarch_pop_frame (gdbarch, i386_pop_frame); - set_gdbarch_store_struct_return (gdbarch, i386_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, i386_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, i386_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, i386_pop_frame); set_gdbarch_store_return_value (gdbarch, i386_store_return_value); set_gdbarch_extract_struct_value_address (gdbarch, i386_extract_struct_value_address); @@ -1616,9 +1599,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 8); set_gdbarch_frameless_function_invocation (gdbarch, i386_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, i386_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc); - set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call); + set_gdbarch_deprecated_frame_chain (gdbarch, i386_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_frame_saved_pc); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, i386_frame_num_args); set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp); @@ -1633,6 +1616,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) i386_add_reggroups (gdbarch); set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 25bf6b3..1e0b405 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -22,6 +22,10 @@ #ifndef I386_TDEP_H #define I386_TDEP_H +struct reggroup; +struct gdbarch; +struct frame_info; + /* GDB's i386 target supports both the 32-bit Intel Architecture (IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses a similar register layout for both. diff --git a/gdb/i386ly-tdep.c b/gdb/i386ly-tdep.c index d0775b7..2374b71 100644 --- a/gdb/i386ly-tdep.c +++ b/gdb/i386ly-tdep.c @@ -53,7 +53,7 @@ i386lynx_saved_pc_after_call (struct frame_info *frame) static void i386lynx_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - set_gdbarch_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call); } diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 9b47e58..045357e 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1,6 +1,7 @@ /* Intel 387 floating point stuff. + Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1998, 1999, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GDB. @@ -33,24 +34,6 @@ #include "i386-tdep.h" -/* FIXME: Eliminate the next two functions when we have the time to - change all the callers. */ - -void i387_to_double (char *from, char *to); -void double_to_i387 (char *from, char *to); - -void -i387_to_double (char *from, char *to) -{ - floatformat_to_double (&floatformat_i387_ext, from, (double *) to); -} - -void -double_to_i387 (char *from, char *to) -{ - floatformat_from_double (&floatformat_i387_ext, (double *) from, to); -} - /* FIXME: The functions on this page are used by the old `info float' implementations that a few of the i386 targets provide. These diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h index e29b198..7079310 100644 --- a/gdb/i387-tdep.h +++ b/gdb/i387-tdep.h @@ -21,6 +21,10 @@ #ifndef I387_TDEP_H #define I387_TDEP_H +struct gdbarch; +struct ui_file; +struct frame_info; + /* Print out the i387 floating point state. */ extern void i387_print_float_info (struct gdbarch *gdbarch, diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 36036f2..86638fb 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -91,19 +91,12 @@ static gdbarch_register_virtual_size_ftype ia64_register_virtual_size; static gdbarch_register_virtual_type_ftype ia64_register_virtual_type; static gdbarch_register_byte_ftype ia64_register_byte; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; -static gdbarch_frame_chain_ftype ia64_frame_chain; -static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; -static gdbarch_get_saved_register_ftype ia64_get_saved_register; static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address; static gdbarch_use_struct_convention_ftype ia64_use_struct_convention; static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation; -static gdbarch_store_struct_return_ftype ia64_store_struct_return; -static gdbarch_push_arguments_ftype ia64_push_arguments; -static gdbarch_push_return_address_ftype ia64_push_return_address; -static gdbarch_pop_frame_ftype ia64_pop_frame; -static gdbarch_saved_pc_after_call_ftype ia64_saved_pc_after_call; +static gdbarch_deprecated_saved_pc_after_call_ftype ia64_saved_pc_after_call; static void ia64_pop_frame_regular (struct frame_info *frame); static struct type *is_float_or_hfa_type (struct type *t); @@ -280,7 +273,7 @@ ia64_register_convert_to_virtual (int regnum, struct type *type, { DOUBLEST val; floatformat_to_doublest (&floatformat_ia64_ext, from, &val); - store_floating(to, TYPE_LENGTH(type), val); + deprecated_store_floating (to, TYPE_LENGTH(type), val); } else error("ia64_register_convert_to_virtual called with non floating point register number"); @@ -292,7 +285,7 @@ ia64_register_convert_to_raw (struct type *type, int regnum, { if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM) { - DOUBLEST val = extract_floating (from, TYPE_LENGTH(type)); + DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type)); floatformat_from_doublest (&floatformat_ia64_ext, &val, to); } else @@ -1212,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame) { CORE_ADDR func_start; - func_start = get_pc_function_start (get_frame_pc (frame)); + func_start = get_frame_func (frame); examine_prologue (func_start, get_frame_pc (frame), frame); } } @@ -2007,8 +2000,8 @@ ia64_pop_frame_regular (struct frame_info *frame) } } - write_register (sp_regnum, FRAME_CHAIN (frame)); - write_pc (FRAME_SAVED_PC (frame)); + write_register (sp_regnum, DEPRECATED_FRAME_CHAIN (frame)); + write_pc (DEPRECATED_FRAME_SAVED_PC (frame)); cfm = read_register (IA64_CFM_REGNUM); @@ -2194,13 +2187,13 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frameless_function_invocation (gdbarch, ia64_frameless_function_invocation); - set_gdbarch_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call); - set_gdbarch_frame_chain (gdbarch, ia64_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ia64_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, ia64_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ia64_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs); - set_gdbarch_get_saved_register (gdbarch, ia64_get_saved_register); + set_gdbarch_deprecated_get_saved_register (gdbarch, ia64_get_saved_register); set_gdbarch_register_convertible (gdbarch, ia64_register_convertible); set_gdbarch_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual); @@ -2209,7 +2202,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention); set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value); - set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, ia64_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, ia64_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); @@ -2220,15 +2213,12 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, ia64_write_pc); /* Settings for calling functions in the inferior. */ - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_push_arguments (gdbarch, ia64_push_arguments); - set_gdbarch_push_return_address (gdbarch, ia64_push_return_address); - set_gdbarch_pop_frame (gdbarch, ia64_pop_frame); + set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, ia64_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words)); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info); set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address); @@ -2244,13 +2234,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); - - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_function_start_offset (gdbarch, 0); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 19077b4..01ab3d7 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -986,50 +986,46 @@ run_stack_dummy (CORE_ADDR addr, struct regcache *buffer) { struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0); int saved_async = 0; + struct breakpoint *bpt; + struct symtab_and_line sal; /* Now proceed, having reached the desired place. */ clear_proceed_status (); - if (CALL_DUMMY_BREAKPOINT_OFFSET_P) + init_sal (&sal); /* initialize to zeroes */ + if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) { - struct breakpoint *bpt; - struct symtab_and_line sal; - - init_sal (&sal); /* initialize to zeroes */ - if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) - { - sal.pc = CALL_DUMMY_ADDRESS (); - } - else - { - /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need - to put a breakpoint instruction. If not, the call dummy - already has the breakpoint instruction in it. - - ADDR IS THE ADDRESS of the call dummy plus the - CALL_DUMMY_START_OFFSET, so we need to subtract the - CALL_DUMMY_START_OFFSET. */ - sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET; - } - sal.section = find_pc_overlay (sal.pc); - - { - /* Set up a frame ID for the dummy frame so we can pass it to - set_momentary_breakpoint. We need to give the breakpoint a - frame ID so that the breakpoint code can correctly - re-identify the dummy breakpoint. */ - struct frame_id frame = frame_id_build (read_fp (), sal.pc); - /* Create a momentary breakpoint at the return address of the - inferior. That way it breaks when it returns. */ - bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy); - bpt->disposition = disp_del; - } - - /* If all error()s out of proceed ended up calling normal_stop (and - perhaps they should; it already does in the special case of error - out of resume()), then we wouldn't need this. */ - make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat); + sal.pc = CALL_DUMMY_ADDRESS (); + } + else + { + /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to + put a breakpoint instruction. If not, the call dummy already + has the breakpoint instruction in it. + + ADDR IS THE ADDRESS of the call dummy plus the + CALL_DUMMY_START_OFFSET, so we need to subtract the + CALL_DUMMY_START_OFFSET. */ + sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET; } + sal.section = find_pc_overlay (sal.pc); + + { + /* Set up a frame ID for the dummy frame so we can pass it to + set_momentary_breakpoint. We need to give the breakpoint a + frame ID so that the breakpoint code can correctly re-identify + the dummy breakpoint. */ + struct frame_id frame = frame_id_build (read_fp (), sal.pc); + /* Create a momentary breakpoint at the return address of the + inferior. That way it breaks when it returns. */ + bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy); + bpt->disposition = disp_del; + } + + /* If all error()s out of proceed ended up calling normal_stop (and + perhaps they should; it already does in the special case of error + out of resume()), then we wouldn't need this. */ + make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat); disable_watchpoints_before_interactive_call_start (); proceed_to_finish = 1; /* We want stop_registers, please... */ @@ -1914,8 +1910,13 @@ attach_command (char *args, int from_tty) /* No traps are generated when attaching to inferior under Mach 3 or GNU hurd. */ #ifndef ATTACH_NO_WAIT - stop_soon_quietly = 1; + /* Careful here. See comments in inferior.h. Basically some OSes + don't ignore SIGSTOPs on continue requests anymore. We need a + way for handle_inferior_event to reset the stop_signal variable + after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for. */ + stop_soon = STOP_QUIETLY_NO_SIGSTOP; wait_for_inferior (); + stop_soon = NO_STOP_QUIETLY; #endif /* diff --git a/gdb/inferior.h b/gdb/inferior.h index 4616a1f..6203449 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -24,6 +24,10 @@ #if !defined (INFERIOR_H) #define INFERIOR_H 1 +struct target_waitstatus; +struct frame_info; +struct ui_file; +struct type; struct gdbarch; struct regcache; @@ -178,8 +182,6 @@ extern CORE_ADDR read_sp (void); extern CORE_ADDR generic_target_read_sp (void); -extern void write_sp (CORE_ADDR); - extern void generic_target_write_sp (CORE_ADDR); extern CORE_ADDR read_fp (void); @@ -392,12 +394,37 @@ extern enum step_over_calls_kind step_over_calls; extern int step_multi; -/* Nonzero means expecting a trap and caller will handle it themselves. - It is used after attach, due to attaching to a process; - when running in the shell before the child program has been exec'd; - and when running some kinds of remote stuff (FIXME?). */ +/* Nonzero means expecting a trap and caller will handle it + themselves. It is used when running in the shell before the child + program has been exec'd; and when running some kinds of remote + stuff (FIXME?). */ + +/* It is also used after attach, due to attaching to a process. This + is a bit trickier. When doing an attach, the kernel stops the + debuggee with a SIGSTOP. On newer GNU/Linux kernels (>= 2.5.61) + the handling of SIGSTOP for a ptraced process has changed. Earlier + versions of the kernel would ignore these SIGSTOPs, while now + SIGSTOP is treated like any other signal, i.e. it is not muffled. + + If the gdb user does a 'continue' after the 'attach', gdb passes + the global variable stop_signal (which stores the signal from the + attach, SIGSTOP) to the ptrace(PTRACE_CONT,...) call. This is + problematic, because the kernel doesn't ignore such SIGSTOP + now. I.e. it is reported back to gdb, which in turn presents it + back to the user. + + To avoid the problem, we use STOP_QUIETLY_NO_SIGSTOP, which allows + gdb to clear the value of stop_signal after the attach, so that it + is not passed back down to the kernel. */ + +enum stop_kind + { + NO_STOP_QUIETLY = 0, + STOP_QUIETLY, + STOP_QUIETLY_NO_SIGSTOP + }; -extern int stop_soon_quietly; +extern enum stop_kind stop_soon; /* Nonzero if proceed is being used for a "finish" command or a similar situation when stop_registers should be saved. */ @@ -420,54 +447,13 @@ extern int attach_flag; #define ON_STACK 1 #define AT_ENTRY_POINT 4 -#if !defined (CALL_DUMMY_ADDRESS) -#define CALL_DUMMY_ADDRESS() (internal_error (__FILE__, __LINE__, "CALL_DUMMY_ADDRESS"), 0) -#endif -#if !defined (CALL_DUMMY_START_OFFSET) -#define CALL_DUMMY_START_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_START_OFFSET"), 0) -#endif -#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET) -#define CALL_DUMMY_BREAKPOINT_OFFSET_P (0) -#define CALL_DUMMY_BREAKPOINT_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_BREAKPOINT_OFFSET"), 0) -#endif -#if !defined CALL_DUMMY_BREAKPOINT_OFFSET_P -#define CALL_DUMMY_BREAKPOINT_OFFSET_P (1) -#endif -#if !defined (CALL_DUMMY_LENGTH) -#define CALL_DUMMY_LENGTH (internal_error (__FILE__, __LINE__, "CALL_DUMMY_LENGTH"), 0) -#endif - -#if defined (CALL_DUMMY_STACK_ADJUST) -#if !defined (CALL_DUMMY_STACK_ADJUST_P) -#define CALL_DUMMY_STACK_ADJUST_P (1) -#endif -#endif -#if !defined (CALL_DUMMY_STACK_ADJUST) -#define CALL_DUMMY_STACK_ADJUST (internal_error (__FILE__, __LINE__, "CALL_DUMMY_STACK_ADJUST"), 0) -#endif -#if !defined (CALL_DUMMY_STACK_ADJUST_P) -#define CALL_DUMMY_STACK_ADJUST_P (0) -#endif - /* FIXME: cagney/2000-04-17: gdbarch should manage this. The default shouldn't be necessary. */ -#if !defined (CALL_DUMMY_P) -#if defined (CALL_DUMMY) -#define CALL_DUMMY_P 1 -#else -#define CALL_DUMMY_P 0 -#endif -#endif - #if !defined PUSH_DUMMY_FRAME #define PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "PUSH_DUMMY_FRAME"), 0) #endif -#if !defined FIX_CALL_DUMMY -#define FIX_CALL_DUMMY(a1,a2,a3,a4,a5,a6,a7) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0) -#endif - #if !defined STORE_STRUCT_RETURN #define STORE_STRUCT_RETURN(a1,a2) (internal_error (__FILE__, __LINE__, "STORE_STRUCT_RETURN"), 0) #endif diff --git a/gdb/infrun.c b/gdb/infrun.c index f65af35..9503b10 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -42,6 +42,8 @@ #include "inf-loop.h" #include "regcache.h" #include "value.h" +#include "observer.h" +#include "language.h" /* Prototypes for local functions */ @@ -106,21 +108,6 @@ static ptid_t previous_inferior_ptid; static int may_follow_exec = MAY_FOLLOW_EXEC; -/* Dynamic function trampolines are similar to solib trampolines in that they - are between the caller and the callee. The difference is that when you - enter a dynamic trampoline, you can't determine the callee's address. Some - (usually complex) code needs to run in the dynamic trampoline to figure out - the callee's address. This macro is usually called twice. First, when we - enter the trampoline (looks like a normal function call at that point). It - should return the PC of a point within the trampoline where the callee's - address is known. Second, when we hit the breakpoint, this routine returns - the callee's address. At that point, things proceed as per a step resume - breakpoint. */ - -#ifndef DYNAMIC_TRAMPOLINE_NEXTPC -#define DYNAMIC_TRAMPOLINE_NEXTPC(pc) 0 -#endif - /* If the program uses ELF-style shared libraries, then calls to functions in shared libraries go through stubs, which live in a table called the PLT (Procedure Linkage Table). The first time the @@ -299,7 +286,7 @@ int stop_after_trap; when running in the shell before the child program has been exec'd; and when running some kinds of remote stuff (FIXME?). */ -int stop_soon_quietly; +enum stop_kind stop_soon; /* Nonzero if proceed is being used for a "finish" command or a similar situation when stop_registers should be saved. */ @@ -672,7 +659,7 @@ clear_proceed_status (void) step_frame_id = null_frame_id; step_over_calls = STEP_OVER_UNDEBUGGABLE; stop_after_trap = 0; - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; proceed_to_finish = 0; breakpoint_proceeded = 1; /* We're about to proceed... */ @@ -804,7 +791,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step) to be preserved over calls to it and cleared when the inferior is started. */ static CORE_ADDR prev_pc; -static CORE_ADDR prev_func_start; static char *prev_func_name; @@ -815,7 +801,7 @@ start_remote (void) { init_thread_list (); init_wait_for_inferior (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; trap_expected = 0; /* Always go on waiting for the target, regardless of the mode. */ @@ -843,7 +829,6 @@ init_wait_for_inferior (void) { /* These are meaningless until the first time through wait_for_inferior. */ prev_pc = 0; - prev_func_start = 0; prev_func_name = NULL; #ifdef HP_OS_BUG @@ -1131,8 +1116,7 @@ context_switch (struct execution_control_state *ecs) if (in_thread_list (inferior_ptid) && in_thread_list (ecs->ptid)) { /* Perform infrun state context switch: */ /* Save infrun state for the old thread. */ - save_infrun_state (inferior_ptid, prev_pc, - prev_func_start, prev_func_name, + save_infrun_state (inferior_ptid, prev_pc, prev_func_name, trap_expected, step_resume_breakpoint, through_sigtramp_breakpoint, step_range_start, step_range_end, &step_frame_id, @@ -1143,8 +1127,7 @@ context_switch (struct execution_control_state *ecs) ecs->current_line, ecs->current_symtab, step_sp); /* Load infrun state for the new thread. */ - load_infrun_state (ecs->ptid, &prev_pc, - &prev_func_start, &prev_func_name, + load_infrun_state (ecs->ptid, &prev_pc, &prev_func_name, &trap_expected, &step_resume_breakpoint, &through_sigtramp_breakpoint, &step_range_start, &step_range_end, &step_frame_id, @@ -1166,6 +1149,11 @@ void handle_inferior_event (struct execution_control_state *ecs) { CORE_ADDR real_stop_pc; + /* NOTE: cagney/2003-03-28: If you're looking at this code and + thinking that the variable stepped_after_stopped_by_watchpoint + isn't used, then you're wrong! The macro STOPPED_BY_WATCHPOINT, + defined in the file "config/pa/nm-hppah.h", accesses the variable + indirectly. Mutter something rude about the HP merge. */ int stepped_after_stopped_by_watchpoint; int sw_single_step_trap_p = 0; @@ -1178,7 +1166,15 @@ handle_inferior_event (struct execution_control_state *ecs) case infwait_thread_hop_state: /* Cancel the waiton_ptid. */ ecs->waiton_ptid = pid_to_ptid (-1); - /* Fall thru to the normal_state case. */ + /* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event + is serviced in this loop, below. */ + if (ecs->enable_hw_watchpoints_after_wait) + { + TARGET_ENABLE_HW_WATCHPOINTS (PIDGET (inferior_ptid)); + ecs->enable_hw_watchpoints_after_wait = 0; + } + stepped_after_stopped_by_watchpoint = 0; + break; case infwait_normal_state: /* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event @@ -1192,6 +1188,7 @@ handle_inferior_event (struct execution_control_state *ecs) break; case infwait_nullified_state: + stepped_after_stopped_by_watchpoint = 0; break; case infwait_nonstep_watch_state: @@ -1202,6 +1199,9 @@ handle_inferior_event (struct execution_control_state *ecs) in combination correctly? */ stepped_after_stopped_by_watchpoint = 1; break; + + default: + internal_error (__FILE__, __LINE__, "bad switch"); } ecs->infwait_state = infwait_normal_state; @@ -1254,7 +1254,7 @@ handle_inferior_event (struct execution_control_state *ecs) might be the shell which has just loaded some objects, otherwise add the symbols for the newly loaded objects. */ #ifdef SOLIB_ADD - if (!stop_soon_quietly) + if (stop_soon == NO_STOP_QUIETLY) { /* Remove breakpoints, SOLIB_ADD might adjust breakpoint addresses via breakpoint_re_set. */ @@ -1753,7 +1753,9 @@ handle_inferior_event (struct execution_control_state *ecs) if (stop_signal == TARGET_SIGNAL_TRAP || (breakpoints_inserted && (stop_signal == TARGET_SIGNAL_ILL - || stop_signal == TARGET_SIGNAL_EMT)) || stop_soon_quietly) + || stop_signal == TARGET_SIGNAL_EMT)) + || stop_soon == STOP_QUIETLY + || stop_soon == STOP_QUIETLY_NO_SIGSTOP) { if (stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap) { @@ -1761,12 +1763,27 @@ handle_inferior_event (struct execution_control_state *ecs) stop_stepping (ecs); return; } - if (stop_soon_quietly) + + /* This is originated from start_remote(), start_inferior() and + shared libraries hook functions. */ + if (stop_soon == STOP_QUIETLY) { stop_stepping (ecs); return; } + /* This originates from attach_command(). We need to overwrite + the stop_signal here, because some kernels don't ignore a + SIGSTOP in a subsequent ptrace(PTRACE_SONT,SOGSTOP) call. + See more comments in inferior.h. */ + if (stop_soon == STOP_QUIETLY_NO_SIGSTOP) + { + stop_stepping (ecs); + if (stop_signal == TARGET_SIGNAL_STOP) + stop_signal = TARGET_SIGNAL_0; + return; + } + /* Don't even think about breakpoints if just proceeded over a breakpoint. @@ -1808,26 +1825,30 @@ handle_inferior_event (struct execution_control_state *ecs) stop_print_frame = 1; } + /* NOTE: cagney/2003-03-29: These two checks for a random signal + at one stage in the past included checks for an inferior + function call's call dummy's return breakpoint. The original + comment, that went with the test, read: + + ``End of a stack dummy. Some systems (e.g. Sony news) give + another signal besides SIGTRAP, so check here as well as + above.'' + + If someone ever tries to get get call dummys on a + non-executable stack to work (where the target would stop + with something like a SIGSEG), then those tests might need to + be re-instated. Given, however, that the tests were only + enabled when momentary breakpoints were not being used, I + suspect that it won't be the case. */ + if (stop_signal == TARGET_SIGNAL_TRAP) ecs->random_signal = !(bpstat_explains_signal (stop_bpstat) || trap_expected - || (!CALL_DUMMY_BREAKPOINT_OFFSET_P - && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (), - get_frame_base (get_current_frame ()))) || (step_range_end && step_resume_breakpoint == NULL)); - else { - ecs->random_signal = !(bpstat_explains_signal (stop_bpstat) - /* End of a stack dummy. Some systems (e.g. Sony - news) give another signal besides SIGTRAP, so - check here as well as above. */ - || (!CALL_DUMMY_BREAKPOINT_OFFSET_P - && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (), - get_frame_base - (get_current_frame - ())))); + ecs->random_signal = !bpstat_explains_signal (stop_bpstat); if (!ecs->random_signal) stop_signal = TARGET_SIGNAL_TRAP; } @@ -2169,31 +2190,6 @@ process_event_stop_test: return; } - if (!CALL_DUMMY_BREAKPOINT_OFFSET_P) - { - /* This is the old way of detecting the end of the stack dummy. - An architecture which defines CALL_DUMMY_BREAKPOINT_OFFSET gets - handled above. As soon as we can test it on all of them, all - architectures should define it. */ - - /* If this is the breakpoint at the end of a stack dummy, - just stop silently, unless the user was doing an si/ni, in which - case she'd better know what she's doing. */ - - if (CALL_DUMMY_HAS_COMPLETED (stop_pc, read_sp (), - get_frame_base (get_current_frame ())) - && !step_range_end) - { - stop_print_frame = 0; - stop_stack_dummy = 1; -#ifdef HP_OS_BUG - trap_expected_after_continue = 1; -#endif - stop_stepping (ecs); - return; - } - } - if (step_resume_breakpoint) { /* Having a step-resume breakpoint overrides anything @@ -2400,28 +2396,11 @@ process_event_stop_test: function. That's what tells us (a) whether we want to step into it at all, and (b) what prologue we want to run to the end of, if we do step into it. */ - real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc); + real_stop_pc = skip_language_trampoline (stop_pc); + if (real_stop_pc == 0) + real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc); if (real_stop_pc != 0) ecs->stop_func_start = real_stop_pc; - else - { - real_stop_pc = DYNAMIC_TRAMPOLINE_NEXTPC (stop_pc); - if (real_stop_pc) - { - struct symtab_and_line xxx; - /* Why isn't this s_a_l called "sr_sal", like all of the - other s_a_l's where this code is duplicated? */ - init_sal (&xxx); /* initialize to zeroes */ - xxx.pc = real_stop_pc; - xxx.section = find_pc_overlay (xxx.pc); - check_for_old_step_resume_breakpoint (); - step_resume_breakpoint = - set_momentary_breakpoint (xxx, null_frame_id, bp_step_resume); - insert_breakpoints (); - keep_going (ecs); - return; - } - } /* If we have line number information for the function we are thinking of stepping into, step into it. @@ -2692,7 +2671,44 @@ step_over_function (struct execution_control_state *ecs) struct symtab_and_line sr_sal; init_sal (&sr_sal); /* initialize to zeros */ - sr_sal.pc = ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ())); + + /* NOTE: cagney/2003-04-06: + + At this point the equality get_frame_pc() == get_frame_func() + should hold. This may make it possible for this code to tell the + frame where it's function is, instead of the reverse. This would + avoid the need to search for the frame's function, which can get + very messy when there is no debug info available (look at the + heuristic find pc start code found in targets like the MIPS). */ + + /* NOTE: cagney/2003-04-06: + + The intent of DEPRECATED_SAVED_PC_AFTER_CALL was to: + + - provide a very light weight equivalent to frame_unwind_pc() + (nee FRAME_SAVED_PC) that avoids the prologue analyzer + + - avoid handling the case where the PC hasn't been saved in the + prologue analyzer + + Unfortunatly, not five lines further down, is a call to + get_frame_id() and that is guarenteed to trigger the prologue + analyzer. + + The `correct fix' is for the prologe analyzer to handle the case + where the prologue is incomplete (PC in prologue) and, + consequently, the return pc has not yet been saved. It should be + noted that the prologue analyzer needs to handle this case + anyway: frameless leaf functions that don't save the return PC; + single stepping through a prologue. + + The d10v handles all this by bailing out of the prologue analsis + when it reaches the current instruction. */ + + if (DEPRECATED_SAVED_PC_AFTER_CALL_P ()) + sr_sal.pc = ADDR_BITS_REMOVE (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ())); + else + sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (get_current_frame ())); sr_sal.section = find_pc_overlay (sr_sal.pc); check_for_old_step_resume_breakpoint (); @@ -2717,7 +2733,6 @@ stop_stepping (struct execution_control_state *ecs) time, just like we did above if we didn't break out of the loop. */ prev_pc = read_pc (); - prev_func_start = ecs->stop_func_start; prev_func_name = ecs->stop_func_name; } @@ -2734,11 +2749,6 @@ keep_going (struct execution_control_state *ecs) { /* Save the pc before execution, to compare with pc after stop. */ prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */ - prev_func_start = ecs->stop_func_start; /* Ok, since if DECR_PC_AFTER - BREAK is defined, the - original pc would not have - been at the start of a - function. */ prev_func_name = ecs->stop_func_name; if (ecs->update_step_sp) @@ -3113,6 +3123,7 @@ normal_stop (void) done: annotate_stopped (); + observer_notify_normal_stop (); } static int @@ -3493,7 +3504,7 @@ struct inferior_status enum step_over_calls_kind step_over_calls; CORE_ADDR step_resume_break_address; int stop_after_trap; - int stop_soon_quietly; + int stop_soon; struct regcache *stop_registers; /* These are here because if call_function_by_hand has written some @@ -3539,7 +3550,7 @@ save_inferior_status (int restore_stack_info) inf_status->step_frame_id = step_frame_id; inf_status->step_over_calls = step_over_calls; inf_status->stop_after_trap = stop_after_trap; - inf_status->stop_soon_quietly = stop_soon_quietly; + inf_status->stop_soon = stop_soon; /* Save original bpstat chain here; replace it with copy of chain. If caller's caller is walking the chain, they'll be happier if we hand them back the original chain when restore_inferior_status is @@ -3593,7 +3604,7 @@ restore_inferior_status (struct inferior_status *inf_status) step_frame_id = inf_status->step_frame_id; step_over_calls = inf_status->step_over_calls; stop_after_trap = inf_status->stop_after_trap; - stop_soon_quietly = inf_status->stop_soon_quietly; + stop_soon = inf_status->stop_soon; bpstat_clear (&stop_bpstat); stop_bpstat = inf_status->stop_bpstat; breakpoint_proceeded = inf_status->breakpoint_proceeded; diff --git a/gdb/infttrace.c b/gdb/infttrace.c index 02a5576..f86ab02 100644 --- a/gdb/infttrace.c +++ b/gdb/infttrace.c @@ -27,6 +27,7 @@ #include "gdb_string.h" #include "gdb_wait.h" #include "command.h" +#include "gdbthread.h" /* We need pstat functionality so that we can get the exec file for a process we attach to. @@ -2947,7 +2948,7 @@ ptrace_wait (ptid_t ptid, int *status) child_acknowledge_created_inferior.) */ int -parent_attach_all (void) +parent_attach_all (int p1, PTRACE_ARG3_TYPE p2, int p3) { int tt_status; @@ -3674,7 +3675,7 @@ call_ptrace (int pt_request, int gdb_tid, PTRACE_ARG3_TYPE addr, int data) there's no need for any "break" statements. */ case PT_SETTRC: - return parent_attach_all (); + return parent_attach_all (0, 0, 0); case PT_RUREGS: tt_status = read_from_register_save_state (gdb_tid, @@ -5378,8 +5379,7 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type) watchpoints. */ int -hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, - enum bptype type) +hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type) { CORE_ADDR page_start; int dictionary_is_empty; @@ -5439,7 +5439,7 @@ hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, hardware support. */ int -hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot) +hppa_can_use_hw_watchpoint (int type, int cnt, int ot) { return (type == bp_hardware_watchpoint); } diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index ecd486c..1a829af 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -33,8 +33,9 @@ #include "c-lang.h" #include "jv-lang.h" #include "gdbcore.h" -#include "block.h" #include "dictionary.h" +#include "block.h" +#include "demangle.h" #include <ctype.h> struct type *java_int_type; @@ -992,6 +993,12 @@ java_create_fundamental_type (struct objfile *objfile, int typeid) return c_create_fundamental_type (objfile, typeid); } +static char *java_demangle (const char *mangled, int options) +{ + return cplus_demangle (mangled, options | DMGL_JAVA); +} + + /* Table mapping opcodes into strings for printing operators and precedences of the operators. */ @@ -1050,6 +1057,8 @@ const struct language_defn java_language_defn = java_print_type, /* Print a type using appropriate syntax */ java_val_print, /* Print a value using appropriate syntax */ java_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + java_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/language.c b/gdb/language.c index 1a24b39..aba597a 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -44,6 +44,7 @@ #include "target.h" #include "parser-defs.h" #include "jv-lang.h" +#include "demangle.h" extern void _initialize_language (void); @@ -100,6 +101,8 @@ static int unk_lang_val_print (struct type *, char *, int, CORE_ADDR, static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint); +static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc); + /* Forward declaration */ extern const struct language_defn unknown_language_defn; @@ -1338,6 +1341,44 @@ add_language (const struct language_defn *lang) languages[languages_size++] = lang; } +/* Iterate through all registered languages looking for and calling + any non-NULL struct language_defn.skip_trampoline() functions. + Return the result from the first that returns non-zero, or 0 if all + `fail'. */ +CORE_ADDR +skip_language_trampoline (CORE_ADDR pc) +{ + int i; + + for (i = 0; i < languages_size; i++) + { + if (languages[i]->skip_trampoline) + { + CORE_ADDR real_pc = (languages[i]->skip_trampoline) (pc); + if (real_pc) + return real_pc; + } + } + + return 0; +} + +/* Return demangled language symbol, or NULL. + FIXME: Options are only useful for certain languages and ignored + by others, so it would be better to remove them here and have a + more flexible demangler for the languages that need it. + FIXME: Sometimes the demangler is invoked when we don't know the + language, so we can't use this everywhere. */ +char * +language_demangle (const struct language_defn *current_language, + const char *mangled, int options) +{ + if (current_language != NULL && current_language->la_demangle) + return current_language->la_demangle (mangled, options); + return NULL; +} + + /* Define the language that is no language. */ static int @@ -1399,6 +1440,18 @@ unk_lang_value_print (struct value *val, struct ui_file *stream, int format, error ("internal error - unimplemented function unk_lang_value_print called."); } +static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc) +{ + return 0; +} + +/* Unknown languages just use the cplus demangler. */ +static char *unk_lang_demangle (const char *mangled, int options) +{ + return cplus_demangle (mangled, options); +} + + static struct type **const (unknown_builtin_types[]) = { 0 @@ -1426,6 +1479,8 @@ const struct language_defn unknown_language_defn = unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ + unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1456,6 +1511,8 @@ const struct language_defn auto_language_defn = unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ + unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1485,6 +1542,8 @@ const struct language_defn local_language_defn = unk_lang_print_type, /* Print a type using appropriate syntax */ unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ + unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/language.h b/gdb/language.h index ab5e5d2..a873699 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -30,6 +30,8 @@ struct value; struct objfile; struct expression; +struct ui_file; + /* enum exp_opcode; ANSI's `wisdom' didn't include forward enum decls. */ /* This used to be included to configure GDB for one or more specific @@ -203,6 +205,15 @@ struct language_defn int (*la_value_print) (struct value *, struct ui_file *, int, enum val_prettyprint); + /* PC is possibly an unknown languages trampoline. + If that PC falls in a trampoline belonging to this language, + return the address of the first pc in the real function, or 0 + if it isn't a language tramp for this language. */ + CORE_ADDR (*skip_trampoline) (CORE_ADDR pc); + + /* Return demangled language symbol, or NULL. */ + char *(*la_demangle) (const char *mangled, int options); + /* Base 2 (binary) formats. */ struct language_format_info la_binary_format; @@ -465,4 +476,12 @@ extern void add_language (const struct language_defn *); extern enum language get_frame_language (void); /* In stack.c */ +/* Check for a language-specific trampoline. */ + +extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc); + +/* Return demangled language symbol, or NULL. */ +extern char *language_demangle (const struct language_defn *current_language, + const char *mangled, int options); + #endif /* defined (LANGUAGE_H) */ diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index 9f9dd81..c36394e 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -172,8 +172,7 @@ status_to_str (int status) snprintf (buf, sizeof (buf), "%s (terminated)", strsignal (WSTOPSIG (status))); else - snprintf (buf, sizeof (buf), "%d (exited)", - WEXITSTATUS (status)); + snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status)); return buf; } @@ -306,8 +305,8 @@ iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data) int lin_lwp_prepare_to_proceed (void) { - if (! ptid_equal (trap_ptid, null_ptid) - && ! ptid_equal (inferior_ptid, trap_ptid)) + if (!ptid_equal (trap_ptid, null_ptid) + && !ptid_equal (inferior_ptid, trap_ptid)) { /* Switched over from TRAP_PID. */ CORE_ADDR stop_pc = read_pc (); @@ -319,7 +318,7 @@ lin_lwp_prepare_to_proceed (void) if (trap_pc != stop_pc && breakpoint_here_p (trap_pc)) { /* User hasn't deleted the breakpoint. Return non-zero, and - switch back to TRAP_PID. */ + switch back to TRAP_PID. */ inferior_ptid = trap_ptid; /* FIXME: Is this stuff really necessary? */ @@ -355,7 +354,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) /* Make sure SIGCHLD is blocked. We don't want SIGCHLD events to interrupt either the ptrace() or waitpid() calls below. */ - if (! sigismember (&blocked_mask, SIGCHLD)) + if (!sigismember (&blocked_mask, SIGCHLD)) { sigaddset (&blocked_mask, SIGCHLD); sigprocmask (SIG_BLOCK, &blocked_mask, NULL); @@ -380,8 +379,8 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) safe_strerror (errno)); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, - "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n", + fprintf_unfiltered (gdb_stdlog, + "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n", target_pid_to_str (ptid)); pid = waitpid (GET_LWP (ptid), &status, 0); @@ -401,18 +400,18 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) { fprintf_unfiltered (gdb_stdlog, "LLAL: waitpid %s received %s\n", - target_pid_to_str (ptid), + target_pid_to_str (ptid), status_to_str (status)); } } else { /* We assume that the LWP representing the original process - is already stopped. Mark it as stopped in the data structure - that the lin-lwp layer uses to keep track of threads. Note - that this won't have already been done since the main thread - will have, we assume, been stopped by an attach from a - different layer. */ + is already stopped. Mark it as stopped in the data structure + that the lin-lwp layer uses to keep track of threads. Note + that this won't have already been done since the main thread + will have, we assume, been stopped by an attach from a + different layer. */ lp->stopped = 1; } } @@ -455,8 +454,7 @@ lin_lwp_attach (char *args, int from_tty) if (debug_lin_lwp) { fprintf_unfiltered (gdb_stdlog, - "LLA: waitpid %ld, faking SIGSTOP\n", - (long) pid); + "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid); } } @@ -467,7 +465,7 @@ detach_callback (struct lwp_info *lp, void *data) if (debug_lin_lwp && lp->status) fprintf_unfiltered (gdb_stdlog, "DC: Pending %s for %s on detach.\n", - strsignal (WSTOPSIG (lp->status)), + strsignal (WSTOPSIG (lp->status)), target_pid_to_str (lp->ptid)); while (lp->signalled && lp->stopped) @@ -479,10 +477,10 @@ detach_callback (struct lwp_info *lp, void *data) safe_strerror (errno)); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n", target_pid_to_str (lp->ptid), - status_to_str (lp->status)); + status_to_str (lp->status)); lp->stopped = 0; lp->signalled = 0; @@ -505,7 +503,7 @@ detach_callback (struct lwp_info *lp, void *data) if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "PTRACE_DETACH (%s, %s, 0) (OK)\n", - target_pid_to_str (lp->ptid), + target_pid_to_str (lp->ptid), strsignal (WSTOPSIG (lp->status))); delete_lwp (lp->ptid); @@ -547,7 +545,7 @@ resume_callback (struct lwp_info *lp, void *data) child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n", target_pid_to_str (lp->ptid)); lp->stopped = 0; @@ -606,13 +604,13 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo) if (lp->status) { /* FIXME: What should we do if we are supposed to continue - this thread with a signal? */ + this thread with a signal? */ gdb_assert (signo == TARGET_SIGNAL_0); return; } /* Mark LWP as not stopped to prevent it from being continued by - resume_callback. */ + resume_callback. */ lp->stopped = 0; } @@ -634,7 +632,7 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo) static int stop_callback (struct lwp_info *lp, void *data) { - if (! lp->stopped && ! lp->signalled) + if (!lp->stopped && !lp->signalled) { int ret; @@ -662,7 +660,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) { sigset_t *flush_mask = data; - if (! lp->stopped && lp->signalled) + if (!lp->stopped && lp->signalled) { pid_t pid; int status; @@ -681,7 +679,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) { fprintf_unfiltered (gdb_stdlog, "SWC: waitpid %s received %s\n", - target_pid_to_str (lp->ptid), + target_pid_to_str (lp->ptid), status_to_str (status)); } @@ -692,14 +690,14 @@ stop_wait_callback (struct lwp_info *lp, void *data) if (in_thread_list (lp->ptid)) { /* Core GDB cannot deal with us deleting the current - thread. */ + thread. */ if (!ptid_equal (lp->ptid, inferior_ptid)) delete_thread (lp->ptid); printf_unfiltered ("[%s exited]\n", target_pid_to_str (lp->ptid)); } if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n", + fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n", target_pid_to_str (lp->ptid)); delete_lwp (lp->ptid); @@ -727,29 +725,29 @@ stop_wait_callback (struct lwp_info *lp, void *data) if (WSTOPSIG (status) == SIGTRAP) { /* If a LWP other than the LWP that we're reporting an - event for has hit a GDB breakpoint (as opposed to - some random trap signal), then just arrange for it to - hit it again later. We don't keep the SIGTRAP status - and don't forward the SIGTRAP signal to the LWP. We - will handle the current event, eventually we will - resume all LWPs, and this one will get its breakpoint - trap again. - - If we do not do this, then we run the risk that the - user will delete or disable the breakpoint, but the - thread will have already tripped on it. */ + event for has hit a GDB breakpoint (as opposed to + some random trap signal), then just arrange for it to + hit it again later. We don't keep the SIGTRAP status + and don't forward the SIGTRAP signal to the LWP. We + will handle the current event, eventually we will + resume all LWPs, and this one will get its breakpoint + trap again. + + If we do not do this, then we run the risk that the + user will delete or disable the breakpoint, but the + thread will have already tripped on it. */ /* Now resume this LWP and get the SIGSTOP event. */ errno = 0; ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); if (debug_lin_lwp) { - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "PTRACE_CONT %s, 0, 0 (%s)\n", target_pid_to_str (lp->ptid), errno ? safe_strerror (errno) : "OK"); - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "SWC: Candidate SIGTRAP event in %s\n", target_pid_to_str (lp->ptid)); } @@ -767,39 +765,39 @@ stop_wait_callback (struct lwp_info *lp, void *data) else { /* The thread was stopped with a signal other than - SIGSTOP, and didn't accidentally trip a breakpoint. */ + SIGSTOP, and didn't accidentally trip a breakpoint. */ if (debug_lin_lwp) { - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "SWC: Pending event %s in %s\n", - status_to_str ((int) status), + status_to_str ((int) status), target_pid_to_str (lp->ptid)); } /* Now resume this LWP and get the SIGSTOP event. */ errno = 0; ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "SWC: PTRACE_CONT %s, 0, 0 (%s)\n", target_pid_to_str (lp->ptid), errno ? safe_strerror (errno) : "OK"); /* Hold this event/waitstatus while we check to see if - there are any more (we still want to get that SIGSTOP). */ + there are any more (we still want to get that SIGSTOP). */ stop_wait_callback (lp, data); /* If the lp->status field is still empty, use it to hold - this event. If not, then this event must be returned - to the event queue of the LWP. */ + this event. If not, then this event must be returned + to the event queue of the LWP. */ if (lp->status == 0) lp->status = status; else { if (debug_lin_lwp) { - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "SWC: kill %s, %s\n", - target_pid_to_str (lp->ptid), + target_pid_to_str (lp->ptid), status_to_str ((int) status)); } kill (GET_LWP (lp->ptid), WSTOPSIG (status)); @@ -810,7 +808,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) else { /* We caught the SIGSTOP that we intended to catch, so - there's no SIGSTOP pending. */ + there's no SIGSTOP pending. */ lp->stopped = 1; lp->signalled = 0; } @@ -904,8 +902,8 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data) tripped on it. */ if (lp->status != 0 - && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP - && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) - + && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP + && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) - DECR_PC_AFTER_BREAK)) { if (debug_lin_lwp) @@ -948,7 +946,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status) else { /* No single-stepping LWP. Select one at random, out of those - which have had SIGTRAP events. */ + which have had SIGTRAP events. */ /* First see how many SIGTRAP events we have. */ iterate_over_lwps (count_events_callback, &num_events); @@ -958,8 +956,8 @@ select_event_lwp (struct lwp_info **orig_lp, int *status) ((num_events * (double) rand ()) / (RAND_MAX + 1.0)); if (debug_lin_lwp && num_events > 1) - fprintf_unfiltered (gdb_stdlog, - "SEL: Found %d SIGTRAP events, selecting #%d\n", + fprintf_unfiltered (gdb_stdlog, + "SEL: Found %d SIGTRAP events, selecting #%d\n", num_events, random_selector); event_lp = iterate_over_lwps (select_event_lwp_callback, @@ -970,7 +968,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status) { /* Switch the event LWP. */ *orig_lp = event_lp; - *status = event_lp->status; + *status = event_lp->status; } /* Flush the wait status for the event LWP. */ @@ -1014,17 +1012,16 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (debug_lin_lwp) { - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "CW: waitpid %ld received %s\n", - (long) pid, - status_to_str (status)); + (long) pid, status_to_str (status)); } save_errno = errno; /* Make sure we don't report an event for the exit of the - original program, if we've detached from it. */ - if (pid != -1 && ! WIFSTOPPED (status) && pid != GET_PID (inferior_ptid)) + original program, if we've detached from it. */ + if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid)) { pid = -1; save_errno = EINTR; @@ -1037,7 +1034,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (pid == -1) { - warning ("Child process unexpectedly missing: %s", + warning ("Child process unexpectedly missing: %s", safe_strerror (errno)); /* Claim it exited with unknown signal. */ @@ -1064,13 +1061,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) sigemptyset (&flush_mask); /* Make sure SIGCHLD is blocked. */ - if (! sigismember (&blocked_mask, SIGCHLD)) + if (!sigismember (&blocked_mask, SIGCHLD)) { sigaddset (&blocked_mask, SIGCHLD); sigprocmask (SIG_BLOCK, &blocked_mask, NULL); } - retry: +retry: /* Make sure there is at least one LWP that has been resumed, at least if there are any LWPs at all. */ @@ -1089,7 +1086,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (debug_lin_lwp && status) fprintf_unfiltered (gdb_stdlog, "LLW: Using pending wait status %s for %s.\n", - status_to_str (status), + status_to_str (status), target_pid_to_str (lp->ptid)); } @@ -1101,7 +1098,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) else if (is_lwp (ptid)) { if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "LLW: Waiting for specific LWP %s.\n", target_pid_to_str (ptid)); @@ -1114,7 +1111,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (debug_lin_lwp && status) fprintf_unfiltered (gdb_stdlog, "LLW: Using pending wait status %s for %s.\n", - status_to_str (status), + status_to_str (status), target_pid_to_str (lp->ptid)); /* If we have to wait, take into account whether PID is a cloned @@ -1127,19 +1124,19 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (status && lp->signalled) { /* A pending SIGSTOP may interfere with the normal stream of - events. In a typical case where interference is a problem, - we have a SIGSTOP signal pending for LWP A while - single-stepping it, encounter an event in LWP B, and take the - pending SIGSTOP while trying to stop LWP A. After processing - the event in LWP B, LWP A is continued, and we'll never see - the SIGTRAP associated with the last time we were - single-stepping LWP A. */ + events. In a typical case where interference is a problem, + we have a SIGSTOP signal pending for LWP A while + single-stepping it, encounter an event in LWP B, and take the + pending SIGSTOP while trying to stop LWP A. After processing + the event in LWP B, LWP A is continued, and we'll never see + the SIGTRAP associated with the last time we were + single-stepping LWP A. */ /* Resume the thread. It should halt immediately returning the - pending SIGSTOP. */ + pending SIGSTOP. */ registers_changed (); child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, - TARGET_SIGNAL_0); + TARGET_SIGNAL_0); if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLW: %s %s, 0, 0 (expect SIGSTOP)\n", @@ -1152,8 +1149,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) stop_wait_callback (lp, NULL); } - set_sigint_trap (); /* Causes SIGINT to be passed on to the - attached process. */ + set_sigint_trap (); /* Causes SIGINT to be passed on to the + attached process. */ set_sigio_trap (); while (status == 0) @@ -1169,8 +1166,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) { fprintf_unfiltered (gdb_stdlog, "LLW: waitpid %ld received %s\n", - (long) lwpid, - status_to_str (status)); + (long) lwpid, status_to_str (status)); } lp = find_lwp_pid (pid_to_ptid (lwpid)); @@ -1179,13 +1175,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) our list, i.e. not part of the current process. This can happen if we detach from a program we original forked and then it exits. */ - if (! WIFSTOPPED (status) && ! lp) + if (!WIFSTOPPED (status) && !lp) { status = 0; continue; } - if (! lp) + if (!lp) { lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid))); if (options & __WCLONE) @@ -1197,10 +1193,10 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) && WSTOPSIG (status) == SIGSTOP); lp->signalled = 1; - if (! in_thread_list (inferior_ptid)) + if (!in_thread_list (inferior_ptid)) { inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), - GET_PID (inferior_ptid)); + GET_PID (inferior_ptid)); add_thread (inferior_ptid); } @@ -1211,22 +1207,22 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) } /* Make sure we don't report a TARGET_WAITKIND_EXITED or - TARGET_WAITKIND_SIGNALLED event if there are still LWP's - left in the process. */ + TARGET_WAITKIND_SIGNALLED event if there are still LWP's + left in the process. */ if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1) { if (in_thread_list (lp->ptid)) { /* Core GDB cannot deal with us deleting the current - thread. */ - if (! ptid_equal (lp->ptid, inferior_ptid)) + thread. */ + if (!ptid_equal (lp->ptid, inferior_ptid)) delete_thread (lp->ptid); printf_unfiltered ("[%s exited]\n", target_pid_to_str (lp->ptid)); } if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, - "LLW: %s exited.\n", + fprintf_unfiltered (gdb_stdlog, + "LLW: %s exited.\n", target_pid_to_str (lp->ptid)); delete_lwp (lp->ptid); @@ -1240,13 +1236,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) } /* Make sure we don't report a SIGSTOP that we sent - ourselves in an attempt to stop an LWP. */ + ourselves in an attempt to stop an LWP. */ if (lp->signalled - && WIFSTOPPED (status) - && WSTOPSIG (status) == SIGSTOP) + && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP) { if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "LLW: Delayed SIGSTOP caught for %s.\n", target_pid_to_str (lp->ptid)); @@ -1255,11 +1250,11 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) registers_changed (); child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, - TARGET_SIGNAL_0); + TARGET_SIGNAL_0); if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLW: %s %s, 0, 0 (discard SIGSTOP)\n", - lp->step ? + lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT", target_pid_to_str (lp->ptid)); @@ -1309,16 +1304,17 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) && signal_pass_state (signo) == 1) { /* FIMXE: kettenis/2001-06-06: Should we resume all threads - here? It is not clear we should. GDB may not expect - other threads to run. On the other hand, not resuming - newly attached threads may cause an unwanted delay in - getting them running. */ + here? It is not clear we should. GDB may not expect + other threads to run. On the other hand, not resuming + newly attached threads may cause an unwanted delay in + getting them running. */ registers_changed (); child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo); if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLW: %s %s, %s (preempt 'handle')\n", - lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT", + lp->step ? + "PTRACE_SINGLESTEP" : "PTRACE_CONT", target_pid_to_str (lp->ptid), signo ? strsignal (signo) : "0"); lp->stopped = 0; @@ -1326,13 +1322,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) goto retry; } - if (signo == TARGET_SIGNAL_INT - && signal_pass_state (signo) == 0) + if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0) { /* If ^C/BREAK is typed at the tty/console, SIGINT gets - forwarded to the entire process group, that is, all LWP's - will receive it. Since we only want to report it once, - we try to flush it from all LWPs except this one. */ + forwarded to the entire process group, that is, all LWP's + will receive it. Since we only want to report it once, + we try to flush it from all LWPs except this one. */ sigaddset (&flush_mask, SIGINT); } } @@ -1342,8 +1337,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n", - status_to_str (status), - target_pid_to_str (lp->ptid)); + status_to_str (status), target_pid_to_str (lp->ptid)); /* Now stop all other LWP's ... */ iterate_over_lwps (stop_callback, NULL); @@ -1370,7 +1364,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) { trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid))); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "LLW: trap_ptid is %s.\n", target_pid_to_str (trap_ptid)); } @@ -1387,7 +1381,7 @@ kill_callback (struct lwp_info *lp, void *data) errno = 0; ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0); if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, + fprintf_unfiltered (gdb_stdlog, "KC: PTRACE_KILL %s, 0, 0 (%s)\n", target_pid_to_str (lp->ptid), errno ? safe_strerror (errno) : "OK"); @@ -1430,7 +1424,7 @@ kill_wait_callback (struct lwp_info *lp, void *data) if (pid != (pid_t) -1 && debug_lin_lwp) { fprintf_unfiltered (gdb_stdlog, - "KWC: wait %s received unk.\n", + "KWC: wait %s received unk.\n", target_pid_to_str (lp->ptid)); } } @@ -1458,7 +1452,7 @@ lin_lwp_create_inferior (char *exec_file, char *allargs, char **env) child_ops.to_create_inferior (exec_file, allargs, env); } -static void +static void lin_lwp_mourn_inferior (void) { trap_ptid = null_ptid; @@ -1475,8 +1469,7 @@ lin_lwp_mourn_inferior (void) static int lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, - struct target_ops *target) + struct mem_attrib *attrib, struct target_ops *target) { struct cleanup *old_chain = save_inferior_ptid (); int xfer; @@ -1502,7 +1495,7 @@ lin_lwp_thread_alive (ptid_t ptid) if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n", - target_pid_to_str (ptid), + target_pid_to_str (ptid), errno ? safe_strerror (errno) : "OK"); if (errno) return 0; @@ -1586,11 +1579,9 @@ _initialize_lin_lwp (void) sigemptyset (&blocked_mask); add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger, - (char *) &debug_lin_lwp, + (char *) &debug_lin_lwp, "Set debugging of GNU/Linux lwp module.\n\ -Enables printf debugging output.\n", - &setdebuglist), - &showdebuglist); +Enables printf debugging output.\n", &setdebuglist), &showdebuglist); } diff --git a/gdb/linespec.h b/gdb/linespec.h index 7c3f90c..3ede4bd 100644 --- a/gdb/linespec.h +++ b/gdb/linespec.h @@ -19,6 +19,8 @@ #if !defined (LINESPEC_H) #define LINESPEC_H 1 +struct symtab; + extern struct symtabs_and_lines decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, int default_line, diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index 00383e9..a951296 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -21,17 +21,17 @@ #include "defs.h" #include "inferior.h" -#include <sys/param.h> /* for MAXPATHLEN */ -#include <sys/procfs.h> /* for elf_gregset etc. */ -#include "gdb_stat.h" /* for struct stat */ -#include <ctype.h> /* for isdigit */ -#include <unistd.h> /* for open, pread64 */ -#include <fcntl.h> /* for O_RDONLY */ -#include "regcache.h" /* for registers_changed */ -#include "gregset.h" /* for gregset */ -#include "gdbcore.h" /* for get_exec_file */ -#include "gdbthread.h" /* for struct thread_info etc. */ -#include "elf-bfd.h" /* for elfcore_write_* */ +#include <sys/param.h> /* for MAXPATHLEN */ +#include <sys/procfs.h> /* for elf_gregset etc. */ +#include "gdb_stat.h" /* for struct stat */ +#include <ctype.h> /* for isdigit */ +#include <unistd.h> /* for open, pread64 */ +#include <fcntl.h> /* for O_RDONLY */ +#include "regcache.h" /* for registers_changed */ +#include "gregset.h" /* for gregset */ +#include "gdbcore.h" /* for get_exec_file */ +#include "gdbthread.h" /* for struct thread_info etc. */ +#include "elf-bfd.h" /* for elfcore_write_* */ #include "cli/cli-decode.h" /* for add_info */ #include "gdb_string.h" @@ -69,28 +69,26 @@ child_pid_to_exec_file (int pid) * Service function for corefiles and info proc. */ -static int -read_mapping (FILE *mapfile, - long long *addr, - long long *endaddr, - char *permissions, - long long *offset, - char *device, - long long *inode, - char *filename) +static int +read_mapping (FILE *mapfile, + long long *addr, + long long *endaddr, + char *permissions, + long long *offset, + char *device, long long *inode, char *filename) { - int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx", + int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx", addr, endaddr, permissions, offset, device, inode); if (ret > 0 && ret != EOF && *inode != 0) { /* Eat everything up to EOL for the filename. This will prevent - weird filenames (such as one with embedded whitespace) from - confusing this code. It also makes this code more robust - in respect to annotations the kernel may add after the - filename. + weird filenames (such as one with embedded whitespace) from + confusing this code. It also makes this code more robust + in respect to annotations the kernel may add after the + filename. - Note the filename is used for informational purposes only. */ + Note the filename is used for informational purposes only. */ ret += fscanf (mapfile, "%[^\n]\n", filename); } else @@ -108,11 +106,9 @@ read_mapping (FILE *mapfile, */ static int -linux_find_memory_regions (int (*func) (CORE_ADDR, +linux_find_memory_regions (int (*func) (CORE_ADDR, unsigned long, - int, int, int, - void *), - void *obfd) + int, int, int, void *), void *obfd) { long long pid = PIDGET (inferior_ptid); char mapsfilename[MAXPATHLEN]; @@ -128,31 +124,29 @@ linux_find_memory_regions (int (*func) (CORE_ADDR, error ("Could not open %s\n", mapsfilename); if (info_verbose) - fprintf_filtered (gdb_stdout, + fprintf_filtered (gdb_stdout, "Reading memory regions from %s\n", mapsfilename); /* Now iterate until end-of-file. */ - while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0], + while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0], &offset, &device[0], &inode, &filename[0])) { size = endaddr - addr; /* Get the segment's permissions. */ - read = (strchr (permissions, 'r') != 0); + read = (strchr (permissions, 'r') != 0); write = (strchr (permissions, 'w') != 0); - exec = (strchr (permissions, 'x') != 0); + exec = (strchr (permissions, 'x') != 0); if (info_verbose) { - fprintf_filtered (gdb_stdout, - "Save segment, %lld bytes at 0x%s (%c%c%c)", - size, paddr_nz (addr), - read ? 'r' : ' ', - write ? 'w' : ' ', - exec ? 'x' : ' '); + fprintf_filtered (gdb_stdout, + "Save segment, %lld bytes at 0x%s (%c%c%c)", + size, paddr_nz (addr), + read ? 'r' : ' ', + write ? 'w' : ' ', exec ? 'x' : ' '); if (filename && filename[0]) - fprintf_filtered (gdb_stdout, - " for %s", filename); + fprintf_filtered (gdb_stdout, " for %s", filename); fprintf_filtered (gdb_stdout, "\n"); } @@ -169,7 +163,7 @@ linux_find_memory_regions (int (*func) (CORE_ADDR, */ static char * -linux_do_thread_registers (bfd *obfd, ptid_t ptid, +linux_do_thread_registers (bfd *obfd, ptid_t ptid, char *note_data, int *note_size) { gdb_gregset_t gregs; @@ -180,26 +174,23 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid, unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid); fill_gregset (&gregs, -1); - note_data = (char *) elfcore_write_prstatus (obfd, - note_data, - note_size, - merged_pid, - stop_signal, - &gregs); + note_data = (char *) elfcore_write_prstatus (obfd, + note_data, + note_size, + merged_pid, + stop_signal, &gregs); fill_fpregset (&fpregs, -1); - note_data = (char *) elfcore_write_prfpreg (obfd, - note_data, - note_size, - &fpregs, - sizeof (fpregs)); + note_data = (char *) elfcore_write_prfpreg (obfd, + note_data, + note_size, + &fpregs, sizeof (fpregs)); #ifdef FILL_FPXREGSET fill_fpxregset (&fpxregs, -1); - note_data = (char *) elfcore_write_prxfpreg (obfd, - note_data, - note_size, - &fpxregs, - sizeof (fpxregs)); + note_data = (char *) elfcore_write_prxfpreg (obfd, + note_data, + note_size, + &fpxregs, sizeof (fpxregs)); #endif return note_data; } @@ -228,9 +219,9 @@ linux_corefile_thread_callback (struct thread_info *ti, void *data) registers_changed (); target_fetch_registers (-1); /* FIXME should not be necessary; fill_gregset should do it automatically. */ - args->note_data = linux_do_thread_registers (args->obfd, - ti->ptid, - args->note_data, + args->note_data = linux_do_thread_registers (args->obfd, + ti->ptid, + args->note_data, args->note_size); args->num_notes++; inferior_ptid = saved_ptid; @@ -252,28 +243,24 @@ linux_make_note_section (bfd *obfd, int *note_size) { struct linux_corefile_thread_data thread_args; struct cleanup *old_chain; - char fname[16] = {'\0'}; - char psargs[80] = {'\0'}; + char fname[16] = { '\0' }; + char psargs[80] = { '\0' }; char *note_data = NULL; ptid_t current_ptid = inferior_ptid; if (get_exec_file (0)) { strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname)); - strncpy (psargs, get_exec_file (0), - sizeof (psargs)); + strncpy (psargs, get_exec_file (0), sizeof (psargs)); if (get_inferior_args ()) { - strncat (psargs, " ", - sizeof (psargs) - strlen (psargs)); - strncat (psargs, get_inferior_args (), + strncat (psargs, " ", sizeof (psargs) - strlen (psargs)); + strncat (psargs, get_inferior_args (), sizeof (psargs) - strlen (psargs)); } - note_data = (char *) elfcore_write_prpsinfo (obfd, - note_data, - note_size, - fname, - psargs); + note_data = (char *) elfcore_write_prpsinfo (obfd, + note_data, + note_size, fname, psargs); } /* Dump information for threads. */ @@ -285,8 +272,8 @@ linux_make_note_section (bfd *obfd, int *note_size) if (thread_args.num_notes == 0) { /* iterate_over_threads didn't come up with any threads; - just use inferior_ptid. */ - note_data = linux_do_thread_registers (obfd, inferior_ptid, + just use inferior_ptid. */ + note_data = linux_do_thread_registers (obfd, inferior_ptid, note_data, note_size); } else @@ -420,33 +407,30 @@ linux_info_proc_cmd (char *args, int from_tty) if (TARGET_ADDR_BIT == 32) { header_fmt_string = "\t%10s %10s %10s %10s %7s\n"; - data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n"; + data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n"; } else { header_fmt_string = " %18s %18s %10s %10s %7s\n"; - data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n"; + data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n"; } printf_filtered ("Mapped address spaces:\n\n"); - printf_filtered (header_fmt_string, + printf_filtered (header_fmt_string, "Start Addr", " End Addr", - " Size", - " Offset", - "objfile"); - - while (read_mapping (procfile, &addr, &endaddr, &permissions[0], + " Size", " Offset", "objfile"); + + while (read_mapping (procfile, &addr, &endaddr, &permissions[0], &offset, &device[0], &inode, &filename[0])) { size = endaddr - addr; - printf_filtered (data_fmt_string, - (unsigned long) addr, /* FIXME: pr_addr */ - (unsigned long) endaddr, - (int) size, - (unsigned int) offset, + printf_filtered (data_fmt_string, (unsigned long) addr, /* FIXME: pr_addr */ + (unsigned long) endaddr, + (int) size, + (unsigned int) offset, filename[0] ? filename : ""); - + } fclose (procfile); @@ -463,7 +447,7 @@ linux_info_proc_cmd (char *args, int from_tty) printf_filtered (buffer); fclose (procfile); } - else + else warning ("unable to open /proc file '%s'", fname1); } if (stat_f || all) @@ -493,16 +477,16 @@ linux_info_proc_cmd (char *args, int from_tty) if (fscanf (procfile, "%u ", &itmp) > 0) printf_filtered ("Flags: 0x%x\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Minor faults (no memory page): %u\n", + printf_filtered ("Minor faults (no memory page): %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Minor faults, children: %u\n", + printf_filtered ("Minor faults, children: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Major faults (memory page faults): %u\n", + printf_filtered ("Major faults (memory page faults): %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Major faults, children: %u\n", + printf_filtered ("Major faults, children: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%d ", &itmp) > 0) printf_filtered ("utime: %d\n", itmp); @@ -513,36 +497,34 @@ linux_info_proc_cmd (char *args, int from_tty) if (fscanf (procfile, "%d ", &itmp) > 0) printf_filtered ("stime, children: %d\n", itmp); if (fscanf (procfile, "%d ", &itmp) > 0) - printf_filtered ("jiffies remaining in current time slice: %d\n", + printf_filtered ("jiffies remaining in current time slice: %d\n", itmp); if (fscanf (procfile, "%d ", &itmp) > 0) printf_filtered ("'nice' value: %d\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("jiffies until next timeout: %u\n", + printf_filtered ("jiffies until next timeout: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("jiffies until next SIGALRM: %u\n", + printf_filtered ("jiffies until next SIGALRM: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%d ", &itmp) > 0) - printf_filtered ("start time (jiffies since system boot): %d\n", + printf_filtered ("start time (jiffies since system boot): %d\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Virtual memory size: %u\n", + printf_filtered ("Virtual memory size: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("Resident set size: %u\n", - (unsigned int) itmp); + printf_filtered ("Resident set size: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) - printf_filtered ("rlim: %u\n", - (unsigned int) itmp); + printf_filtered ("rlim: %u\n", (unsigned int) itmp); if (fscanf (procfile, "%u ", &itmp) > 0) printf_filtered ("Start of text: 0x%x\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) printf_filtered ("End of text: 0x%x\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) printf_filtered ("Start of stack: 0x%x\n", itmp); -#if 0 /* Don't know how architecture-dependent the rest is... - Anyway the signal bitmap info is available from "status". */ +#if 0 /* Don't know how architecture-dependent the rest is... + Anyway the signal bitmap info is available from "status". */ if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */ printf_filtered ("Kernel stack pointer: 0x%x\n", itmp); if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */ @@ -574,7 +556,7 @@ _initialize_linux_proc (void) inftarg_set_find_memory_regions (linux_find_memory_regions); inftarg_set_make_corefile_notes (linux_make_note_section); - add_info ("proc", linux_info_proc_cmd, + add_info ("proc", linux_info_proc_cmd, "Show /proc process information about any running process.\n\ Specify any process id, or use the program being debugged by default.\n\ Specify any of the following keywords for detailed info:\n\ @@ -584,9 +566,9 @@ Specify any of the following keywords for detailed info:\n\ all -- list all available /proc info."); } -int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write, - struct mem_attrib *attrib, - struct target_ops *target) +int +linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write, + struct mem_attrib *attrib, struct target_ops *target) { int fd, ret; char filename[64]; @@ -616,8 +598,7 @@ int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write, #ifdef HAVE_PREAD64 if (pread64 (fd, myaddr, len, addr) != len) #else - if (lseek (fd, addr, SEEK_SET) == -1 - || read (fd, myaddr, len) != len) + if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len) #endif ret = 0; else diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 116d850..4932cdf 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -426,6 +426,8 @@ const struct language_defn m2_language_defn = m2_print_type, /* Print a type using appropriate syntax */ m2_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"%loB", "", "o", "B"}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c index 28e62a8..93ef57a 100644 --- a/gdb/m3-nat.c +++ b/gdb/m3-nat.c @@ -1,4566 +1,4566 @@ -/* Interface GDB to Mach 3.0 operating systems. - (Most) Mach 3.0 related routines live in this file. - - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * Author: Jukka Virtanen <jtv@hut.fi> - * Computing Centre - * Helsinki University of Technology - * Finland - * - * Thanks to my friends who helped with ideas and testing: - * - * Johannes Helander, Antti Louko, Tero Mononen, - * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi - * - * Tero Kivinen and Eamonn McManus - * kivinen@cs.hut.fi emcmanus@gr.osf.org - * - */ - -#include <stdio.h> - -#include <mach.h> -#include <servers/netname.h> -#include <servers/machid.h> -#include <mach/message.h> -#include <mach/notify.h> -#include <mach_error.h> -#include <mach/exception.h> -#include <mach/vm_attributes.h> - -#include "defs.h" -#include "inferior.h" -#include "symtab.h" -#include "value.h" -#include "language.h" -#include "target.h" -#include "gdb_wait.h" -#include "gdbcmd.h" -#include "gdbcore.h" -#include "regcache.h" - -#if 0 -#include <servers/machid_lib.h> -#else -#define MACH_TYPE_TASK 1 -#define MACH_TYPE_THREAD 2 -#endif - -/* Included only for signal names and NSIG - - * note: There are many problems in signal handling with - * gdb in Mach 3.0 in general. - */ -#include <signal.h> -#define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */ - -#include <cthreads.h> - -/* This is what a cproc looks like. This is here partly because - cthread_internals.h is not a header we can just #include, partly with - an eye towards perhaps getting this to work with cross-debugging - someday. Best solution is if CMU publishes a real interface to this - stuff. */ -#define CPROC_NEXT_OFFSET 0 -#define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE) -#define CPROC_INCARNATION_SIZE (sizeof (cthread_t)) -#define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE) -#define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE) -#define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) -#define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE) -#define CPROC_REPLY_SIZE (sizeof (mach_port_t)) -#define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE) -#define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE) -#define CPROC_LOCK_SIZE (sizeof (spin_lock_t)) -#define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE) -#define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE) -#define CPROC_WIRED_SIZE (sizeof (mach_port_t)) -#define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE) -#define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE) -#define CPROC_MSG_SIZE (sizeof (mach_msg_header_t)) -#define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE) -#define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE) -#define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) -#define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE) - -/* Values for the state field in the cproc. */ -#define CPROC_RUNNING 0 -#define CPROC_SWITCHING 1 -#define CPROC_BLOCKED 2 -#define CPROC_CONDWAIT 4 - -/* For cproc and kernel thread mapping */ -typedef struct gdb_thread - { - mach_port_t name; - CORE_ADDR sp; - CORE_ADDR pc; - CORE_ADDR fp; - boolean_t in_emulator; - int slotid; - - /* This is for the mthreads list. It points to the cproc list. - Perhaps the two lists should be merged (or perhaps it was a mistake - to make them both use a struct gdb_thread). */ - struct gdb_thread *cproc; - - /* These are for the cproc list, which is linked through the next field - of the struct gdb_thread. */ - char raw_cproc[CPROC_SIZE]; - /* The cthread which is pointed to by the incarnation field from the - cproc. This points to the copy we've read into GDB. */ - cthread_t cthread; - /* Point back to the mthreads list. */ - int reverse_map; - struct gdb_thread *next; - } - *gdb_thread_t; - -/* - * Actions for Mach exceptions. - * - * sigmap field maps the exception to corresponding Unix signal. - * - * I do not know how to map the exception to unix signal - * if SIG_UNKNOWN is specified. - */ - -struct exception_list - { - char *name; - boolean_t forward; - boolean_t print; - int sigmap; - } -exception_map[] = -{ - { - "not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN - } - , - { - "EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV - } - , - { - "EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL - } - , - { - "EXC_ARITHMETIC", FALSE, TRUE, SIGFPE - } - , - { - "EXC_EMULATION", FALSE, TRUE, SIGEMT - } - , /* ??? */ - { - "EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN - } - , - { - "EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP - } -}; - -/* Mach exception table size */ -int max_exception = sizeof (exception_map) / sizeof (struct exception_list) - 1; - -#define MAX_EXCEPTION max_exception - -WAITTYPE wait_status; - -/* If you define this, intercepted bsd server calls will be - * dumped while waiting the inferior to EXEC the correct - * program - */ -/* #define DUMP_SYSCALL /* debugging interceptor */ - -/* xx_debug() outputs messages if this is nonzero. - * If > 1, DUMP_SYSCALL will dump message contents. - */ -int debug_level = 0; - -/* "Temporary" debug stuff */ -void -xx_debug (char *fmt, int a, int b, int c) -{ - if (debug_level) - warning (fmt, a, b, c); -} - -/* This is in libmach.a */ -extern mach_port_t name_server_port; - -/* Set in catch_exception_raise */ -int stop_exception, stop_code, stop_subcode; -int stopped_in_exception; - -/* Thread that was the active thread when we stopped */ -thread_t stop_thread = MACH_PORT_NULL; - -char *hostname = ""; - -/* Set when task is attached or created */ -boolean_t emulator_present = FALSE; - -task_t inferior_task; -thread_t current_thread; - -/* Exception ports for inferior task */ -mach_port_t inferior_exception_port = MACH_PORT_NULL; -mach_port_t inferior_old_exception_port = MACH_PORT_NULL; - -/* task exceptions and notifications */ -mach_port_t inferior_wait_port_set = MACH_PORT_NULL; -mach_port_t our_notify_port = MACH_PORT_NULL; - -/* This is "inferior_wait_port_set" when not single stepping, and - * "singlestepped_thread_port" when we are single stepping. - * - * This is protected by a cleanup function: discard_single_step() - */ -mach_port_t currently_waiting_for = MACH_PORT_NULL; - -/* A port for external messages to gdb. - * External in the meaning that they do not come - * from the inferior_task, but rather from external - * tasks. - * - * As a debugging feature: - * A debugger debugging another debugger can stop the - * inferior debugger by the following command sequence - * (without running external programs) - * - * (top-gdb) set stop_inferior_gdb () - * (top-gdb) continue - */ -mach_port_t our_message_port = MACH_PORT_NULL; - -/* For single stepping */ -mach_port_t thread_exception_port = MACH_PORT_NULL; -mach_port_t thread_saved_exception_port = MACH_PORT_NULL; -mach_port_t singlestepped_thread_port = MACH_PORT_NULL; - -/* For machid calls */ -mach_port_t mid_server = MACH_PORT_NULL; -mach_port_t mid_auth = MACH_PORT_NULL; - -/* If gdb thinks the inferior task is not suspended, it - * must take suspend/abort the threads when it reads the state. - */ -int must_suspend_thread = 0; - -/* When single stepping, we switch the port that mach_really_wait() listens to. - * This cleanup is a guard to prevent the port set from being left to - * the singlestepped_thread_port when error() is called. - * This is nonzero only when we are single stepping. - */ -#define NULL_CLEANUP (struct cleanup *)0 -struct cleanup *cleanup_step = NULL_CLEANUP; - - -static struct target_ops m3_ops; - -static void m3_kill_inferior (); - -#if 0 -#define MACH_TYPE_EXCEPTION_PORT -1 -#endif - -/* Chain of ports to remember requested notifications. */ - -struct port_chain - { - struct port_chain *next; - mach_port_t port; - int type; - int mid; /* Now only valid with MACH_TYPE_THREAD and */ - /* MACH_TYPE_THREAD */ - }; -typedef struct port_chain *port_chain_t; - -/* Room for chain nodes comes from pchain_obstack */ -struct obstack pchain_obstack; -struct obstack *port_chain_obstack = &pchain_obstack; - -/* For thread handling */ -struct obstack Cproc_obstack; -struct obstack *cproc_obstack = &Cproc_obstack; - -/* the list of notified ports */ -port_chain_t notify_chain = (port_chain_t) NULL; - -port_chain_t -port_chain_insert (port_chain_t list, mach_port_t name, int type) -{ - kern_return_t ret; - port_chain_t new; - int mid; - - if (!MACH_PORT_VALID (name)) - return list; - - if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD) - { - if (!MACH_PORT_VALID (mid_server)) - { - warning ("Machid server port invalid, can not map port 0x%x to MID", - name); - mid = name; - } - else - { - ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); - - if (ret != KERN_SUCCESS) - { - warning ("Can not map name (0x%x) to MID with machid", name); - mid = name; - } - } - } - else - internal_error (__FILE__, __LINE__, "failed internal consistency check"); - - new = (port_chain_t) obstack_alloc (port_chain_obstack, - sizeof (struct port_chain)); - new->next = list; - new->port = name; - new->type = type; - new->mid = mid; - - return new; -} - -port_chain_t -port_chain_delete (port_chain_t list, mach_port_t elem) -{ - if (list) - if (list->port == elem) - list = list->next; - else - while (list->next) - { - if (list->next->port == elem) - list->next = list->next->next; /* GCd with obstack_free() */ - else - list = list->next; - } - return list; -} - -void -port_chain_destroy (struct obstack *ostack) -{ - obstack_free (ostack, 0); - obstack_init (ostack); -} - -port_chain_t -port_chain_member (port_chain_t list, mach_port_t elem) -{ - while (list) - { - if (list->port == elem) - return list; - list = list->next; - } - return (port_chain_t) NULL; -} - -int -map_port_name_to_mid (mach_port_t name, int type) -{ - port_chain_t elem; - - if (!MACH_PORT_VALID (name)) - return -1; - - elem = port_chain_member (notify_chain, name); - - if (elem && (elem->type == type)) - return elem->mid; - - if (elem) - return -1; - - if (!MACH_PORT_VALID (mid_server)) - { - warning ("Machid server port invalid, can not map port 0x%x to mid", - name); - return -1; - } - else - { - int mid; - kern_return_t ret; - - ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); - - if (ret != KERN_SUCCESS) - { - warning ("Can not map name (0x%x) to mid with machid", name); - return -1; - } - return mid; - } -} - -/* Guard for currently_waiting_for and singlestepped_thread_port */ -static void -discard_single_step (thread_t thread) -{ - currently_waiting_for = inferior_wait_port_set; - - cleanup_step = NULL_CLEANUP; - if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port)) - setup_single_step (thread, FALSE); -} - -setup_single_step (thread_t thread, boolean_t start_step) -{ - kern_return_t ret; - - if (!MACH_PORT_VALID (thread)) - error ("Invalid thread supplied to setup_single_step"); - else - { - mach_port_t teport; - - /* Get the current thread exception port */ - ret = thread_get_exception_port (thread, &teport); - CHK ("Getting thread's exception port", ret); - - if (start_step) - { - if (MACH_PORT_VALID (singlestepped_thread_port)) - { - warning ("Singlestepped_thread_port (0x%x) is still valid?", - singlestepped_thread_port); - singlestepped_thread_port = MACH_PORT_NULL; - } - - /* If we are already stepping this thread */ - if (MACH_PORT_VALID (teport) && teport == thread_exception_port) - { - ret = mach_port_deallocate (mach_task_self (), teport); - CHK ("Could not deallocate thread exception port", ret); - } - else - { - ret = thread_set_exception_port (thread, thread_exception_port); - CHK ("Setting exception port for thread", ret); -#if 0 - /* Insert thread exception port to wait port set */ - ret = mach_port_move_member (mach_task_self (), - thread_exception_port, - inferior_wait_port_set); - CHK ("Moving thread exception port to inferior_wait_port_set", - ret); -#endif - thread_saved_exception_port = teport; - } - - thread_trace (thread, TRUE); - - singlestepped_thread_port = thread_exception_port; - currently_waiting_for = singlestepped_thread_port; - cleanup_step = make_cleanup (discard_single_step, thread); - } - else - { - if (!MACH_PORT_VALID (teport)) - error ("Single stepped thread had an invalid exception port?"); - - if (teport != thread_exception_port) - error ("Single stepped thread had an unknown exception port?"); - - ret = mach_port_deallocate (mach_task_self (), teport); - CHK ("Couldn't deallocate thread exception port", ret); -#if 0 - /* Remove thread exception port from wait port set */ - ret = mach_port_move_member (mach_task_self (), - thread_exception_port, - MACH_PORT_NULL); - CHK ("Removing thread exception port from inferior_wait_port_set", - ret); -#endif - /* Restore thread's old exception port */ - ret = thread_set_exception_port (thread, - thread_saved_exception_port); - CHK ("Restoring stepped thread's exception port", ret); - - if (MACH_PORT_VALID (thread_saved_exception_port)) - (void) mach_port_deallocate (mach_task_self (), - thread_saved_exception_port); - - thread_trace (thread, FALSE); - - singlestepped_thread_port = MACH_PORT_NULL; - currently_waiting_for = inferior_wait_port_set; - if (cleanup_step) - discard_cleanups (cleanup_step); - } - } -} - -static -request_notify (mach_port_t name, mach_msg_id_t variant, int type) -{ - kern_return_t ret; - mach_port_t previous_port_dummy = MACH_PORT_NULL; - - if (!MACH_PORT_VALID (name)) - return; - - if (port_chain_member (notify_chain, name)) - return; - - ret = mach_port_request_notification (mach_task_self (), - name, - variant, - 1, - our_notify_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &previous_port_dummy); - CHK ("Serious: request_notify failed", ret); - - (void) mach_port_deallocate (mach_task_self (), - previous_port_dummy); - - notify_chain = port_chain_insert (notify_chain, name, type); -} - -reverse_msg_bits (mach_msg_header_t *msgp, int type) -{ - int rbits, lbits; - rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits); - lbits = type; - msgp->msgh_bits = - (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) | - MACH_MSGH_BITS (lbits, rbits); -} - -/* On the third day He said: - - Let this be global - and then it was global. - - When creating the inferior fork, the - child code in inflow.c sets the name of the - bootstrap_port in its address space to this - variable. - - The name is transferred to our address space - with mach3_read_inferior(). - - Thou shalt not do this with - task_get_bootstrap_port() in this task, since - the name in the inferior task is different than - the one we get. - - For blessed are the meek, as they shall inherit - the address space. - */ -mach_port_t original_server_port_name = MACH_PORT_NULL; - - -/* Called from inferior after FORK but before EXEC */ -static void -m3_trace_me (void) -{ - kern_return_t ret; - - /* Get the NAME of the bootstrap port in this task - so that GDB can read it */ - ret = task_get_bootstrap_port (mach_task_self (), - &original_server_port_name); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, "failed internal consistency check"); - ret = mach_port_deallocate (mach_task_self (), - original_server_port_name); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, "failed internal consistency check"); - - /* Suspend this task to let the parent change my ports. - Resumed by the debugger */ - ret = task_suspend (mach_task_self ()); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, "failed internal consistency check"); -} - -/* - * Intercept system calls to Unix server. - * After EXEC_COUNTER calls to exec(), return. - * - * Pre-assertion: Child is suspended. (Not verified) - * Post-condition: Child is suspended after EXEC_COUNTER exec() calls. - */ - -void -intercept_exec_calls (int exec_counter) -{ - int terminal_initted = 0; - - struct syscall_msg_t - { - mach_msg_header_t header; - mach_msg_type_t type; - char room[2000]; /* Enuff space */ - }; - - struct syscall_msg_t syscall_in, syscall_out; - - mach_port_t fake_server; - mach_port_t original_server_send; - mach_port_t original_exec_reply; - mach_port_t exec_reply; - mach_port_t exec_reply_send; - mach_msg_type_name_t acquired; - mach_port_t emulator_server_port_name; - struct task_basic_info info; - mach_msg_type_number_t info_count; - - kern_return_t ret; - - if (exec_counter <= 0) - return; /* We are already set up in the correct program */ - - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &fake_server); - CHK ("create inferior_fake_server port failed", ret); - - /* Wait for inferior_task to suspend itself */ - while (1) - { - info_count = sizeof (info); - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t) & info, - &info_count); - CHK ("Task info", ret); - - if (info.suspend_count) - break; - - /* Note that the definition of the parameter was undefined - * at the time of this writing, so I just use an `ad hoc' value. - */ - (void) swtch_pri (42); /* Universal Priority Value */ - } - - /* Read the inferior's bootstrap port name */ - if (!mach3_read_inferior (&original_server_port_name, - &original_server_port_name, - sizeof (original_server_port_name))) - error ("Can't read inferior task bootstrap port name"); - - /* @@ BUG: If more than 1 send right GDB will FAIL!!! */ - /* Should get refs, and set them back when restoring */ - /* Steal the original bsd server send right from inferior */ - ret = mach_port_extract_right (inferior_task, - original_server_port_name, - MACH_MSG_TYPE_MOVE_SEND, - &original_server_send, - &acquired); - CHK ("mach_port_extract_right (bsd server send)", ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND) - error ("Incorrect right extracted, send right to bsd server expected"); - - ret = mach_port_insert_right (inferior_task, - original_server_port_name, - fake_server, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("mach_port_insert_right (fake server send)", ret); - - xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n", - fake_server, - original_server_port_name, original_server_send); - - /* A receive right to the reply generated by unix server exec() request */ - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &exec_reply); - CHK ("create intercepted_reply_port port failed", ret); - - /* Pass this send right to Unix server so it replies to us after exec() */ - ret = mach_port_extract_right (mach_task_self (), - exec_reply, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &exec_reply_send, - &acquired); - CHK ("mach_port_extract_right (exec_reply)", ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE) - error ("Incorrect right extracted, send once expected for exec reply"); - - ret = mach_port_move_member (mach_task_self (), - fake_server, - inferior_wait_port_set); - CHK ("Moving fake syscall port to inferior_wait_port_set", ret); - - xx_debug ("syscall fake server set up, resuming inferior\n"); - - ret = task_resume (inferior_task); - CHK ("task_resume (startup)", ret); - - /* Read requests from the inferior. - Pass directly through everything else except exec() calls. - */ - while (exec_counter > 0) - { - ret = mach_msg (&syscall_in.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct syscall_msg_t), /* receive size */ - inferior_wait_port_set, /* receive_name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - CHK ("mach_msg (intercepted sycall)", ret); - -#ifdef DUMP_SYSCALL - print_msg (&syscall_in.header); -#endif - - /* ASSERT : msgh_local_port == fake_server */ - - if (notify_server (&syscall_in.header, &syscall_out.header)) - error ("received a notify while intercepting syscalls"); - - if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID) - { - xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter); - if (exec_counter == 1) - { - original_exec_reply = syscall_in.header.msgh_remote_port; - syscall_in.header.msgh_remote_port = exec_reply_send; - } - - if (!terminal_initted) - { - /* Now that the child has exec'd we know it has already set its - process group. On POSIX systems, tcsetpgrp will fail with - EPERM if we try it before the child's setpgid. */ - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - terminal_initted = 1; - } - - exec_counter--; - } - - syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port; - syscall_in.header.msgh_remote_port = original_server_send; - - reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_COPY_SEND); - - ret = mach_msg_send (&syscall_in.header); - CHK ("Forwarded syscall", ret); - } - - ret = mach_port_move_member (mach_task_self (), - fake_server, - MACH_PORT_NULL); - CHK ("Moving fake syscall out of inferior_wait_port_set", ret); - - ret = mach_port_move_member (mach_task_self (), - exec_reply, - inferior_wait_port_set); - CHK ("Moving exec_reply to inferior_wait_port_set", ret); - - ret = mach_msg (&syscall_in.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct syscall_msg_t), /* receive size */ - inferior_wait_port_set, /* receive_name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - CHK ("mach_msg (exec reply)", ret); - - ret = task_suspend (inferior_task); - CHK ("Suspending inferior after last exec", ret); - - must_suspend_thread = 0; - - xx_debug ("Received exec reply from bsd server, suspended inferior task\n"); - -#ifdef DUMP_SYSCALL - print_msg (&syscall_in.header); -#endif - - /* Message should appear as if it came from the unix server */ - syscall_in.header.msgh_local_port = MACH_PORT_NULL; - - /* and go to the inferior task original reply port */ - syscall_in.header.msgh_remote_port = original_exec_reply; - - reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE); - - ret = mach_msg_send (&syscall_in.header); - CHK ("Forwarding exec reply to inferior", ret); - - /* Garbage collect */ - ret = mach_port_deallocate (inferior_task, - original_server_port_name); - CHK ("deallocating fake server send right", ret); - - ret = mach_port_insert_right (inferior_task, - original_server_port_name, - original_server_send, - MACH_MSG_TYPE_MOVE_SEND); - CHK ("Restoring the original bsd server send right", ret); - - ret = mach_port_destroy (mach_task_self (), - fake_server); - fake_server = MACH_PORT_DEAD; - CHK ("mach_port_destroy (fake_server)", ret); - - ret = mach_port_destroy (mach_task_self (), - exec_reply); - exec_reply = MACH_PORT_DEAD; - CHK ("mach_port_destroy (exec_reply)", ret); - - xx_debug ("Done with exec call interception\n"); -} - -void -consume_send_rights (thread_array_t thread_list, int thread_count) -{ - int index; - - if (!thread_count) - return; - - for (index = 0; index < thread_count; index++) - { - /* Since thread kill command kills threads, don't check ret */ - (void) mach_port_deallocate (mach_task_self (), - thread_list[index]); - } -} - -/* suspend/abort/resume a thread. */ -setup_thread (mach_port_t thread, int what) -{ - kern_return_t ret; - - if (what) - { - ret = thread_suspend (thread); - CHK ("setup_thread thread_suspend", ret); - - ret = thread_abort (thread); - CHK ("setup_thread thread_abort", ret); - } - else - { - ret = thread_resume (thread); - CHK ("setup_thread thread_resume", ret); - } -} - -int -map_slot_to_mid (int slot, thread_array_t threads, int thread_count) -{ - kern_return_t ret; - int deallocate = 0; - int index; - int mid; - - if (!threads) - { - deallocate++; - ret = task_threads (inferior_task, &threads, &thread_count); - CHK ("Can not select a thread from a dead task", ret); - } - - if (slot < 0 || slot >= thread_count) - { - if (deallocate) - { - consume_send_rights (threads, thread_count); - (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, - (thread_count * sizeof (mach_port_t))); - } - if (slot < 0) - error ("invalid slot number"); - else - return -(slot + 1); - } - - mid = map_port_name_to_mid (threads[slot], MACH_TYPE_THREAD); - - if (deallocate) - { - consume_send_rights (threads, thread_count); - (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, - (thread_count * sizeof (mach_port_t))); - } - - return mid; -} - -static int -parse_thread_id (char *arg, int thread_count, int slots) -{ - kern_return_t ret; - int mid; - int slot; - int index; - - if (arg == 0) - return 0; - - while (*arg && (*arg == ' ' || *arg == '\t')) - arg++; - - if (!*arg) - return 0; - - /* Currently parse MID and @SLOTNUMBER */ - if (*arg != '@') - { - mid = atoi (arg); - if (mid <= 0) - error ("valid thread mid expected"); - return mid; - } - - arg++; - slot = atoi (arg); - - if (slot < 0) - error ("invalid slot number"); - - /* If you want slot numbers to remain slot numbers, set slots. - - * Well, since 0 is reserved, return the ordinal number - * of the thread rather than the slot number. Awk, this - * counts as a kludge. - */ - if (slots) - return -(slot + 1); - - if (thread_count && slot >= thread_count) - return -(slot + 1); - - mid = map_slot_to_mid (slot); - - return mid; -} - -/* THREAD_ID 0 is special; it selects the first kernel - * thread from the list (i.e. SLOTNUMBER 0) - * This is used when starting the program with 'run' or when attaching. - * - * If FLAG is 0 the context is not changed, and the registers, frame, etc - * will continue to describe the old thread. - * - * If FLAG is nonzero, really select the thread. - * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid. - * - */ -kern_return_t -select_thread (mach_port_t task, int thread_id, int flag) -{ - thread_array_t thread_list; - int thread_count; - kern_return_t ret; - int index; - thread_t new_thread = MACH_PORT_NULL; - - if (thread_id < 0) - error ("Can't select cprocs without kernel thread"); - - ret = task_threads (task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("Can not select a thread from a dead task"); - m3_kill_inferior (); - return KERN_FAILURE; - } - - if (thread_count == 0) - { - /* The task can not do anything anymore, but it still - * exists as a container for memory and ports. - */ - registers_changed (); - warning ("Task %d has no threads", - map_port_name_to_mid (task, MACH_TYPE_TASK)); - current_thread = MACH_PORT_NULL; - (void) vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (mach_port_t))); - return KERN_FAILURE; - } - - if (!thread_id || flag == 2) - { - /* First thread or a slotnumber */ - if (!thread_id) - new_thread = thread_list[0]; - else - { - if (thread_id < thread_count) - new_thread = thread_list[thread_id]; - else - { - (void) vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (mach_port_t))); - error ("No such thread slot number : %d", thread_id); - } - } - } - else - { - for (index = 0; index < thread_count; index++) - if (thread_id == map_port_name_to_mid (thread_list[index], - MACH_TYPE_THREAD)) - { - new_thread = thread_list[index]; - index = -1; - break; - } - - if (index != -1) - error ("No thread with mid %d", thread_id); - } - - /* Notify when the selected thread dies */ - request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD); - - ret = vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (mach_port_t))); - CHK ("vm_deallocate", ret); - - if (!flag) - current_thread = new_thread; - else - { -#if 0 - if (MACH_PORT_VALID (current_thread)) - { - /* Store the gdb's view of the thread we are deselecting - - * @@ I think gdb updates registers immediately when they are - * changed, so don't do this. - */ - ret = thread_abort (current_thread); - CHK ("Could not abort system calls when saving state of old thread", - ret); - target_prepare_to_store (); - target_store_registers (-1); - } -#endif - - registers_changed (); - - current_thread = new_thread; - - ret = thread_abort (current_thread); - CHK ("Could not abort system calls when selecting a thread", ret); - - stop_pc = read_pc (); - flush_cached_frames (); - - select_frame (get_current_frame ()); - } - - return KERN_SUCCESS; -} - -/* - * Switch to use thread named NEW_THREAD. - * Return it's MID - */ -int -switch_to_thread (thread_t new_thread) -{ - thread_t saved_thread = current_thread; - int mid; - - mid = map_port_name_to_mid (new_thread, - MACH_TYPE_THREAD); - if (mid == -1) - warning ("Can't map thread name 0x%x to mid", new_thread); - else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - error ("Could not select thread %d", mid); - } - - return mid; -} - -/* Do this in gdb after doing FORK but before STARTUP_INFERIOR. - * Note that the registers are not yet valid in the inferior task. - */ -static int -m3_trace_him (int pid) -{ - kern_return_t ret; - - push_target (&m3_ops); - - inferior_task = task_by_pid (pid); - - if (!MACH_PORT_VALID (inferior_task)) - error ("Can not map Unix pid %d to Mach task", pid); - - /* Clean up previous notifications and create new ones */ - setup_notify_port (1); - - /* When notification appears, the inferior task has died */ - request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); - - emulator_present = have_emulator_p (inferior_task); - - /* By default, select the first thread, - * If task has no threads, gives a warning - * Does not fetch registers, since they are not yet valid. - */ - select_thread (inferior_task, 0, 0); - - inferior_exception_port = MACH_PORT_NULL; - - setup_exception_port (); - - xx_debug ("Now the debugged task is created\n"); - - /* One trap to exec the shell, one to exec the program being debugged. */ - intercept_exec_calls (2); - - return pid; -} - -setup_exception_port (void) -{ - kern_return_t ret; - - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &inferior_exception_port); - CHK ("mach_port_allocate", ret); - - /* add send right */ - ret = mach_port_insert_right (mach_task_self (), - inferior_exception_port, - inferior_exception_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("mach_port_insert_right", ret); - - ret = mach_port_move_member (mach_task_self (), - inferior_exception_port, - inferior_wait_port_set); - CHK ("mach_port_move_member", ret); - - ret = task_get_special_port (inferior_task, - TASK_EXCEPTION_PORT, - &inferior_old_exception_port); - CHK ("task_get_special_port(old exc)", ret); - - ret = task_set_special_port (inferior_task, - TASK_EXCEPTION_PORT, - inferior_exception_port); - CHK ("task_set_special_port", ret); - - ret = mach_port_deallocate (mach_task_self (), - inferior_exception_port); - CHK ("mack_port_deallocate", ret); - -#if 0 - /* When notify appears, the inferior_task's exception - * port has been destroyed. - * - * Not used, since the dead_name_notification already - * appears when task dies. - * - */ - request_notify (inferior_exception_port, - MACH_NOTIFY_NO_SENDERS, - MACH_TYPE_EXCEPTION_PORT); -#endif -} - -/* Nonzero if gdb is waiting for a message */ -int mach_really_waiting; - -/* Wait for the inferior to stop for some reason. - - Loop on notifications until inferior_task dies. - - Loop on exceptions until stopped_in_exception comes true. - (e.g. we receive a single step trace trap) - - a message arrives to gdb's message port - - There is no other way to exit this loop. - - Returns the inferior_ptid for rest of gdb. - Side effects: Set *OURSTATUS. */ -ptid_t -mach_really_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -{ - kern_return_t ret; - int w; - - struct msg - { - mach_msg_header_t header; - mach_msg_type_t foo; - int data[8000]; - } - in_msg, out_msg; - - /* Either notify (death), exception or message can stop the inferior */ - stopped_in_exception = FALSE; - - while (1) - { - QUIT; - - stop_exception = stop_code = stop_subcode = -1; - stop_thread = MACH_PORT_NULL; - - mach_really_waiting = 1; - ret = mach_msg (&in_msg.header, /* header */ - MACH_RCV_MSG, /* options */ - 0, /* send size */ - sizeof (struct msg), /* receive size */ - currently_waiting_for, /* receive name */ - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); - mach_really_waiting = 0; - CHK ("mach_msg (receive)", ret); - - /* Check if we received a notify of the childs' death */ - if (notify_server (&in_msg.header, &out_msg.header)) - { - /* If inferior_task is null then the inferior has - gone away and we want to return to command level. - Otherwise it was just an informative message and we - need to look to see if there are any more. */ - if (inferior_task != MACH_PORT_NULL) - continue; - else - { - /* Collect Unix exit status for gdb */ - - wait3 (&w, WNOHANG, 0); - - /* This mess is here to check that the rest of - * gdb knows that the inferior died. It also - * tries to hack around the fact that Mach 3.0 (mk69) - * unix server (ux28) does not always know what - * has happened to it's children when mach-magic - * is applied on them. - */ - if ((!WIFEXITED (w) && WIFSTOPPED (w)) || - (WIFEXITED (w) && WEXITSTATUS (w) > 0377)) - { - WSETEXIT (w, 0); - warning ("Using exit value 0 for terminated task"); - } - else if (!WIFEXITED (w)) - { - int sig = WTERMSIG (w); - - /* Signals cause problems. Warn the user. */ - if (sig != SIGKILL) /* Bad luck if garbage matches this */ - warning ("The terminating signal stuff may be nonsense"); - else if (sig > NSIG) - { - WSETEXIT (w, 0); - warning ("Using exit value 0 for terminated task"); - } - } - store_waitstatus (ourstatus, w); - return inferior_ptid; - } - } - - /* Hmm. Check for exception, as it was not a notification. - exc_server() does an upcall to catch_exception_raise() - if this rpc is an exception. Further actions are decided - there. - */ - if (!exc_server (&in_msg.header, &out_msg.header)) - { - - /* Not an exception, check for message. - - * Messages don't come from the inferior, or if they - * do they better be asynchronous or it will hang. - */ - if (gdb_message_server (&in_msg.header)) - continue; - - error ("Unrecognized message received in mach_really_wait"); - } - - /* Send the reply of the exception rpc to the suspended task */ - ret = mach_msg_send (&out_msg.header); - CHK ("mach_msg_send (exc reply)", ret); - - if (stopped_in_exception) - { - /* Get unix state. May be changed in mach3_exception_actions() */ - wait3 (&w, WNOHANG, 0); - - mach3_exception_actions (&w, FALSE, "Task"); - - store_waitstatus (ourstatus, w); - return inferior_ptid; - } - } -} - -/* Called by macro DO_QUIT() in utils.c(quit). - * This is called just before calling error() to return to command level - */ -void -mach3_quit (void) -{ - int mid; - kern_return_t ret; - - if (mach_really_waiting) - { - ret = task_suspend (inferior_task); - - if (ret != KERN_SUCCESS) - { - warning ("Could not suspend task for interrupt: %s", - mach_error_string (ret)); - mach_really_waiting = 0; - return; - } - } - - must_suspend_thread = 0; - mach_really_waiting = 0; - - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - if (mid == -1) - { - warning ("Selecting first existing kernel thread"); - mid = 0; - } - - current_thread = MACH_PORT_NULL; /* Force setup */ - select_thread (inferior_task, mid, 1); - - return; -} - -#if 0 -/* bogus bogus bogus. It is NOT OK to quit out of target_wait. */ - -/* If ^C is typed when we are waiting for a message - * and your Unix server is able to notice that we - * should quit now. - * - * Called by REQUEST_QUIT() from utils.c(request_quit) - */ -void -mach3_request_quit (void) -{ - if (mach_really_waiting) - immediate_quit = 1; -} -#endif - -/* - * Gdb message server. - * Currently implemented is the STOP message, that causes - * gdb to return to the command level like ^C had been typed from terminal. - */ -int -gdb_message_server (mach_msg_header_t *InP) -{ - kern_return_t ret; - int mid; - - if (InP->msgh_local_port == our_message_port) - { - /* A message coming to our_message_port. Check validity */ - switch (InP->msgh_id) - { - - case GDB_MESSAGE_ID_STOP: - ret = task_suspend (inferior_task); - if (ret != KERN_SUCCESS) - warning ("Could not suspend task for stop message: %s", - mach_error_string (ret)); - - /* QUIT in mach_really_wait() loop. */ - request_quit (0); - break; - - default: - warning ("Invalid message id %d received, ignored.", - InP->msgh_id); - break; - } - - return 1; - } - - /* Message not handled by this server */ - return 0; -} - -/* NOTE: This is not an RPC call. It is a simpleroutine. - - * This is not called from this gdb code. - * - * It may be called by another debugger to cause this - * debugger to enter command level: - * - * (gdb) set stop_inferior_gdb () - * (gdb) continue - * - * External program "stop-gdb" implements this also. - */ -void -stop_inferior_gdb (void) -{ - kern_return_t ret; - - /* Code generated by mig, with minor cleanups :-) - - * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t); - */ - - typedef struct - { - mach_msg_header_t Head; - } - Request; - - Request Mess; - - register Request *InP = &Mess; - - InP->Head.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0); - - /* msgh_size passed as argument */ - InP->Head.msgh_remote_port = our_message_port; - InP->Head.msgh_local_port = MACH_PORT_NULL; - InP->Head.msgh_seqno = 0; - InP->Head.msgh_id = GDB_MESSAGE_ID_STOP; - - ret = mach_msg (&InP->Head, - MACH_SEND_MSG | MACH_MSG_OPTION_NONE, - sizeof (Request), - 0, - MACH_PORT_NULL, - MACH_MSG_TIMEOUT_NONE, - MACH_PORT_NULL); -} - -#ifdef THREAD_ALLOWED_TO_BREAK -/* - * Return 1 if the MID specifies the thread that caused the - * last exception. - * Since catch_exception_raise() selects the thread causing - * the last exception to current_thread, we just check that - * it is selected and the last exception was a breakpoint. - */ -int -mach_thread_for_breakpoint (int mid) -{ - int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - - if (mid < 0) - { - mid = map_slot_to_mid (-(mid + 1), 0, 0); - if (mid < 0) - return 0; /* Don't stop, no such slot */ - } - - if (!mid || cmid == -1) - return 1; /* stop */ - - return cmid == mid && stop_exception == EXC_BREAKPOINT; -} -#endif /* THREAD_ALLOWED_TO_BREAK */ - -#ifdef THREAD_PARSE_ID -/* - * Map a thread id string (MID or a @SLOTNUMBER) - * to a thread-id. - * - * 0 matches all threads. - * Otherwise the meaning is defined only in this file. - * (mach_thread_for_breakpoint uses it) - * - * @@ This allows non-existent MIDs to be specified. - * It now also allows non-existent slots to be - * specified. (Slot numbers stored are negative, - * and the magnitude is one greater than the actual - * slot index. (Since 0 is reserved)) - */ -int -mach_thread_parse_id (char *arg) -{ - int mid; - if (arg == 0) - error ("thread id expected"); - mid = parse_thread_id (arg, 0, 1); - - return mid; -} -#endif /* THREAD_PARSE_ID */ - -#ifdef THREAD_OUTPUT_ID -char * -mach_thread_output_id (int mid) -{ - static char foobar[20]; - - if (mid > 0) - sprintf (foobar, "mid %d", mid); - else if (mid < 0) - sprintf (foobar, "@%d", -(mid + 1)); - else - sprintf (foobar, "*any thread*"); - - return foobar; -} -#endif /* THREAD_OUTPUT_ID */ - -/* Called with hook PREPARE_TO_PROCEED() from infrun.c. - - * If we have switched threads and stopped at breakpoint return 1 otherwise 0. - * - * if SELECT_IT is nonzero, reselect the thread that was active when - * we stopped at a breakpoint. - * - * Note that this implementation is potentially redundant now that - * default_prepare_to_proceed() has been added. - * - * FIXME This may not support switching threads after Ctrl-C - * correctly. The default implementation does support this. - */ - -mach3_prepare_to_proceed (int select_it) -{ - if (stop_thread && - stop_thread != current_thread && - stop_exception == EXC_BREAKPOINT) - { - int mid; - - if (!select_it) - return 1; - - mid = switch_to_thread (stop_thread); - - return 1; - } - - return 0; -} - -/* this stuff here is an upcall via libmach/excServer.c - and mach_really_wait which does the actual upcall. - - The code will pass the exception to the inferior if: - - - The task that signaled is not the inferior task - (e.g. when debugging another debugger) - - - The user has explicitely requested to pass on the exceptions. - (e.g to the default unix exception handler, which maps - exceptions to signals, or the user has her own exception handler) - - - If the thread that signaled is being single-stepped and it - has set it's own exception port and the exception is not - EXC_BREAKPOINT. (Maybe this is not desirable?) - */ - -kern_return_t -catch_exception_raise (mach_port_t port, thread_t thread, task_t task, - int exception, int code, int subcode) -{ - kern_return_t ret; - boolean_t signal_thread; - int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD); - - if (!MACH_PORT_VALID (thread)) - { - /* If the exception was sent and thread dies before we - receive it, THREAD will be MACH_PORT_DEAD - */ - - current_thread = thread = MACH_PORT_NULL; - error ("Received exception from nonexistent thread"); - } - - /* Check if the task died in transit. - * @@ Isn't the thread also invalid in such case? - */ - if (!MACH_PORT_VALID (task)) - { - current_thread = thread = MACH_PORT_NULL; - error ("Received exception from nonexistent task"); - } - - if (exception < 0 || exception > MAX_EXCEPTION) - internal_error (__FILE__, __LINE__, - "catch_exception_raise: unknown exception code %d thread %d", - exception, - mid); - - if (!MACH_PORT_VALID (inferior_task)) - error ("got an exception, but inferior_task is null or dead"); - - stop_exception = exception; - stop_code = code; - stop_subcode = subcode; - stop_thread = thread; - - signal_thread = exception != EXC_BREAKPOINT && - port == singlestepped_thread_port && - MACH_PORT_VALID (thread_saved_exception_port); - - /* If it was not our inferior or if we want to forward - * the exception to the inferior's handler, do it here - * - * Note: If you have forwarded EXC_BREAKPOINT I trust you know why. - */ - if (task != inferior_task || - signal_thread || - exception_map[exception].forward) - { - mach_port_t eport = inferior_old_exception_port; - - if (signal_thread) - { - /* - GDB now forwards the exeption to thread's original handler, - since the user propably knows what he is doing. - Give a message, though. - */ - - mach3_exception_actions ((WAITTYPE *) NULL, TRUE, "Thread"); - eport = thread_saved_exception_port; - } - - /* Send the exception to the original handler */ - ret = exception_raise (eport, - thread, - task, - exception, - code, - subcode); - - (void) mach_port_deallocate (mach_task_self (), task); - (void) mach_port_deallocate (mach_task_self (), thread); - - /* If we come here, we don't want to trace any more, since we - * will never stop for tracing anyway. - */ - discard_single_step (thread); - - /* Do not stop the inferior */ - return ret; - } - - /* Now gdb handles the exception */ - stopped_in_exception = TRUE; - - ret = task_suspend (task); - CHK ("Error suspending inferior after exception", ret); - - must_suspend_thread = 0; - - if (current_thread != thread) - { - if (MACH_PORT_VALID (singlestepped_thread_port)) - /* Cleanup discards single stepping */ - error ("Exception from thread %d while singlestepping thread %d", - mid, - map_port_name_to_mid (current_thread, MACH_TYPE_THREAD)); - - /* Then select the thread that caused the exception */ - if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - error ("Could not select thread %d causing exception", mid); - else - warning ("Gdb selected thread %d", mid); - } - - /* If we receive an exception that is not breakpoint - * exception, we interrupt the single step and return to - * debugger. Trace condition is cleared. - */ - if (MACH_PORT_VALID (singlestepped_thread_port)) - { - if (stop_exception != EXC_BREAKPOINT) - warning ("Single step interrupted by exception"); - else if (port == singlestepped_thread_port) - { - /* Single step exception occurred, remove trace bit - * and return to gdb. - */ - if (!MACH_PORT_VALID (current_thread)) - error ("Single stepped thread is not valid"); - - /* Resume threads, but leave the task suspended */ - resume_all_threads (0); - } - else - warning ("Breakpoint while single stepping?"); - - discard_single_step (current_thread); - } - - (void) mach_port_deallocate (mach_task_self (), task); - (void) mach_port_deallocate (mach_task_self (), thread); - - return KERN_SUCCESS; -} - -int -port_valid (mach_port_t port, int mask) -{ - kern_return_t ret; - mach_port_type_t type; - - ret = mach_port_type (mach_task_self (), - port, - &type); - if (ret != KERN_SUCCESS || (type & mask) != mask) - return 0; - return 1; -} - -/* @@ No vm read cache implemented yet */ -boolean_t vm_read_cache_valid = FALSE; - -/* - * Read inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - * - * Return 0 on failure; number of bytes read otherwise. - */ -int -mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length) -{ - kern_return_t ret; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr + length) - low_address; - pointer_t copied_memory; - int copy_count; - - /* Get memory from inferior with page aligned addresses */ - ret = vm_read (inferior_task, - low_address, - aligned_length, - &copied_memory, - ©_count); - if (ret != KERN_SUCCESS) - { - /* the problem is that the inferior might be killed for whatever reason - * before we go to mach_really_wait. This is one place that ought to - * catch many of those errors. - * @@ A better fix would be to make all external events to GDB - * to arrive via a SINGLE port set. (Including user input!) - */ - - if (!port_valid (inferior_task, MACH_PORT_TYPE_SEND)) - { - m3_kill_inferior (); - error ("Inferior killed (task port invalid)"); - } - else - { -#ifdef OSF - extern int errno; - /* valprint.c gives nicer format if this does not - screw it. Eamonn seems to like this, so I enable - it if OSF is defined... - */ - warning ("[read inferior %x failed: %s]", - addr, mach_error_string (ret)); - errno = 0; -#endif - return 0; - } - } - - memcpy (myaddr, (char *) addr - low_address + copied_memory, length); - - ret = vm_deallocate (mach_task_self (), - copied_memory, - copy_count); - CHK ("mach3_read_inferior vm_deallocate failed", ret); - - return length; -} - -#define CHK_GOTO_OUT(str,ret) \ - do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0) - -struct vm_region_list -{ - struct vm_region_list *next; - vm_prot_t protection; - vm_address_t start; - vm_size_t length; -}; - -struct obstack region_obstack; - -/* - * Write inferior task's LEN bytes from ADDR and copy it to MYADDR - * in gdb's address space. - */ -int -mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length) -{ - kern_return_t ret; - vm_address_t low_address = (vm_address_t) trunc_page (addr); - vm_size_t aligned_length = - (vm_size_t) round_page (addr + length) - low_address; - pointer_t copied_memory; - int copy_count; - int deallocate = 0; - - char *errstr = "Bug in mach3_write_inferior"; - - struct vm_region_list *region_element; - struct vm_region_list *region_head = (struct vm_region_list *) NULL; - - /* Get memory from inferior with page aligned addresses */ - ret = vm_read (inferior_task, - low_address, - aligned_length, - &copied_memory, - ©_count); - CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret); - - deallocate++; - - memcpy ((char *) addr - low_address + copied_memory, myaddr, length); - - obstack_init (®ion_obstack); - - /* Do writes atomically. - * First check for holes and unwritable memory. - */ - { - vm_size_t remaining_length = aligned_length; - vm_address_t region_address = low_address; - - struct vm_region_list *scan; - - while (region_address < low_address + aligned_length) - { - vm_prot_t protection; - vm_prot_t max_protection; - vm_inherit_t inheritance; - boolean_t shared; - mach_port_t object_name; - vm_offset_t offset; - vm_size_t region_length = remaining_length; - vm_address_t old_address = region_address; - - ret = vm_region (inferior_task, - ®ion_address, - ®ion_length, - &protection, - &max_protection, - &inheritance, - &shared, - &object_name, - &offset); - CHK_GOTO_OUT ("vm_region failed", ret); - - /* Check for holes in memory */ - if (old_address != region_address) - { - warning ("No memory at 0x%x. Nothing written", - old_address); - ret = KERN_SUCCESS; - length = 0; - goto out; - } - - if (!(max_protection & VM_PROT_WRITE)) - { - warning ("Memory at address 0x%x is unwritable. Nothing written", - old_address); - ret = KERN_SUCCESS; - length = 0; - goto out; - } - - /* Chain the regions for later use */ - region_element = - (struct vm_region_list *) - obstack_alloc (®ion_obstack, sizeof (struct vm_region_list)); - - region_element->protection = protection; - region_element->start = region_address; - region_element->length = region_length; - - /* Chain the regions along with protections */ - region_element->next = region_head; - region_head = region_element; - - region_address += region_length; - remaining_length = remaining_length - region_length; - } - - /* If things fail after this, we give up. - * Somebody is messing up inferior_task's mappings. - */ - - /* Enable writes to the chained vm regions */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - ret = vm_protect (inferior_task, - scan->start, - scan->length, - FALSE, - scan->protection | VM_PROT_WRITE); - CHK_GOTO_OUT ("vm_protect: enable write failed", ret); - } - } - - ret = vm_write (inferior_task, - low_address, - copied_memory, - aligned_length); - CHK_GOTO_OUT ("vm_write failed", ret); - - /* Set up the original region protections, if they were changed */ - for (scan = region_head; scan; scan = scan->next) - { - boolean_t protection_changed = FALSE; - - if (!(scan->protection & VM_PROT_WRITE)) - { - ret = vm_protect (inferior_task, - scan->start, - scan->length, - FALSE, - scan->protection); - CHK_GOTO_OUT ("vm_protect: enable write failed", ret); - } - } - } - -out: - if (deallocate) - { - obstack_free (®ion_obstack, 0); - - (void) vm_deallocate (mach_task_self (), - copied_memory, - copy_count); - } - - if (ret != KERN_SUCCESS) - { - warning ("%s %s", errstr, mach_error_string (ret)); - return 0; - } - - return length; -} - -/* Return 0 on failure, number of bytes handled otherwise. TARGET is - ignored. */ -static int -m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct target_ops *target) -{ - int result; - - if (write) - result = mach3_write_inferior (memaddr, myaddr, len); - else - result = mach3_read_inferior (memaddr, myaddr, len); - - return result; -} - - -static char * -translate_state (int state) -{ - switch (state) - { - case TH_STATE_RUNNING: - return ("R"); - case TH_STATE_STOPPED: - return ("S"); - case TH_STATE_WAITING: - return ("W"); - case TH_STATE_UNINTERRUPTIBLE: - return ("U"); - case TH_STATE_HALTED: - return ("H"); - default: - return ("?"); - } -} - -static char * -translate_cstate (int state) -{ - switch (state) - { - case CPROC_RUNNING: - return "R"; - case CPROC_SWITCHING: - return "S"; - case CPROC_BLOCKED: - return "B"; - case CPROC_CONDWAIT: - return "C"; - case CPROC_CONDWAIT | CPROC_SWITCHING: - return "CS"; - default: - return "?"; - } -} - -/* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */ - -mach_port_t /* no mach_port_name_t found in include files. */ -map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type) -{ - kern_return_t ret; - mach_msg_type_name_t acquired; - mach_port_t iport; - - ret = mach_port_extract_right (inferior_task, - inferior_name, - type, - &iport, - &acquired); - CHK ("mach_port_extract_right (map_inferior_port_name)", ret); - - if (acquired != MACH_MSG_TYPE_PORT_SEND) - error ("Incorrect right extracted, (map_inferior_port_name)"); - - ret = mach_port_deallocate (mach_task_self (), - iport); - CHK ("Deallocating mapped port (map_inferior_port_name)", ret); - - return iport; -} - -/* - * Naming convention: - * Always return user defined name if found. - * _K == A kernel thread with no matching CPROC - * _C == A cproc with no current cthread - * _t == A cthread with no user defined name - * - * The digits that follow the _names are the SLOT number of the - * kernel thread if there is such a thing, otherwise just a negation - * of the sequential number of such cprocs. - */ - -static char buf[7]; - -static char * -get_thread_name (gdb_thread_t one_cproc, int id) -{ - if (one_cproc) - if (one_cproc->cthread == NULL) - { - /* cproc not mapped to any cthread */ - sprintf (buf, "_C%d", id); - } - else if (!one_cproc->cthread->name) - { - /* cproc and cthread, but no name */ - sprintf (buf, "_t%d", id); - } - else - return (char *) (one_cproc->cthread->name); - else - { - if (id < 0) - warning ("Inconsistency in thread name id %d", id); - - /* Kernel thread without cproc */ - sprintf (buf, "_K%d", id); - } - - return buf; -} - -int -fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out) -{ - kern_return_t ret; - thread_array_t th_table; - int th_count; - gdb_thread_t mthreads = NULL; - int index; - - ret = task_threads (task, &th_table, &th_count); - if (ret != KERN_SUCCESS) - { - warning ("Error getting inferior's thread list:%s", - mach_error_string (ret)); - m3_kill_inferior (); - return -1; - } - - mthreads = (gdb_thread_t) - obstack_alloc - (cproc_obstack, - th_count * sizeof (struct gdb_thread)); - - for (index = 0; index < th_count; index++) - { - thread_t saved_thread = MACH_PORT_NULL; - int mid; - - if (must_suspend_thread) - setup_thread (th_table[index], 1); - - if (th_table[index] != current_thread) - { - saved_thread = current_thread; - - mid = switch_to_thread (th_table[index]); - } - - mthreads[index].name = th_table[index]; - mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */ - mthreads[index].in_emulator = FALSE; - mthreads[index].slotid = index; - - mthreads[index].sp = read_register (SP_REGNUM); - mthreads[index].fp = read_register (FP_REGNUM); - mthreads[index].pc = read_pc (); - - if (MACH_PORT_VALID (saved_thread)) - mid = switch_to_thread (saved_thread); - - if (must_suspend_thread) - setup_thread (th_table[index], 0); - } - - consume_send_rights (th_table, th_count); - ret = vm_deallocate (mach_task_self (), (vm_address_t) th_table, - (th_count * sizeof (mach_port_t))); - if (ret != KERN_SUCCESS) - { - warning ("Error trying to deallocate thread list : %s", - mach_error_string (ret)); - } - - *mthreads_out = mthreads; - - return th_count; -} - - -/* - * Current emulator always saves the USP on top of - * emulator stack below struct emul_stack_top stuff. - */ -CORE_ADDR -fetch_usp_from_emulator_stack (CORE_ADDR sp) -{ - CORE_ADDR stack_pointer; - - sp = (sp & ~(EMULATOR_STACK_SIZE - 1)) + - EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top); - - if (mach3_read_inferior (sp, - &stack_pointer, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read user sp from emulator stack address 0x%x", sp); - return 0; - } - - return stack_pointer; -} - -#ifdef MK67 - -/* get_emulation_vector() interface was changed after mk67 */ -#define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */ - -#endif /* MK67 */ - -/* Check if the emulator exists at task's address space. - */ -boolean_t -have_emulator_p (task_t task) -{ - kern_return_t ret; -#ifndef EMUL_VECTOR_COUNT - vm_offset_t *emulation_vector; - int n; -#else - vm_offset_t emulation_vector[EMUL_VECTOR_COUNT]; - int n = EMUL_VECTOR_COUNT; -#endif - int i; - int vector_start; - - ret = task_get_emulation_vector (task, - &vector_start, -#ifndef EMUL_VECTOR_COUNT - &emulation_vector, -#else - emulation_vector, -#endif - &n); - CHK ("task_get_emulation_vector", ret); - xx_debug ("%d vectors from %d at 0x%08x\n", - n, vector_start, emulation_vector); - - for (i = 0; i < n; i++) - { - vm_offset_t entry = emulation_vector[i]; - - if (EMULATOR_BASE <= entry && entry <= EMULATOR_END) - return TRUE; - else if (entry) - { - static boolean_t informed = FALSE; - if (!informed) - { - warning ("Emulation vector address 0x08%x outside emulator space", - entry); - informed = TRUE; - } - } - } - return FALSE; -} - -/* Map cprocs to kernel threads and vice versa. */ - -void -map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads, - int thread_count) -{ - int index; - gdb_thread_t scan; - boolean_t all_mapped = TRUE; - LONGEST stack_base; - LONGEST stack_size; - - for (scan = cprocs; scan; scan = scan->next) - { - /* Default to: no kernel thread for this cproc */ - scan->reverse_map = -1; - - /* Check if the cproc is found by its stack */ - for (index = 0; index < thread_count; index++) - { - stack_base = - extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET, - CPROC_BASE_SIZE); - stack_size = - extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET, - CPROC_SIZE_SIZE); - if ((mthreads + index)->sp > stack_base && - (mthreads + index)->sp <= stack_base + stack_size) - { - (mthreads + index)->cproc = scan; - scan->reverse_map = index; - break; - } - } - all_mapped &= (scan->reverse_map != -1); - } - - /* Check for threads that are currently in the emulator. - * If so, they have a different stack, and the still unmapped - * cprocs may well get mapped to these threads. - * - * If: - * - cproc stack does not match any kernel thread stack pointer - * - there is at least one extra kernel thread - * that has no cproc mapped above. - * - some kernel thread stack pointer points to emulator space - * then we find the user stack pointer saved in the emulator - * stack, and try to map that to the cprocs. - * - * Also set in_emulator for kernel threads. - */ - - if (emulator_present) - { - for (index = 0; index < thread_count; index++) - { - CORE_ADDR emul_sp; - CORE_ADDR usp; - - gdb_thread_t mthread = (mthreads + index); - emul_sp = mthread->sp; - - if (mthread->cproc == NULL && - EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END) - { - mthread->in_emulator = emulator_present; - - if (!all_mapped && cprocs) - { - usp = fetch_usp_from_emulator_stack (emul_sp); - - /* @@ Could be more accurate */ - if (!usp) - error ("Zero stack pointer read from emulator?"); - - /* Try to match this stack pointer to the cprocs that - * don't yet have a kernel thread. - */ - for (scan = cprocs; scan; scan = scan->next) - { - - /* Check is this unmapped CPROC stack contains - * the user stack pointer saved in the - * emulator. - */ - if (scan->reverse_map == -1) - { - stack_base = - extract_signed_integer - (scan->raw_cproc + CPROC_BASE_OFFSET, - CPROC_BASE_SIZE); - stack_size = - extract_signed_integer - (scan->raw_cproc + CPROC_SIZE_OFFSET, - CPROC_SIZE_SIZE); - if (usp > stack_base && - usp <= stack_base + stack_size) - { - mthread->cproc = scan; - scan->reverse_map = index; - break; - } - } - } - } - } - } - } -} - -/* - * Format of the thread_list command - * - * slot mid sel name emul ks susp cstate wired address - */ -#define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s " - -#define TL_HEADER "\n@ MID Name KState CState Where\n" - -void -print_tl_address (struct ui_file *stream, CORE_ADDR pc) -{ - if (!lookup_minimal_symbol_by_pc (pc)) - fprintf_filtered (stream, local_hex_format (), pc); - else - { - extern int addressprint; - extern int asm_demangle; - - int store = addressprint; - addressprint = 0; - print_address_symbolic (pc, stream, asm_demangle, ""); - addressprint = store; - } -} - -/* For thread names, but also for gdb_message_port external name */ -#define MAX_NAME_LEN 50 - -/* Returns the address of variable NAME or 0 if not found */ -CORE_ADDR -lookup_address_of_variable (char *name) -{ - struct symbol *sym; - CORE_ADDR symaddr = 0; - struct minimal_symbol *msymbol; - - sym = lookup_symbol (name, - (struct block *) NULL, - VAR_NAMESPACE, - (int *) NULL, - (struct symtab **) NULL); - - if (sym) - symaddr = SYMBOL_VALUE (sym); - - if (!symaddr) - { - msymbol = lookup_minimal_symbol (name, NULL, NULL); - - if (msymbol && msymbol->type == mst_data) - symaddr = SYMBOL_VALUE_ADDRESS (msymbol); - } - - return symaddr; -} - -static gdb_thread_t -get_cprocs (void) -{ - gdb_thread_t cproc_head; - gdb_thread_t cproc_copy; - CORE_ADDR their_cprocs; - char *buf; - char *name; - cthread_t cthread; - CORE_ADDR symaddr; - - buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT); - symaddr = lookup_address_of_variable ("cproc_list"); - - if (!symaddr) - { - /* cproc_list is not in a file compiled with debugging - symbols, but don't give up yet */ - - symaddr = lookup_address_of_variable ("cprocs"); - - if (symaddr) - { - static int informed = 0; - if (!informed) - { - informed++; - warning ("Your program is loaded with an old threads library."); - warning ("GDB does not know the old form of threads"); - warning ("so things may not work."); - } - } - } - - /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */ - if (!symaddr) - return NULL; - - /* Get the address of the first cproc in the task */ - if (!mach3_read_inferior (symaddr, - buf, - TARGET_PTR_BIT / HOST_CHAR_BIT)) - error ("Can't read cproc master list at address (0x%x).", symaddr); - their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT); - - /* Scan the CPROCs in the task. - CPROCs are chained with LIST field, not NEXT field, which - chains mutexes, condition variables and queues */ - - cproc_head = NULL; - - while (their_cprocs != (CORE_ADDR) 0) - { - CORE_ADDR cproc_copy_incarnation; - cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack, - sizeof (struct gdb_thread)); - - if (!mach3_read_inferior (their_cprocs, - &cproc_copy->raw_cproc[0], - CPROC_SIZE)) - error ("Can't read next cproc at 0x%x.", their_cprocs); - - their_cprocs = - extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET, - CPROC_LIST_SIZE); - cproc_copy_incarnation = - extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET, - CPROC_INCARNATION_SIZE); - - if (cproc_copy_incarnation == (CORE_ADDR) 0) - cproc_copy->cthread = NULL; - else - { - /* This CPROC has an attached CTHREAD. Get its name */ - cthread = (cthread_t) obstack_alloc (cproc_obstack, - sizeof (struct cthread)); - - if (!mach3_read_inferior (cproc_copy_incarnation, - cthread, - sizeof (struct cthread))) - error ("Can't read next thread at 0x%x.", - cproc_copy_incarnation); - - cproc_copy->cthread = cthread; - - if (cthread->name) - { - name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN); - - if (!mach3_read_inferior (cthread->name, name, MAX_NAME_LEN)) - error ("Can't read next thread's name at 0x%x.", cthread->name); - - cthread->name = name; - } - } - - /* insert in front */ - cproc_copy->next = cproc_head; - cproc_head = cproc_copy; - } - return cproc_head; -} - -#ifndef FETCH_CPROC_STATE -/* - * Check if your machine does not grok the way this routine - * fetches the FP,PC and SP of a cproc that is not - * currently attached to any kernel thread (e.g. its cproc.context - * field points to the place in stack where the context - * is saved). - * - * If it doesn't, define your own routine. - */ -#define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth) - -int -mach3_cproc_state (gdb_thread_t mthread) -{ - int context; - - if (!mthread || !mthread->cproc) - return -1; - - context = extract_signed_integer - (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET, - CPROC_CONTEXT_SIZE); - if (context == 0) - return -1; - - mthread->sp = context + MACHINE_CPROC_SP_OFFSET; - - if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET, - &mthread->pc, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read cproc pc from inferior"); - return -1; - } - - if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET, - &mthread->fp, - sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) - { - warning ("Can't read cproc fp from inferior"); - return -1; - } - - return 0; -} -#endif /* FETCH_CPROC_STATE */ - - -void -thread_list_command (void) -{ - thread_basic_info_data_t ths; - int thread_count; - gdb_thread_t cprocs; - gdb_thread_t scan; - int index; - char *name; - char selected; - char *wired; - int infoCnt; - kern_return_t ret; - mach_port_t mid_or_port; - gdb_thread_t their_threads; - gdb_thread_t kthread; - - int neworder = 1; - - char *fmt = "There are %d kernel threads in task %d.\n"; - - int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - thread_count = fetch_thread_info (inferior_task, - &their_threads); - if (thread_count == -1) - return; - - if (thread_count == 1) - fmt = "There is %d kernel thread in task %d.\n"; - - printf_filtered (fmt, thread_count, tmid); - - puts_filtered (TL_HEADER); - - cprocs = get_cprocs (); - - map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count); - - for (scan = cprocs; scan; scan = scan->next) - { - int mid; - char buf[10]; - char slot[3]; - int cproc_state = - extract_signed_integer - (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE); - - selected = ' '; - - /* a wired cproc? */ - wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET, - CPROC_WIRED_SIZE) - ? "wired" : ""); - - if (scan->reverse_map != -1) - kthread = (their_threads + scan->reverse_map); - else - kthread = NULL; - - if (kthread) - { - /* These cprocs have a kernel thread */ - - mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD); - - infoCnt = THREAD_BASIC_INFO_COUNT; - - ret = thread_info (kthread->name, - THREAD_BASIC_INFO, - (thread_info_t) & ths, - &infoCnt); - - if (ret != KERN_SUCCESS) - { - warning ("Unable to get basic info on thread %d : %s", - mid, - mach_error_string (ret)); - continue; - } - - /* Who is the first to have more than 100 threads */ - sprintf (slot, "%d", kthread->slotid % 100); - - if (kthread->name == current_thread) - selected = '*'; - - if (ths.suspend_count) - sprintf (buf, "%d", ths.suspend_count); - else - buf[0] = '\000'; - -#if 0 - if (ths.flags & TH_FLAGS_SWAPPED) - strcat (buf, "S"); -#endif - - if (ths.flags & TH_FLAGS_IDLE) - strcat (buf, "I"); - - printf_filtered (TL_FORMAT, - slot, - mid, - selected, - get_thread_name (scan, kthread->slotid), - kthread->in_emulator ? "E" : "", - translate_state (ths.run_state), - buf, - translate_cstate (cproc_state), - wired); - print_tl_address (gdb_stdout, kthread->pc); - } - else - { - /* These cprocs don't have a kernel thread. - * find out the calling frame with - * FETCH_CPROC_STATE. - */ - - struct gdb_thread state; - -#if 0 - /* jtv -> emcmanus: why do you want this here? */ - if (scan->incarnation == NULL) - continue; /* EMcM */ -#endif - - printf_filtered (TL_FORMAT, - "-", - -neworder, /* Pseudo MID */ - selected, - get_thread_name (scan, -neworder), - "", - "-", /* kernel state */ - "", - translate_cstate (cproc_state), - ""); - state.cproc = scan; - - if (FETCH_CPROC_STATE (&state) == -1) - puts_filtered ("???"); - else - print_tl_address (gdb_stdout, state.pc); - - neworder++; - } - puts_filtered ("\n"); - } - - /* Scan for kernel threads without cprocs */ - for (index = 0; index < thread_count; index++) - { - if (!their_threads[index].cproc) - { - int mid; - - char buf[10]; - char slot[3]; - - mach_port_t name = their_threads[index].name; - - mid = map_port_name_to_mid (name, MACH_TYPE_THREAD); - - infoCnt = THREAD_BASIC_INFO_COUNT; - - ret = thread_info (name, - THREAD_BASIC_INFO, - (thread_info_t) & ths, - &infoCnt); - - if (ret != KERN_SUCCESS) - { - warning ("Unable to get basic info on thread %d : %s", - mid, - mach_error_string (ret)); - continue; - } - - sprintf (slot, "%d", index % 100); - - if (name == current_thread) - selected = '*'; - else - selected = ' '; - - if (ths.suspend_count) - sprintf (buf, "%d", ths.suspend_count); - else - buf[0] = '\000'; - -#if 0 - if (ths.flags & TH_FLAGS_SWAPPED) - strcat (buf, "S"); -#endif - - if (ths.flags & TH_FLAGS_IDLE) - strcat (buf, "I"); - - printf_filtered (TL_FORMAT, - slot, - mid, - selected, - get_thread_name (NULL, index), - their_threads[index].in_emulator ? "E" : "", - translate_state (ths.run_state), - buf, - "", /* No cproc state */ - ""); /* Can't be wired */ - print_tl_address (gdb_stdout, their_threads[index].pc); - puts_filtered ("\n"); - } - } - - obstack_free (cproc_obstack, 0); - obstack_init (cproc_obstack); -} - -void -thread_select_command (char *args, int from_tty) -{ - int mid; - thread_array_t thread_list; - int thread_count; - kern_return_t ret; - int is_slot = 0; - - MACH_ERROR_NO_INFERIOR; - - if (!args) - error_no_arg ("MID or @SLOTNUMBER to specify a thread to select"); - - while (*args == ' ' || *args == '\t') - args++; - - if (*args == '@') - { - is_slot++; - args++; - } - - mid = atoi (args); - - if (mid == 0) - if (!is_slot || *args != '0') /* Rudimentary checks */ - error ("You must select threads by MID or @SLOTNUMBER"); - - if (select_thread (inferior_task, mid, is_slot ? 2 : 1) != KERN_SUCCESS) - return; - - if (from_tty) - printf_filtered ("Thread %d selected\n", - is_slot ? map_port_name_to_mid (current_thread, - MACH_TYPE_THREAD) : mid); -} - -thread_trace (mach_port_t thread, boolean_t set) -{ - int flavor = TRACE_FLAVOR; - unsigned int stateCnt = TRACE_FLAVOR_SIZE; - kern_return_t ret; - thread_state_data_t state; - - if (!MACH_PORT_VALID (thread)) - { - warning ("thread_trace: invalid thread"); - return; - } - - if (must_suspend_thread) - setup_thread (thread, 1); - - ret = thread_get_state (thread, flavor, state, &stateCnt); - CHK ("thread_trace: error reading thread state", ret); - - if (set) - { - TRACE_SET (thread, state); - } - else - { - if (!TRACE_CLEAR (thread, state)) - { - if (must_suspend_thread) - setup_thread (thread, 0); - return; - } - } - - ret = thread_set_state (thread, flavor, state, stateCnt); - CHK ("thread_trace: error writing thread state", ret); - if (must_suspend_thread) - setup_thread (thread, 0); -} - -#ifdef FLUSH_INFERIOR_CACHE - -/* When over-writing code on some machines the I-Cache must be flushed - explicitly, because it is not kept coherent by the lazy hardware. - This definitely includes breakpoints, for instance, or else we - end up looping in mysterious Bpt traps */ - -flush_inferior_icache (CORE_ADDR pc, int amount) -{ - vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH; - kern_return_t ret; - - ret = vm_machine_attribute (inferior_task, - pc, - amount, - MATTR_CACHE, - &flush); - if (ret != KERN_SUCCESS) - warning ("Error flushing inferior's cache : %s", - mach_error_string (ret)); -} -#endif /* FLUSH_INFERIOR_CACHE */ - - -static -suspend_all_threads (int from_tty) -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - int infoCnt; - thread_basic_info_data_t th_info; - - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("Could not suspend inferior threads."); - m3_kill_inferior (); - throw_exception (RETURN_ERROR); - } - - for (index = 0; index < thread_count; index++) - { - int mid; - - mid = map_port_name_to_mid (thread_list[index], - MACH_TYPE_THREAD); - - ret = thread_suspend (thread_list[index]); - - if (ret != KERN_SUCCESS) - warning ("Error trying to suspend thread %d : %s", - mid, mach_error_string (ret)); - - if (from_tty) - { - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (thread_list[index], - THREAD_BASIC_INFO, - (thread_info_t) & th_info, - &infoCnt); - CHK ("suspend can't get thread info", ret); - - warning ("Thread %d suspend count is %d", - mid, th_info.suspend_count); - } - } - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (int))); - CHK ("Error trying to deallocate thread list", ret); -} - -void -thread_suspend_command (char *args, int from_tty) -{ - kern_return_t ret; - int mid; - mach_port_t saved_thread; - int infoCnt; - thread_basic_info_data_t th_info; - - MACH_ERROR_NO_INFERIOR; - - if (!strcasecmp (args, "all")) - { - suspend_all_threads (from_tty); - return; - } - - saved_thread = current_thread; - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid == 0) - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - error ("Could not select thread %d", mid); - } - - ret = thread_suspend (current_thread); - if (ret != KERN_SUCCESS) - warning ("thread_suspend failed : %s", - mach_error_string (ret)); - - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) & th_info, - &infoCnt); - CHK ("suspend can't get thread info", ret); - - warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); - - current_thread = saved_thread; -} - -resume_all_threads (int from_tty) -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - int mid; - int infoCnt; - thread_basic_info_data_t th_info; - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - m3_kill_inferior (); - error ("task_threads", mach_error_string (ret)); - } - - for (index = 0; index < thread_count; index++) - { - infoCnt = THREAD_BASIC_INFO_COUNT; - ret = thread_info (thread_list[index], - THREAD_BASIC_INFO, - (thread_info_t) & th_info, - &infoCnt); - CHK ("resume_all can't get thread info", ret); - - mid = map_port_name_to_mid (thread_list[index], - MACH_TYPE_THREAD); - - if (!th_info.suspend_count) - { - if (mid != -1 && from_tty) - warning ("Thread %d is not suspended", mid); - continue; - } - - ret = thread_resume (thread_list[index]); - - if (ret != KERN_SUCCESS) - warning ("Error trying to resume thread %d : %s", - mid, mach_error_string (ret)); - else if (mid != -1 && from_tty) - warning ("Thread %d suspend count is %d", - mid, --th_info.suspend_count); - } - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (int))); - CHK ("Error trying to deallocate thread list", ret); -} - -void -thread_resume_command (char *args, int from_tty) -{ - int mid; - mach_port_t saved_thread; - kern_return_t ret; - thread_basic_info_data_t th_info; - int infoCnt = THREAD_BASIC_INFO_COUNT; - - MACH_ERROR_NO_INFERIOR; - - if (!strcasecmp (args, "all")) - { - resume_all_threads (from_tty); - return; - } - - saved_thread = current_thread; - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can resume only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid == 0) - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) - { - if (current_thread) - current_thread = saved_thread; - throw_exception (RETURN_ERROR); - } - - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) & th_info, - &infoCnt); - CHK ("resume can't get thread info", ret); - - if (!th_info.suspend_count) - { - warning ("Thread %d is not suspended", mid); - goto out; - } - - ret = thread_resume (current_thread); - if (ret != KERN_SUCCESS) - warning ("thread_resume failed : %s", - mach_error_string (ret)); - else - { - th_info.suspend_count--; - warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); - } - -out: - current_thread = saved_thread; -} - -void -thread_kill_command (char *args, int from_tty) -{ - int mid; - kern_return_t ret; - int thread_count; - thread_array_t thread_table; - int index; - mach_port_t thread_to_kill = MACH_PORT_NULL; - - - MACH_ERROR_NO_INFERIOR; - - if (!args) - error_no_arg ("thread mid to kill from the inferior task"); - - mid = parse_thread_id (args, 0, 0); - - if (mid < 0) - error ("You can kill only existing kernel threads with MID or @SLOTNUMBER"); - - if (mid) - { - ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill); - CHK ("thread_kill_command: machid_mach_port map failed", ret); - } - else - mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); - - /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */ - ret = task_threads (inferior_task, &thread_table, &thread_count); - CHK ("Error getting inferior's thread list", ret); - - if (thread_to_kill == current_thread) - { - ret = thread_terminate (thread_to_kill); - CHK ("Thread could not be terminated", ret); - - if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) - warning ("Last thread was killed, use \"kill\" command to kill task"); - } - else - for (index = 0; index < thread_count; index++) - if (thread_table[index] == thread_to_kill) - { - ret = thread_terminate (thread_to_kill); - CHK ("Thread could not be terminated", ret); - } - - if (thread_count > 1) - consume_send_rights (thread_table, thread_count); - - ret = vm_deallocate (mach_task_self (), (vm_address_t) thread_table, - (thread_count * sizeof (mach_port_t))); - CHK ("Error trying to deallocate thread list", ret); - - warning ("Thread %d killed", mid); -} - - -/* Task specific commands; add more if you like */ - -void -task_resume_command (char *args, int from_tty) -{ - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - /* Would be trivial to change, but is it desirable? */ - if (args) - error ("Currently gdb can resume only it's inferior task"); - - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t) & ta_info, - &infoCnt); - CHK ("task_resume_command: task_info failed", ret); - - if (ta_info.suspend_count == 0) - error ("Inferior task %d is not suspended", mid); - else if (ta_info.suspend_count == 1 && - from_tty && - !query ("Suspend count is now 1. Do you know what you are doing? ")) - error ("Task not resumed"); - - ret = task_resume (inferior_task); - CHK ("task_resume_command: task_resume", ret); - - if (ta_info.suspend_count == 1) - { - warning ("Inferior task %d is no longer suspended", mid); - must_suspend_thread = 1; - /* @@ This is not complete: Registers change all the time when not - suspended! */ - registers_changed (); - } - else - warning ("Inferior task %d suspend count is now %d", - mid, ta_info.suspend_count - 1); -} - - -void -task_suspend_command (char *args, int from_tty) -{ - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); - - MACH_ERROR_NO_INFERIOR; - - /* Would be trivial to change, but is it desirable? */ - if (args) - error ("Currently gdb can suspend only it's inferior task"); - - ret = task_suspend (inferior_task); - CHK ("task_suspend_command: task_suspend", ret); - - must_suspend_thread = 0; - - ret = task_info (inferior_task, - TASK_BASIC_INFO, - (task_info_t) & ta_info, - &infoCnt); - CHK ("task_suspend_command: task_info failed", ret); - - warning ("Inferior task %d suspend count is now %d", - mid, ta_info.suspend_count); -} - -static char * -get_size (int bytes) -{ - static char size[30]; - int zz = bytes / 1024; - - if (zz / 1024) - sprintf (size, "%-2.1f M", ((float) bytes) / (1024.0 * 1024.0)); - else - sprintf (size, "%d K", zz); - - return size; -} - -/* Does this require the target task to be suspended?? I don't think so. */ -void -task_info_command (char *args, int from_tty) -{ - int mid = -5; - mach_port_t task; - kern_return_t ret; - task_basic_info_data_t ta_info; - int infoCnt = TASK_BASIC_INFO_COUNT; - int page_size = round_page (1); - int thread_count = 0; - - if (MACH_PORT_VALID (inferior_task)) - mid = map_port_name_to_mid (inferior_task, - MACH_TYPE_TASK); - - task = inferior_task; - - if (args) - { - int tmid = atoi (args); - - if (tmid <= 0) - error ("Invalid mid %d for task info", tmid); - - if (tmid != mid) - { - mid = tmid; - ret = machid_mach_port (mid_server, mid_auth, tmid, &task); - CHK ("task_info_command: machid_mach_port map failed", ret); - } - } - - if (mid < 0) - error ("You have to give the task MID as an argument"); - - ret = task_info (task, - TASK_BASIC_INFO, - (task_info_t) & ta_info, - &infoCnt); - CHK ("task_info_command: task_info failed", ret); - - printf_filtered ("\nTask info for task %d:\n\n", mid); - printf_filtered (" Suspend count : %d\n", ta_info.suspend_count); - printf_filtered (" Base priority : %d\n", ta_info.base_priority); - printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size)); - printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size)); - - { - thread_array_t thread_list; - - ret = task_threads (task, &thread_list, &thread_count); - CHK ("task_info_command: task_threads", ret); - - printf_filtered (" Thread count : %d\n", thread_count); - - consume_send_rights (thread_list, thread_count); - ret = vm_deallocate (mach_task_self (), - (vm_address_t) thread_list, - (thread_count * sizeof (int))); - CHK ("Error trying to deallocate thread list", ret); - } - if (have_emulator_p (task)) - printf_filtered (" Emulator at : 0x%x..0x%x\n", - EMULATOR_BASE, EMULATOR_END); - else - printf_filtered (" No emulator.\n"); - - if (thread_count && task == inferior_task) - printf_filtered ("\nUse the \"thread list\" command to see the threads\n"); -} - -/* You may either FORWARD the exception to the inferior, or KEEP - * it and return to GDB command level. - * - * exception mid [ forward | keep ] - */ - -static void -exception_command (char *args, int from_tty) -{ - char *scan = args; - int exception; - int len; - - if (!args) - error_no_arg ("exception number action"); - - while (*scan == ' ' || *scan == '\t') - scan++; - - if ('0' <= *scan && *scan <= '9') - while ('0' <= *scan && *scan <= '9') - scan++; - else - error ("exception number action"); - - exception = atoi (args); - if (exception <= 0 || exception > MAX_EXCEPTION) - error ("Allowed exception numbers are in range 1..%d", - MAX_EXCEPTION); - - if (*scan != ' ' && *scan != '\t') - error ("exception number must be followed by a space"); - else - while (*scan == ' ' || *scan == '\t') - scan++; - - args = scan; - len = 0; - while (*scan) - { - len++; - scan++; - } - - if (!len) - error ("exception number action"); - - if (!strncasecmp (args, "forward", len)) - exception_map[exception].forward = TRUE; - else if (!strncasecmp (args, "keep", len)) - exception_map[exception].forward = FALSE; - else - error ("exception action is either \"keep\" or \"forward\""); -} - -static void -print_exception_info (int exception) -{ - boolean_t forward = exception_map[exception].forward; - - printf_filtered ("%s\t(%d): ", exception_map[exception].name, - exception); - if (!forward) - if (exception_map[exception].sigmap != SIG_UNKNOWN) - printf_filtered ("keep and handle as signal %d\n", - exception_map[exception].sigmap); - else - printf_filtered ("keep and handle as unknown signal %d\n", - exception_map[exception].sigmap); - else - printf_filtered ("forward exception to inferior\n"); -} - -void -exception_info (char *args, int from_tty) -{ - int exception; - - if (!args) - for (exception = 1; exception <= MAX_EXCEPTION; exception++) - print_exception_info (exception); - else - { - exception = atoi (args); - - if (exception <= 0 || exception > MAX_EXCEPTION) - error ("Invalid exception number, values from 1 to %d allowed", - MAX_EXCEPTION); - print_exception_info (exception); - } -} - -/* Check for actions for mach exceptions. - */ -mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who) -{ - boolean_t force_print = FALSE; - - - if (force_print_only || - exception_map[stop_exception].sigmap == SIG_UNKNOWN) - force_print = TRUE; - else - WSETSTOP (*w, exception_map[stop_exception].sigmap); - - if (exception_map[stop_exception].print || force_print) - { - target_terminal_ours (); - - printf_filtered ("\n%s received %s exception : ", - who, - exception_map[stop_exception].name); - - wrap_here (" "); - - switch (stop_exception) - { - case EXC_BAD_ACCESS: - printf_filtered ("referencing address 0x%x : %s\n", - stop_subcode, - mach_error_string (stop_code)); - break; - case EXC_BAD_INSTRUCTION: - printf_filtered - ("illegal or undefined instruction. code %d subcode %d\n", - stop_code, stop_subcode); - break; - case EXC_ARITHMETIC: - printf_filtered ("code %d\n", stop_code); - break; - case EXC_EMULATION: - printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode); - break; - case EXC_SOFTWARE: - printf_filtered ("%s specific, code 0x%x\n", - stop_code < 0xffff ? "hardware" : "os emulation", - stop_code); - break; - case EXC_BREAKPOINT: - printf_filtered ("type %d (machine dependent)\n", - stop_code); - break; - default: - internal_error (__FILE__, __LINE__, - "Unknown exception"); - } - } -} - -setup_notify_port (int create_new) -{ - kern_return_t ret; - - if (MACH_PORT_VALID (our_notify_port)) - { - ret = mach_port_destroy (mach_task_self (), our_notify_port); - CHK ("Could not destroy our_notify_port", ret); - } - - our_notify_port = MACH_PORT_NULL; - notify_chain = (port_chain_t) NULL; - port_chain_destroy (port_chain_obstack); - - if (create_new) - { - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &our_notify_port); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, - "Creating notify port %s", mach_error_string (ret)); - - ret = mach_port_move_member (mach_task_self (), - our_notify_port, - inferior_wait_port_set); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, - "initial move member %s", mach_error_string (ret)); - } -} - -/* - * Register our message port to the net name server - * - * Currently used only by the external stop-gdb program - * since ^C does not work if you would like to enter - * gdb command level while debugging your program. - * - * NOTE: If the message port is sometimes used for other - * purposes also, the NAME must not be a guessable one. - * Then, there should be a way to change it. - */ - -char registered_name[MAX_NAME_LEN]; - -void -message_port_info (char *args, int from_tty) -{ - if (registered_name[0]) - printf_filtered ("gdb's message port name: '%s'\n", - registered_name); - else - printf_filtered ("gdb's message port is not currently registered\n"); -} - -void -gdb_register_port (char *name, mach_port_t port) -{ - kern_return_t ret; - static int already_signed = 0; - int len; - - if (!MACH_PORT_VALID (port) || !name || !*name) - { - warning ("Invalid registration request"); - return; - } - - if (!already_signed) - { - ret = mach_port_insert_right (mach_task_self (), - our_message_port, - our_message_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("Failed to create a signature to our_message_port", ret); - already_signed = 1; - } - else if (already_signed > 1) - { - ret = netname_check_out (name_server_port, - registered_name, - our_message_port); - CHK ("Failed to check out gdb's message port", ret); - registered_name[0] = '\000'; - already_signed = 1; - } - - ret = netname_check_in (name_server_port, /* Name server port */ - name, /* Name of service */ - our_message_port, /* Signature */ - port); /* Creates a new send right */ - CHK ("Failed to check in the port", ret); - - len = 0; - while (len < MAX_NAME_LEN && *(name + len)) - { - registered_name[len] = *(name + len); - len++; - } - registered_name[len] = '\000'; - already_signed = 2; -} - -struct cmd_list_element *cmd_thread_list; -struct cmd_list_element *cmd_task_list; - -/*ARGSUSED */ -static void -thread_command (char *arg, int from_tty) -{ - printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n"); - help_list (cmd_thread_list, "thread ", -1, gdb_stdout); -} - -/*ARGSUSED */ -static void -task_command (char *arg, int from_tty) -{ - printf_unfiltered ("\"task\" must be followed by the name of a task command.\n"); - help_list (cmd_task_list, "task ", -1, gdb_stdout); -} - -add_mach_specific_commands (void) -{ - /* Thread handling commands */ - - /* FIXME: Move our thread support into the generic thread.c stuff so we - can share that code. */ - add_prefix_cmd ("mthread", class_stack, thread_command, - "Generic command for handling Mach threads in the debugged task.", - &cmd_thread_list, "thread ", 0, &cmdlist); - - add_com_alias ("th", "mthread", class_stack, 1); - - add_cmd ("select", class_stack, thread_select_command, - "Select and print MID of the selected thread", - &cmd_thread_list); - add_cmd ("list", class_stack, thread_list_command, - "List info of task's threads. Selected thread is marked with '*'", - &cmd_thread_list); - add_cmd ("suspend", class_run, thread_suspend_command, - "Suspend one or all of the threads in the selected task.", - &cmd_thread_list); - add_cmd ("resume", class_run, thread_resume_command, - "Resume one or all of the threads in the selected task.", - &cmd_thread_list); - add_cmd ("kill", class_run, thread_kill_command, - "Kill the specified thread MID from inferior task.", - &cmd_thread_list); -#if 0 - /* The rest of this support (condition_thread) was not merged. It probably - should not be merged in this form, but instead added to the generic GDB - thread support. */ - add_cmd ("break", class_breakpoint, condition_thread, - "Breakpoint N will only be effective for thread MID or @SLOT\n\ - If MID/@SLOT is omitted allow all threads to break at breakpoint", - &cmd_thread_list); -#endif - /* Thread command shorthands (for backward compatibility) */ - add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist); - add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist); - - /* task handling commands */ - - add_prefix_cmd ("task", class_stack, task_command, - "Generic command for handling debugged task.", - &cmd_task_list, "task ", 0, &cmdlist); - - add_com_alias ("ta", "task", class_stack, 1); - - add_cmd ("suspend", class_run, task_suspend_command, - "Suspend the inferior task.", - &cmd_task_list); - add_cmd ("resume", class_run, task_resume_command, - "Resume the inferior task.", - &cmd_task_list); - add_cmd ("info", no_class, task_info_command, - "Print information about the specified task.", - &cmd_task_list); - - /* Print my message port name */ - - add_info ("message-port", message_port_info, - "Returns the name of gdb's message port in the netnameserver"); - - /* Exception commands */ - - add_info ("exceptions", exception_info, - "What debugger does when program gets various exceptions.\n\ -Specify an exception number as argument to print info on that\n\ -exception only."); - - add_com ("exception", class_run, exception_command, - "Specify how to handle an exception.\n\ -Args are exception number followed by \"forward\" or \"keep\".\n\ -`Forward' means forward the exception to the program's normal exception\n\ -handler.\n\ -`Keep' means reenter debugger if this exception happens, and GDB maps\n\ -the exception to some signal (see info exception)\n\ -Normally \"keep\" is used to return to GDB on exception."); -} - -kern_return_t -do_mach_notify_dead_name (mach_port_t notify, mach_port_t name) -{ - kern_return_t kr = KERN_SUCCESS; - - /* Find the thing that notified */ - port_chain_t element = port_chain_member (notify_chain, name); - - /* Take name of from unreceived dead name notification list */ - notify_chain = port_chain_delete (notify_chain, name); - - if (!element) - error ("Received a dead name notify from unchained port (0x%x)", name); - - switch (element->type) - { - - case MACH_TYPE_THREAD: - target_terminal_ours_for_output (); - if (name == current_thread) - { - printf_filtered ("\nCurrent thread %d died", element->mid); - current_thread = MACH_PORT_NULL; - } - else - printf_filtered ("\nThread %d died", element->mid); - - break; - - case MACH_TYPE_TASK: - target_terminal_ours_for_output (); - if (name != inferior_task) - printf_filtered ("Task %d died, but it was not the selected task", - element->mid); - else - { - printf_filtered ("Current task %d died", element->mid); - - mach_port_destroy (mach_task_self (), name); - inferior_task = MACH_PORT_NULL; - - if (notify_chain) - warning ("There were still unreceived dead_name_notifications???"); - - /* Destroy the old notifications */ - setup_notify_port (0); - - } - break; - - default: - error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x", - name, element->type, element->mid); - break; - } - - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name) -{ - warning ("do_mach_notify_msg_accepted : notify %x, name %x", - notify, name); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount) -{ - warning ("do_mach_notify_no_senders : notify %x, mscount %x", - notify, mscount); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name) -{ - warning ("do_mach_notify_port_deleted : notify %x, name %x", - notify, name); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights) -{ - warning ("do_mach_notify_port_destroyed : notify %x, rights %x", - notify, rights); - return KERN_SUCCESS; -} - -kern_return_t -do_mach_notify_send_once (mach_port_t notify) -{ -#ifdef DUMP_SYSCALL - /* MANY of these are generated. */ - warning ("do_mach_notify_send_once : notify %x", - notify); -#endif - return KERN_SUCCESS; -} - -/* Kills the inferior. It's gone when you call this */ -static void -kill_inferior_fast (void) -{ - WAITTYPE w; - - if (PIDGET (inferior_ptid) == 0 || PIDGET (inferior_ptid) == 1) - return; - - /* kill() it, since the Unix server does not otherwise notice when - * killed with task_terminate(). - */ - if (PIDGET (inferior_ptid) > 0) - kill (PIDGET (inferior_ptid), SIGKILL); - - /* It's propably terminate already */ - (void) task_terminate (inferior_task); - - inferior_task = MACH_PORT_NULL; - current_thread = MACH_PORT_NULL; - - wait3 (&w, WNOHANG, 0); - - setup_notify_port (0); -} - -static void -m3_kill_inferior (void) -{ - kill_inferior_fast (); - target_mourn_inferior (); -} - -/* Clean up after the inferior dies. */ - -static void -m3_mourn_inferior (void) -{ - unpush_target (&m3_ops); - generic_mourn_inferior (); -} - - -/* Fork an inferior process, and start debugging it. */ - -static void -m3_create_inferior (char *exec_file, char *allargs, char **env) -{ - fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL); - /* We are at the first instruction we care about. */ - /* Pedal to the metal... */ - proceed ((CORE_ADDR) -1, 0, 0); -} - -/* Mark our target-struct as eligible for stray "run" and "attach" - commands. */ -static int -m3_can_run (void) -{ - return 1; -} - -/* Mach 3.0 does not need ptrace for anything - * Make sure nobody uses it on mach. - */ -ptrace (int a, int b, int c, int d) -{ - error ("Lose, Lose! Somebody called ptrace\n"); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -m3_resume (ptid_t ptid, int step, enum target_signal signal) -{ - kern_return_t ret; - - if (step) - { - thread_basic_info_data_t th_info; - unsigned int infoCnt = THREAD_BASIC_INFO_COUNT; - - /* There is no point in single stepping when current_thread - * is dead. - */ - if (!MACH_PORT_VALID (current_thread)) - error ("No thread selected; can not single step"); - - /* If current_thread is suspended, tracing it would never return. - */ - ret = thread_info (current_thread, - THREAD_BASIC_INFO, - (thread_info_t) & th_info, - &infoCnt); - CHK ("child_resume: can't get thread info", ret); - - if (th_info.suspend_count) - error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it"); - } - - vm_read_cache_valid = FALSE; - - if (signal && PIDGET (inferior_ptid) > 0) /* Do not signal, if attached by MID */ - kill (PIDGET (inferior_ptid), target_signal_to_host (signal)); - - if (step) - { - suspend_all_threads (0); - - setup_single_step (current_thread, TRUE); - - ret = thread_resume (current_thread); - CHK ("thread_resume", ret); - } - - ret = task_resume (inferior_task); - if (ret == KERN_FAILURE) - warning ("Task was not suspended"); - else - CHK ("Resuming task", ret); - - /* HACK HACK This is needed by the multiserver system HACK HACK */ - while ((ret = task_resume (inferior_task)) == KERN_SUCCESS) - /* make sure it really runs */ ; - /* HACK HACK This is needed by the multiserver system HACK HACK */ -} - -#ifdef ATTACH_DETACH - -/* Start debugging the process with the given task */ -void -task_attach (task_t tid) -{ - kern_return_t ret; - inferior_task = tid; - - ret = task_suspend (inferior_task); - CHK ("task_attach: task_suspend", ret); - - must_suspend_thread = 0; - - setup_notify_port (1); - - request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); - - setup_exception_port (); - - emulator_present = have_emulator_p (inferior_task); - - attach_flag = 1; -} - -/* Well, we can call error also here and leave the - * target stack inconsistent. Sigh. - * Fix this sometime (the only way to fail here is that - * the task has no threads at all, which is rare, but - * possible; or if the target task has died, which is also - * possible, but unlikely, since it has been suspended. - * (Someone must have killed it)) - */ -void -attach_to_thread (void) -{ - if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) - error ("Could not select any threads to attach to"); -} - -mid_attach (int mid) -{ - kern_return_t ret; - - ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task); - CHK ("mid_attach: machid_mach_port", ret); - - task_attach (inferior_task); - - return mid; -} - -/* - * Start debugging the process whose unix process-id is PID. - * A negative "pid" value is legal and signifies a mach_id not a unix pid. - * - * Prevent (possible unwanted) dangerous operations by enabled users - * like "atta 0" or "atta foo" (equal to the previous :-) and - * "atta pidself". Anyway, the latter is allowed by specifying a MID. - */ -static int -m3_do_attach (int pid) -{ - kern_return_t ret; - - if (pid == 0) - error ("MID=0, Debugging the master unix server does not compute"); - - /* Foo. This assumes gdb has a unix pid */ - if (pid == getpid ()) - error ("I will debug myself only by mid. (Gdb would suspend itself!)"); - - if (pid < 0) - { - mid_attach (-(pid)); - - /* inferior_ptid will be NEGATIVE! */ - inferior_ptid = pid_to_ptid (pid); - - return PIDGET (inferior_ptid); - } - - inferior_task = task_by_pid (pid); - if (!MACH_PORT_VALID (inferior_task)) - error ("Cannot map Unix pid %d to Mach task port", pid); - - task_attach (inferior_task); - - inferior_ptid = pid_to_ptid (pid); - - return PIDGET (inferior_ptid); -} - -/* Attach to process PID, then initialize for debugging it - and wait for the trace-trap that results from attaching. */ - -static void -m3_attach (char *args, int from_tty) -{ - char *exec_file; - int pid; - - if (!args) - error_no_arg ("process-id to attach"); - - pid = atoi (args); - - if (pid == getpid ()) /* Trying to masturbate? */ - error ("I refuse to debug myself!"); - - if (from_tty) - { - exec_file = (char *) get_exec_file (0); - - if (exec_file) - printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, - target_pid_to_str (pid_to_ptid (pid))); - else - printf_unfiltered ("Attaching to %s\n", - target_pid_to_str (pid_to_ptid (pid))); - - gdb_flush (gdb_stdout); - } - - m3_do_attach (pid_to_ptid (pid)); - inferior_ptid = pid_to_ptid (pid); - push_target (&m3_ops); -} - -void -deallocate_inferior_ports (void) -{ - kern_return_t ret; - thread_array_t thread_list; - int thread_count, index; - - if (!MACH_PORT_VALID (inferior_task)) - return; - - ret = task_threads (inferior_task, &thread_list, &thread_count); - if (ret != KERN_SUCCESS) - { - warning ("deallocate_inferior_ports: task_threads", - mach_error_string (ret)); - return; - } - - /* Get rid of send rights to task threads */ - for (index = 0; index < thread_count; index++) - { - int rights; - ret = mach_port_get_refs (mach_task_self (), - thread_list[index], - MACH_PORT_RIGHT_SEND, - &rights); - CHK ("deallocate_inferior_ports: get refs", ret); - - if (rights > 0) - { - ret = mach_port_mod_refs (mach_task_self (), - thread_list[index], - MACH_PORT_RIGHT_SEND, - -rights); - CHK ("deallocate_inferior_ports: mod refs", ret); - } - } - - ret = mach_port_mod_refs (mach_task_self (), - inferior_exception_port, - MACH_PORT_RIGHT_RECEIVE, - -1); - CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret); - - ret = mach_port_deallocate (mach_task_self (), - inferior_task); - CHK ("deallocate_task_port: deallocating inferior_task", ret); - - current_thread = MACH_PORT_NULL; - inferior_task = MACH_PORT_NULL; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -static void -m3_do_detach (int signal) -{ - kern_return_t ret; - - MACH_ERROR_NO_INFERIOR; - - if (current_thread != MACH_PORT_NULL) - { - /* Store the gdb's view of the thread we are deselecting - * before we detach. - * @@ I am really not sure if this is ever needeed. - */ - target_prepare_to_store (); - target_store_registers (-1); - } - - ret = task_set_special_port (inferior_task, - TASK_EXCEPTION_PORT, - inferior_old_exception_port); - CHK ("task_set_special_port", ret); - - /* Discard all requested notifications */ - setup_notify_port (0); - - if (remove_breakpoints ()) - warning ("Could not remove breakpoints when detaching"); - - if (signal && PIDGET (inferior_ptid) > 0) - kill (PIDGET (inferior_ptid), signal); - - /* the task might be dead by now */ - (void) task_resume (inferior_task); - - deallocate_inferior_ports (); - - attach_flag = 0; -} - -/* Take a program previously attached to and detaches it. - The program resumes execution and will no longer stop - on signals, etc. We'd better not have left any breakpoints - in the program or it'll die when it hits one. For this - to work, it may be necessary for the process to have been - previously attached. It *might* work if the program was - started via fork. */ - -static void -m3_detach (char *args, int from_tty) -{ - int siggnal = 0; - - if (from_tty) - { - char *exec_file = get_exec_file (0); - if (exec_file == 0) - exec_file = ""; - printf_unfiltered ("Detaching from program: %s %s\n", - exec_file, target_pid_to_str (inferior_ptid)); - gdb_flush (gdb_stdout); - } - if (args) - siggnal = atoi (args); - - m3_do_detach (siggnal); - inferior_ptid = null_ptid; - unpush_target (&m3_ops); /* Pop out of handling an inferior */ -} -#endif /* ATTACH_DETACH */ - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -m3_prepare_to_store (void) -{ -#ifdef CHILD_PREPARE_TO_STORE - CHILD_PREPARE_TO_STORE (); -#endif -} - -/* Print status information about what we're accessing. */ - -static void -m3_files_info (struct target_ops *ignore) -{ - /* FIXME: should print MID and all that crap. */ - printf_unfiltered ("\tUsing the running image of %s %s.\n", - attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid)); -} - -static void -m3_open (char *arg, int from_tty) -{ - error ("Use the \"run\" command to start a Unix child process."); -} - -#ifdef DUMP_SYSCALL -#define STR(x) #x - -char *bsd1_names[] = -{ - "execve", - "fork", - "take_signal", - "sigreturn", - "getrusage", - "chdir", - "chroot", - "open", - "creat", - "mknod", - "link", - "symlink", - "unlink", - "access", - "stat", - "readlink", - "chmod", - "chown", - "utimes", - "truncate", - "rename", - "mkdir", - "rmdir", - "xutimes", - "mount", - "umount", - "acct", - "setquota", - "write_short", - "write_long", - "send_short", - "send_long", - "sendto_short", - "sendto_long", - "select", - "task_by_pid", - "recvfrom_short", - "recvfrom_long", - "setgroups", - "setrlimit", - "sigvec", - "sigstack", - "settimeofday", - "adjtime", - "setitimer", - "sethostname", - "bind", - "accept", - "connect", - "setsockopt", - "getsockopt", - "getsockname", - "getpeername", - "init_process", - "table_set", - "table_get", - "pioctl", - "emulator_error", - "readwrite", - "share_wakeup", - 0, - "maprw_request_it", - "maprw_release_it", - "maprw_remap", - "pid_by_task", -}; - -int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]); - -char * -name_str (int name, char *buf) -{ - switch (name) - { - case MACH_MSG_TYPE_BOOLEAN: - return "boolean"; - case MACH_MSG_TYPE_INTEGER_16: - return "short"; - case MACH_MSG_TYPE_INTEGER_32: - return "long"; - case MACH_MSG_TYPE_CHAR: - return "char"; - case MACH_MSG_TYPE_BYTE: - return "byte"; - case MACH_MSG_TYPE_REAL: - return "real"; - case MACH_MSG_TYPE_STRING: - return "string"; - default: - sprintf (buf, "%d", name); - return buf; - } -} - -char * -id_str (int id, char *buf) -{ - char *p; - if (id >= 101000 && id < 101000 + bsd1_nnames) - { - if (p = bsd1_names[id - 101000]) - return p; - } - if (id == 102000) - return "psignal_retry"; - if (id == 100000) - return "syscall"; - sprintf (buf, "%d", id); - return buf; -} - -print_msg (mach_msg_header_t *mp) -{ - char *fmt_x = "%20s : 0x%08x\n"; - char *fmt_d = "%20s : %10d\n"; - char *fmt_s = "%20s : %s\n"; - char buf[100]; - - puts_filtered ("\n"); -#define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x) - pr (fmt_x, (*mp), msgh_bits); - pr (fmt_d, (*mp), msgh_size); - pr (fmt_x, (*mp), msgh_remote_port); - pr (fmt_x, (*mp), msgh_local_port); - pr (fmt_d, (*mp), msgh_kind); - printf_filtered (fmt_s, STR (msgh_id), id_str (mp->msgh_id, buf)); - - if (debug_level > 1) - { - char *p, *ep, *dp; - int plen; - p = (char *) mp; - ep = p + mp->msgh_size; - p += sizeof (*mp); - for (; p < ep; p += plen) - { - mach_msg_type_t *tp; - mach_msg_type_long_t *tlp; - int name, size, number; - tp = (mach_msg_type_t *) p; - if (tp->msgt_longform) - { - tlp = (mach_msg_type_long_t *) tp; - name = tlp->msgtl_name; - size = tlp->msgtl_size; - number = tlp->msgtl_number; - plen = sizeof (*tlp); - } - else - { - name = tp->msgt_name; - size = tp->msgt_size; - number = tp->msgt_number; - plen = sizeof (*tp); - } - printf_filtered ("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n", - name_str (name, buf), size, number, tp->msgt_inline, - tp->msgt_longform, tp->msgt_deallocate); - dp = p + plen; - if (tp->msgt_inline) - { - int l; - l = size * number / 8; - l = (l + sizeof (long) - 1) & ~((sizeof (long)) - 1); - plen += l; - print_data (dp, size, number); - } - else - { - plen += sizeof (int *); - } - printf_filtered ("plen=%d\n", plen); - } - } -} - -print_data (char *p, int size, int number) -{ - int *ip; - short *sp; - int i; - - switch (size) - { - case 8: - for (i = 0; i < number; i++) - { - printf_filtered (" %02x", p[i]); - } - break; - case 16: - sp = (short *) p; - for (i = 0; i < number; i++) - { - printf_filtered (" %04x", sp[i]); - } - break; - case 32: - ip = (int *) p; - for (i = 0; i < number; i++) - { - printf_filtered (" %08x", ip[i]); - } - break; - } - puts_filtered ("\n"); -} -#endif /* DUMP_SYSCALL */ - -static void -m3_stop (void) -{ - error ("to_stop target function not implemented"); -} - -static char * -m3_pid_to_exec_file (int pid) -{ - error ("to_pid_to_exec_file target function not implemented"); - return NULL; /* To keep all compilers happy. */ -} - -static void -init_m3_ops (void) -{ - m3_ops.to_shortname = "mach"; - m3_ops.to_longname = "Mach child process"; - m3_ops.to_doc = "Mach child process (started by the \"run\" command)."; - m3_ops.to_open = m3_open; - m3_ops.to_attach = m3_attach; - m3_ops.to_detach = m3_detach; - m3_ops.to_resume = m3_resume; - m3_ops.to_wait = mach_really_wait; - m3_ops.to_fetch_registers = fetch_inferior_registers; - m3_ops.to_store_registers = store_inferior_registers; - m3_ops.to_prepare_to_store = m3_prepare_to_store; - m3_ops.to_xfer_memory = m3_xfer_memory; - m3_ops.to_files_info = m3_files_info; - m3_ops.to_insert_breakpoint = memory_insert_breakpoint; - m3_ops.to_remove_breakpoint = memory_remove_breakpoint; - m3_ops.to_terminal_init = terminal_init_inferior; - m3_ops.to_terminal_inferior = terminal_inferior; - m3_ops.to_terminal_ours_for_output = terminal_ours_for_output; - m3_ops.to_terminal_save_ours = terminal_save_ours; - m3_ops.to_terminal_ours = terminal_ours; - m3_ops.to_terminal_info = child_terminal_info; - m3_ops.to_kill = m3_kill_inferior; - m3_ops.to_create_inferior = m3_create_inferior; - m3_ops.to_mourn_inferior = m3_mourn_inferior; - m3_ops.to_can_run = m3_can_run; - m3_ops.to_stop = m3_stop; - m3_ops.to_pid_to_exec_file = m3_pid_to_exec_file; - m3_ops.to_stratum = process_stratum; - m3_ops.to_has_all_memory = 1; - m3_ops.to_has_memory = 1; - m3_ops.to_has_stack = 1; - m3_ops.to_has_registers = 1; - m3_ops.to_has_execution = 1; - m3_ops.to_magic = OPS_MAGIC; -} - -void -_initialize_m3_nat (void) -{ - kern_return_t ret; - - init_m3_ops (); - add_target (&m3_ops); - - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_PORT_SET, - &inferior_wait_port_set); - if (ret != KERN_SUCCESS) - internal_error (__FILE__, __LINE__, - "initial port set %s", mach_error_string (ret)); - - /* mach_really_wait now waits for this */ - currently_waiting_for = inferior_wait_port_set; - - ret = netname_look_up (name_server_port, hostname, "MachID", &mid_server); - if (ret != KERN_SUCCESS) - { - mid_server = MACH_PORT_NULL; - - warning ("initialize machid: netname_lookup_up(MachID) : %s", - mach_error_string (ret)); - warning ("Some (most?) features disabled..."); - } - - mid_auth = mach_privileged_host_port (); - if (mid_auth == MACH_PORT_NULL) - mid_auth = mach_task_self (); - - obstack_init (port_chain_obstack); - - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &thread_exception_port); - CHK ("Creating thread_exception_port for single stepping", ret); - - ret = mach_port_insert_right (mach_task_self (), - thread_exception_port, - thread_exception_port, - MACH_MSG_TYPE_MAKE_SEND); - CHK ("Inserting send right to thread_exception_port", ret); - - /* Allocate message port */ - ret = mach_port_allocate (mach_task_self (), - MACH_PORT_RIGHT_RECEIVE, - &our_message_port); - if (ret != KERN_SUCCESS) - warning ("Creating message port %s", mach_error_string (ret)); - else - { - char buf[MAX_NAME_LEN]; - ret = mach_port_move_member (mach_task_self (), - our_message_port, - inferior_wait_port_set); - if (ret != KERN_SUCCESS) - warning ("message move member %s", mach_error_string (ret)); - - - /* @@@@ No way to change message port name currently */ - /* Foo. This assumes gdb has a unix pid */ - sprintf (buf, "gdb-%d", getpid ()); - gdb_register_port (buf, our_message_port); - } - - /* Heap for thread commands */ - obstack_init (cproc_obstack); - - add_mach_specific_commands (); -} +// OBSOLETE /* Interface GDB to Mach 3.0 operating systems. +// OBSOLETE (Most) Mach 3.0 related routines live in this file. +// OBSOLETE +// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +// OBSOLETE 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi> +// OBSOLETE * Computing Centre +// OBSOLETE * Helsinki University of Technology +// OBSOLETE * Finland +// OBSOLETE * +// OBSOLETE * Thanks to my friends who helped with ideas and testing: +// OBSOLETE * +// OBSOLETE * Johannes Helander, Antti Louko, Tero Mononen, +// OBSOLETE * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi +// OBSOLETE * +// OBSOLETE * Tero Kivinen and Eamonn McManus +// OBSOLETE * kivinen@cs.hut.fi emcmanus@gr.osf.org +// OBSOLETE * +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #include <stdio.h> +// OBSOLETE +// OBSOLETE #include <mach.h> +// OBSOLETE #include <servers/netname.h> +// OBSOLETE #include <servers/machid.h> +// OBSOLETE #include <mach/message.h> +// OBSOLETE #include <mach/notify.h> +// OBSOLETE #include <mach_error.h> +// OBSOLETE #include <mach/exception.h> +// OBSOLETE #include <mach/vm_attributes.h> +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "value.h" +// OBSOLETE #include "language.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "gdb_wait.h" +// OBSOLETE #include "gdbcmd.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE #include <servers/machid_lib.h> +// OBSOLETE #else +// OBSOLETE #define MACH_TYPE_TASK 1 +// OBSOLETE #define MACH_TYPE_THREAD 2 +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Included only for signal names and NSIG +// OBSOLETE +// OBSOLETE * note: There are many problems in signal handling with +// OBSOLETE * gdb in Mach 3.0 in general. +// OBSOLETE */ +// OBSOLETE #include <signal.h> +// OBSOLETE #define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */ +// OBSOLETE +// OBSOLETE #include <cthreads.h> +// OBSOLETE +// OBSOLETE /* This is what a cproc looks like. This is here partly because +// OBSOLETE cthread_internals.h is not a header we can just #include, partly with +// OBSOLETE an eye towards perhaps getting this to work with cross-debugging +// OBSOLETE someday. Best solution is if CMU publishes a real interface to this +// OBSOLETE stuff. */ +// OBSOLETE #define CPROC_NEXT_OFFSET 0 +// OBSOLETE #define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE) +// OBSOLETE #define CPROC_INCARNATION_SIZE (sizeof (cthread_t)) +// OBSOLETE #define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE) +// OBSOLETE #define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE) +// OBSOLETE #define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE) +// OBSOLETE #define CPROC_REPLY_SIZE (sizeof (mach_port_t)) +// OBSOLETE #define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE) +// OBSOLETE #define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE) +// OBSOLETE #define CPROC_LOCK_SIZE (sizeof (spin_lock_t)) +// OBSOLETE #define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE) +// OBSOLETE #define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE) +// OBSOLETE #define CPROC_WIRED_SIZE (sizeof (mach_port_t)) +// OBSOLETE #define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE) +// OBSOLETE #define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE) +// OBSOLETE #define CPROC_MSG_SIZE (sizeof (mach_msg_header_t)) +// OBSOLETE #define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE) +// OBSOLETE #define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE) +// OBSOLETE #define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT) +// OBSOLETE #define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE) +// OBSOLETE +// OBSOLETE /* Values for the state field in the cproc. */ +// OBSOLETE #define CPROC_RUNNING 0 +// OBSOLETE #define CPROC_SWITCHING 1 +// OBSOLETE #define CPROC_BLOCKED 2 +// OBSOLETE #define CPROC_CONDWAIT 4 +// OBSOLETE +// OBSOLETE /* For cproc and kernel thread mapping */ +// OBSOLETE typedef struct gdb_thread +// OBSOLETE { +// OBSOLETE mach_port_t name; +// OBSOLETE CORE_ADDR sp; +// OBSOLETE CORE_ADDR pc; +// OBSOLETE CORE_ADDR fp; +// OBSOLETE boolean_t in_emulator; +// OBSOLETE int slotid; +// OBSOLETE +// OBSOLETE /* This is for the mthreads list. It points to the cproc list. +// OBSOLETE Perhaps the two lists should be merged (or perhaps it was a mistake +// OBSOLETE to make them both use a struct gdb_thread). */ +// OBSOLETE struct gdb_thread *cproc; +// OBSOLETE +// OBSOLETE /* These are for the cproc list, which is linked through the next field +// OBSOLETE of the struct gdb_thread. */ +// OBSOLETE char raw_cproc[CPROC_SIZE]; +// OBSOLETE /* The cthread which is pointed to by the incarnation field from the +// OBSOLETE cproc. This points to the copy we've read into GDB. */ +// OBSOLETE cthread_t cthread; +// OBSOLETE /* Point back to the mthreads list. */ +// OBSOLETE int reverse_map; +// OBSOLETE struct gdb_thread *next; +// OBSOLETE } +// OBSOLETE *gdb_thread_t; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Actions for Mach exceptions. +// OBSOLETE * +// OBSOLETE * sigmap field maps the exception to corresponding Unix signal. +// OBSOLETE * +// OBSOLETE * I do not know how to map the exception to unix signal +// OBSOLETE * if SIG_UNKNOWN is specified. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE struct exception_list +// OBSOLETE { +// OBSOLETE char *name; +// OBSOLETE boolean_t forward; +// OBSOLETE boolean_t print; +// OBSOLETE int sigmap; +// OBSOLETE } +// OBSOLETE exception_map[] = +// OBSOLETE { +// OBSOLETE { +// OBSOLETE "not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN +// OBSOLETE } +// OBSOLETE , +// OBSOLETE { +// OBSOLETE "EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV +// OBSOLETE } +// OBSOLETE , +// OBSOLETE { +// OBSOLETE "EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL +// OBSOLETE } +// OBSOLETE , +// OBSOLETE { +// OBSOLETE "EXC_ARITHMETIC", FALSE, TRUE, SIGFPE +// OBSOLETE } +// OBSOLETE , +// OBSOLETE { +// OBSOLETE "EXC_EMULATION", FALSE, TRUE, SIGEMT +// OBSOLETE } +// OBSOLETE , /* ??? */ +// OBSOLETE { +// OBSOLETE "EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN +// OBSOLETE } +// OBSOLETE , +// OBSOLETE { +// OBSOLETE "EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP +// OBSOLETE } +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* Mach exception table size */ +// OBSOLETE int max_exception = sizeof (exception_map) / sizeof (struct exception_list) - 1; +// OBSOLETE +// OBSOLETE #define MAX_EXCEPTION max_exception +// OBSOLETE +// OBSOLETE WAITTYPE wait_status; +// OBSOLETE +// OBSOLETE /* If you define this, intercepted bsd server calls will be +// OBSOLETE * dumped while waiting the inferior to EXEC the correct +// OBSOLETE * program +// OBSOLETE */ +// OBSOLETE /* #define DUMP_SYSCALL /* debugging interceptor */ +// OBSOLETE +// OBSOLETE /* xx_debug() outputs messages if this is nonzero. +// OBSOLETE * If > 1, DUMP_SYSCALL will dump message contents. +// OBSOLETE */ +// OBSOLETE int debug_level = 0; +// OBSOLETE +// OBSOLETE /* "Temporary" debug stuff */ +// OBSOLETE void +// OBSOLETE xx_debug (char *fmt, int a, int b, int c) +// OBSOLETE { +// OBSOLETE if (debug_level) +// OBSOLETE warning (fmt, a, b, c); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This is in libmach.a */ +// OBSOLETE extern mach_port_t name_server_port; +// OBSOLETE +// OBSOLETE /* Set in catch_exception_raise */ +// OBSOLETE int stop_exception, stop_code, stop_subcode; +// OBSOLETE int stopped_in_exception; +// OBSOLETE +// OBSOLETE /* Thread that was the active thread when we stopped */ +// OBSOLETE thread_t stop_thread = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE char *hostname = ""; +// OBSOLETE +// OBSOLETE /* Set when task is attached or created */ +// OBSOLETE boolean_t emulator_present = FALSE; +// OBSOLETE +// OBSOLETE task_t inferior_task; +// OBSOLETE thread_t current_thread; +// OBSOLETE +// OBSOLETE /* Exception ports for inferior task */ +// OBSOLETE mach_port_t inferior_exception_port = MACH_PORT_NULL; +// OBSOLETE mach_port_t inferior_old_exception_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* task exceptions and notifications */ +// OBSOLETE mach_port_t inferior_wait_port_set = MACH_PORT_NULL; +// OBSOLETE mach_port_t our_notify_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* This is "inferior_wait_port_set" when not single stepping, and +// OBSOLETE * "singlestepped_thread_port" when we are single stepping. +// OBSOLETE * +// OBSOLETE * This is protected by a cleanup function: discard_single_step() +// OBSOLETE */ +// OBSOLETE mach_port_t currently_waiting_for = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* A port for external messages to gdb. +// OBSOLETE * External in the meaning that they do not come +// OBSOLETE * from the inferior_task, but rather from external +// OBSOLETE * tasks. +// OBSOLETE * +// OBSOLETE * As a debugging feature: +// OBSOLETE * A debugger debugging another debugger can stop the +// OBSOLETE * inferior debugger by the following command sequence +// OBSOLETE * (without running external programs) +// OBSOLETE * +// OBSOLETE * (top-gdb) set stop_inferior_gdb () +// OBSOLETE * (top-gdb) continue +// OBSOLETE */ +// OBSOLETE mach_port_t our_message_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* For single stepping */ +// OBSOLETE mach_port_t thread_exception_port = MACH_PORT_NULL; +// OBSOLETE mach_port_t thread_saved_exception_port = MACH_PORT_NULL; +// OBSOLETE mach_port_t singlestepped_thread_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* For machid calls */ +// OBSOLETE mach_port_t mid_server = MACH_PORT_NULL; +// OBSOLETE mach_port_t mid_auth = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* If gdb thinks the inferior task is not suspended, it +// OBSOLETE * must take suspend/abort the threads when it reads the state. +// OBSOLETE */ +// OBSOLETE int must_suspend_thread = 0; +// OBSOLETE +// OBSOLETE /* When single stepping, we switch the port that mach_really_wait() listens to. +// OBSOLETE * This cleanup is a guard to prevent the port set from being left to +// OBSOLETE * the singlestepped_thread_port when error() is called. +// OBSOLETE * This is nonzero only when we are single stepping. +// OBSOLETE */ +// OBSOLETE #define NULL_CLEANUP (struct cleanup *)0 +// OBSOLETE struct cleanup *cleanup_step = NULL_CLEANUP; +// OBSOLETE +// OBSOLETE +// OBSOLETE static struct target_ops m3_ops; +// OBSOLETE +// OBSOLETE static void m3_kill_inferior (); +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE #define MACH_TYPE_EXCEPTION_PORT -1 +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Chain of ports to remember requested notifications. */ +// OBSOLETE +// OBSOLETE struct port_chain +// OBSOLETE { +// OBSOLETE struct port_chain *next; +// OBSOLETE mach_port_t port; +// OBSOLETE int type; +// OBSOLETE int mid; /* Now only valid with MACH_TYPE_THREAD and */ +// OBSOLETE /* MACH_TYPE_THREAD */ +// OBSOLETE }; +// OBSOLETE typedef struct port_chain *port_chain_t; +// OBSOLETE +// OBSOLETE /* Room for chain nodes comes from pchain_obstack */ +// OBSOLETE struct obstack pchain_obstack; +// OBSOLETE struct obstack *port_chain_obstack = &pchain_obstack; +// OBSOLETE +// OBSOLETE /* For thread handling */ +// OBSOLETE struct obstack Cproc_obstack; +// OBSOLETE struct obstack *cproc_obstack = &Cproc_obstack; +// OBSOLETE +// OBSOLETE /* the list of notified ports */ +// OBSOLETE port_chain_t notify_chain = (port_chain_t) NULL; +// OBSOLETE +// OBSOLETE port_chain_t +// OBSOLETE port_chain_insert (port_chain_t list, mach_port_t name, int type) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE port_chain_t new; +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (name)) +// OBSOLETE return list; +// OBSOLETE +// OBSOLETE if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD) +// OBSOLETE { +// OBSOLETE if (!MACH_PORT_VALID (mid_server)) +// OBSOLETE { +// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to MID", +// OBSOLETE name); +// OBSOLETE mid = name; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Can not map name (0x%x) to MID with machid", name); +// OBSOLETE mid = name; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); +// OBSOLETE +// OBSOLETE new = (port_chain_t) obstack_alloc (port_chain_obstack, +// OBSOLETE sizeof (struct port_chain)); +// OBSOLETE new->next = list; +// OBSOLETE new->port = name; +// OBSOLETE new->type = type; +// OBSOLETE new->mid = mid; +// OBSOLETE +// OBSOLETE return new; +// OBSOLETE } +// OBSOLETE +// OBSOLETE port_chain_t +// OBSOLETE port_chain_delete (port_chain_t list, mach_port_t elem) +// OBSOLETE { +// OBSOLETE if (list) +// OBSOLETE if (list->port == elem) +// OBSOLETE list = list->next; +// OBSOLETE else +// OBSOLETE while (list->next) +// OBSOLETE { +// OBSOLETE if (list->next->port == elem) +// OBSOLETE list->next = list->next->next; /* GCd with obstack_free() */ +// OBSOLETE else +// OBSOLETE list = list->next; +// OBSOLETE } +// OBSOLETE return list; +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE port_chain_destroy (struct obstack *ostack) +// OBSOLETE { +// OBSOLETE obstack_free (ostack, 0); +// OBSOLETE obstack_init (ostack); +// OBSOLETE } +// OBSOLETE +// OBSOLETE port_chain_t +// OBSOLETE port_chain_member (port_chain_t list, mach_port_t elem) +// OBSOLETE { +// OBSOLETE while (list) +// OBSOLETE { +// OBSOLETE if (list->port == elem) +// OBSOLETE return list; +// OBSOLETE list = list->next; +// OBSOLETE } +// OBSOLETE return (port_chain_t) NULL; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE map_port_name_to_mid (mach_port_t name, int type) +// OBSOLETE { +// OBSOLETE port_chain_t elem; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (name)) +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE elem = port_chain_member (notify_chain, name); +// OBSOLETE +// OBSOLETE if (elem && (elem->type == type)) +// OBSOLETE return elem->mid; +// OBSOLETE +// OBSOLETE if (elem) +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (mid_server)) +// OBSOLETE { +// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to mid", +// OBSOLETE name); +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Can not map name (0x%x) to mid with machid", name); +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Guard for currently_waiting_for and singlestepped_thread_port */ +// OBSOLETE static void +// OBSOLETE discard_single_step (thread_t thread) +// OBSOLETE { +// OBSOLETE currently_waiting_for = inferior_wait_port_set; +// OBSOLETE +// OBSOLETE cleanup_step = NULL_CLEANUP; +// OBSOLETE if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port)) +// OBSOLETE setup_single_step (thread, FALSE); +// OBSOLETE } +// OBSOLETE +// OBSOLETE setup_single_step (thread_t thread, boolean_t start_step) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (thread)) +// OBSOLETE error ("Invalid thread supplied to setup_single_step"); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE mach_port_t teport; +// OBSOLETE +// OBSOLETE /* Get the current thread exception port */ +// OBSOLETE ret = thread_get_exception_port (thread, &teport); +// OBSOLETE CHK ("Getting thread's exception port", ret); +// OBSOLETE +// OBSOLETE if (start_step) +// OBSOLETE { +// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) +// OBSOLETE { +// OBSOLETE warning ("Singlestepped_thread_port (0x%x) is still valid?", +// OBSOLETE singlestepped_thread_port); +// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* If we are already stepping this thread */ +// OBSOLETE if (MACH_PORT_VALID (teport) && teport == thread_exception_port) +// OBSOLETE { +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport); +// OBSOLETE CHK ("Could not deallocate thread exception port", ret); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE ret = thread_set_exception_port (thread, thread_exception_port); +// OBSOLETE CHK ("Setting exception port for thread", ret); +// OBSOLETE #if 0 +// OBSOLETE /* Insert thread exception port to wait port set */ +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE thread_exception_port, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE CHK ("Moving thread exception port to inferior_wait_port_set", +// OBSOLETE ret); +// OBSOLETE #endif +// OBSOLETE thread_saved_exception_port = teport; +// OBSOLETE } +// OBSOLETE +// OBSOLETE thread_trace (thread, TRUE); +// OBSOLETE +// OBSOLETE singlestepped_thread_port = thread_exception_port; +// OBSOLETE currently_waiting_for = singlestepped_thread_port; +// OBSOLETE cleanup_step = make_cleanup (discard_single_step, thread); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (!MACH_PORT_VALID (teport)) +// OBSOLETE error ("Single stepped thread had an invalid exception port?"); +// OBSOLETE +// OBSOLETE if (teport != thread_exception_port) +// OBSOLETE error ("Single stepped thread had an unknown exception port?"); +// OBSOLETE +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport); +// OBSOLETE CHK ("Couldn't deallocate thread exception port", ret); +// OBSOLETE #if 0 +// OBSOLETE /* Remove thread exception port from wait port set */ +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE thread_exception_port, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE CHK ("Removing thread exception port from inferior_wait_port_set", +// OBSOLETE ret); +// OBSOLETE #endif +// OBSOLETE /* Restore thread's old exception port */ +// OBSOLETE ret = thread_set_exception_port (thread, +// OBSOLETE thread_saved_exception_port); +// OBSOLETE CHK ("Restoring stepped thread's exception port", ret); +// OBSOLETE +// OBSOLETE if (MACH_PORT_VALID (thread_saved_exception_port)) +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), +// OBSOLETE thread_saved_exception_port); +// OBSOLETE +// OBSOLETE thread_trace (thread, FALSE); +// OBSOLETE +// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL; +// OBSOLETE currently_waiting_for = inferior_wait_port_set; +// OBSOLETE if (cleanup_step) +// OBSOLETE discard_cleanups (cleanup_step); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE static +// OBSOLETE request_notify (mach_port_t name, mach_msg_id_t variant, int type) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE mach_port_t previous_port_dummy = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (name)) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (port_chain_member (notify_chain, name)) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE ret = mach_port_request_notification (mach_task_self (), +// OBSOLETE name, +// OBSOLETE variant, +// OBSOLETE 1, +// OBSOLETE our_notify_port, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE, +// OBSOLETE &previous_port_dummy); +// OBSOLETE CHK ("Serious: request_notify failed", ret); +// OBSOLETE +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), +// OBSOLETE previous_port_dummy); +// OBSOLETE +// OBSOLETE notify_chain = port_chain_insert (notify_chain, name, type); +// OBSOLETE } +// OBSOLETE +// OBSOLETE reverse_msg_bits (mach_msg_header_t *msgp, int type) +// OBSOLETE { +// OBSOLETE int rbits, lbits; +// OBSOLETE rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits); +// OBSOLETE lbits = type; +// OBSOLETE msgp->msgh_bits = +// OBSOLETE (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) | +// OBSOLETE MACH_MSGH_BITS (lbits, rbits); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* On the third day He said: +// OBSOLETE +// OBSOLETE Let this be global +// OBSOLETE and then it was global. +// OBSOLETE +// OBSOLETE When creating the inferior fork, the +// OBSOLETE child code in inflow.c sets the name of the +// OBSOLETE bootstrap_port in its address space to this +// OBSOLETE variable. +// OBSOLETE +// OBSOLETE The name is transferred to our address space +// OBSOLETE with mach3_read_inferior(). +// OBSOLETE +// OBSOLETE Thou shalt not do this with +// OBSOLETE task_get_bootstrap_port() in this task, since +// OBSOLETE the name in the inferior task is different than +// OBSOLETE the one we get. +// OBSOLETE +// OBSOLETE For blessed are the meek, as they shall inherit +// OBSOLETE the address space. +// OBSOLETE */ +// OBSOLETE mach_port_t original_server_port_name = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Called from inferior after FORK but before EXEC */ +// OBSOLETE static void +// OBSOLETE m3_trace_me (void) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE /* Get the NAME of the bootstrap port in this task +// OBSOLETE so that GDB can read it */ +// OBSOLETE ret = task_get_bootstrap_port (mach_task_self (), +// OBSOLETE &original_server_port_name); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), +// OBSOLETE original_server_port_name); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); +// OBSOLETE +// OBSOLETE /* Suspend this task to let the parent change my ports. +// OBSOLETE Resumed by the debugger */ +// OBSOLETE ret = task_suspend (mach_task_self ()); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Intercept system calls to Unix server. +// OBSOLETE * After EXEC_COUNTER calls to exec(), return. +// OBSOLETE * +// OBSOLETE * Pre-assertion: Child is suspended. (Not verified) +// OBSOLETE * Post-condition: Child is suspended after EXEC_COUNTER exec() calls. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE intercept_exec_calls (int exec_counter) +// OBSOLETE { +// OBSOLETE int terminal_initted = 0; +// OBSOLETE +// OBSOLETE struct syscall_msg_t +// OBSOLETE { +// OBSOLETE mach_msg_header_t header; +// OBSOLETE mach_msg_type_t type; +// OBSOLETE char room[2000]; /* Enuff space */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE struct syscall_msg_t syscall_in, syscall_out; +// OBSOLETE +// OBSOLETE mach_port_t fake_server; +// OBSOLETE mach_port_t original_server_send; +// OBSOLETE mach_port_t original_exec_reply; +// OBSOLETE mach_port_t exec_reply; +// OBSOLETE mach_port_t exec_reply_send; +// OBSOLETE mach_msg_type_name_t acquired; +// OBSOLETE mach_port_t emulator_server_port_name; +// OBSOLETE struct task_basic_info info; +// OBSOLETE mach_msg_type_number_t info_count; +// OBSOLETE +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (exec_counter <= 0) +// OBSOLETE return; /* We are already set up in the correct program */ +// OBSOLETE +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &fake_server); +// OBSOLETE CHK ("create inferior_fake_server port failed", ret); +// OBSOLETE +// OBSOLETE /* Wait for inferior_task to suspend itself */ +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE info_count = sizeof (info); +// OBSOLETE ret = task_info (inferior_task, +// OBSOLETE TASK_BASIC_INFO, +// OBSOLETE (task_info_t) & info, +// OBSOLETE &info_count); +// OBSOLETE CHK ("Task info", ret); +// OBSOLETE +// OBSOLETE if (info.suspend_count) +// OBSOLETE break; +// OBSOLETE +// OBSOLETE /* Note that the definition of the parameter was undefined +// OBSOLETE * at the time of this writing, so I just use an `ad hoc' value. +// OBSOLETE */ +// OBSOLETE (void) swtch_pri (42); /* Universal Priority Value */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read the inferior's bootstrap port name */ +// OBSOLETE if (!mach3_read_inferior (&original_server_port_name, +// OBSOLETE &original_server_port_name, +// OBSOLETE sizeof (original_server_port_name))) +// OBSOLETE error ("Can't read inferior task bootstrap port name"); +// OBSOLETE +// OBSOLETE /* @@ BUG: If more than 1 send right GDB will FAIL!!! */ +// OBSOLETE /* Should get refs, and set them back when restoring */ +// OBSOLETE /* Steal the original bsd server send right from inferior */ +// OBSOLETE ret = mach_port_extract_right (inferior_task, +// OBSOLETE original_server_port_name, +// OBSOLETE MACH_MSG_TYPE_MOVE_SEND, +// OBSOLETE &original_server_send, +// OBSOLETE &acquired); +// OBSOLETE CHK ("mach_port_extract_right (bsd server send)", ret); +// OBSOLETE +// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND) +// OBSOLETE error ("Incorrect right extracted, send right to bsd server expected"); +// OBSOLETE +// OBSOLETE ret = mach_port_insert_right (inferior_task, +// OBSOLETE original_server_port_name, +// OBSOLETE fake_server, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); +// OBSOLETE CHK ("mach_port_insert_right (fake server send)", ret); +// OBSOLETE +// OBSOLETE xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n", +// OBSOLETE fake_server, +// OBSOLETE original_server_port_name, original_server_send); +// OBSOLETE +// OBSOLETE /* A receive right to the reply generated by unix server exec() request */ +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &exec_reply); +// OBSOLETE CHK ("create intercepted_reply_port port failed", ret); +// OBSOLETE +// OBSOLETE /* Pass this send right to Unix server so it replies to us after exec() */ +// OBSOLETE ret = mach_port_extract_right (mach_task_self (), +// OBSOLETE exec_reply, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE, +// OBSOLETE &exec_reply_send, +// OBSOLETE &acquired); +// OBSOLETE CHK ("mach_port_extract_right (exec_reply)", ret); +// OBSOLETE +// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE) +// OBSOLETE error ("Incorrect right extracted, send once expected for exec reply"); +// OBSOLETE +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE fake_server, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE CHK ("Moving fake syscall port to inferior_wait_port_set", ret); +// OBSOLETE +// OBSOLETE xx_debug ("syscall fake server set up, resuming inferior\n"); +// OBSOLETE +// OBSOLETE ret = task_resume (inferior_task); +// OBSOLETE CHK ("task_resume (startup)", ret); +// OBSOLETE +// OBSOLETE /* Read requests from the inferior. +// OBSOLETE Pass directly through everything else except exec() calls. +// OBSOLETE */ +// OBSOLETE while (exec_counter > 0) +// OBSOLETE { +// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */ +// OBSOLETE MACH_RCV_MSG, /* options */ +// OBSOLETE 0, /* send size */ +// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */ +// OBSOLETE inferior_wait_port_set, /* receive_name */ +// OBSOLETE MACH_MSG_TIMEOUT_NONE, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE CHK ("mach_msg (intercepted sycall)", ret); +// OBSOLETE +// OBSOLETE #ifdef DUMP_SYSCALL +// OBSOLETE print_msg (&syscall_in.header); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* ASSERT : msgh_local_port == fake_server */ +// OBSOLETE +// OBSOLETE if (notify_server (&syscall_in.header, &syscall_out.header)) +// OBSOLETE error ("received a notify while intercepting syscalls"); +// OBSOLETE +// OBSOLETE if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID) +// OBSOLETE { +// OBSOLETE xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter); +// OBSOLETE if (exec_counter == 1) +// OBSOLETE { +// OBSOLETE original_exec_reply = syscall_in.header.msgh_remote_port; +// OBSOLETE syscall_in.header.msgh_remote_port = exec_reply_send; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!terminal_initted) +// OBSOLETE { +// OBSOLETE /* Now that the child has exec'd we know it has already set its +// OBSOLETE process group. On POSIX systems, tcsetpgrp will fail with +// OBSOLETE EPERM if we try it before the child's setpgid. */ +// OBSOLETE +// OBSOLETE /* Set up the "saved terminal modes" of the inferior +// OBSOLETE based on what modes we are starting it with. */ +// OBSOLETE target_terminal_init (); +// OBSOLETE +// OBSOLETE /* Install inferior's terminal modes. */ +// OBSOLETE target_terminal_inferior (); +// OBSOLETE +// OBSOLETE terminal_initted = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE exec_counter--; +// OBSOLETE } +// OBSOLETE +// OBSOLETE syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port; +// OBSOLETE syscall_in.header.msgh_remote_port = original_server_send; +// OBSOLETE +// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_COPY_SEND); +// OBSOLETE +// OBSOLETE ret = mach_msg_send (&syscall_in.header); +// OBSOLETE CHK ("Forwarded syscall", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE fake_server, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE CHK ("Moving fake syscall out of inferior_wait_port_set", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE exec_reply, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE CHK ("Moving exec_reply to inferior_wait_port_set", ret); +// OBSOLETE +// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */ +// OBSOLETE MACH_RCV_MSG, /* options */ +// OBSOLETE 0, /* send size */ +// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */ +// OBSOLETE inferior_wait_port_set, /* receive_name */ +// OBSOLETE MACH_MSG_TIMEOUT_NONE, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE CHK ("mach_msg (exec reply)", ret); +// OBSOLETE +// OBSOLETE ret = task_suspend (inferior_task); +// OBSOLETE CHK ("Suspending inferior after last exec", ret); +// OBSOLETE +// OBSOLETE must_suspend_thread = 0; +// OBSOLETE +// OBSOLETE xx_debug ("Received exec reply from bsd server, suspended inferior task\n"); +// OBSOLETE +// OBSOLETE #ifdef DUMP_SYSCALL +// OBSOLETE print_msg (&syscall_in.header); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Message should appear as if it came from the unix server */ +// OBSOLETE syscall_in.header.msgh_local_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE /* and go to the inferior task original reply port */ +// OBSOLETE syscall_in.header.msgh_remote_port = original_exec_reply; +// OBSOLETE +// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE); +// OBSOLETE +// OBSOLETE ret = mach_msg_send (&syscall_in.header); +// OBSOLETE CHK ("Forwarding exec reply to inferior", ret); +// OBSOLETE +// OBSOLETE /* Garbage collect */ +// OBSOLETE ret = mach_port_deallocate (inferior_task, +// OBSOLETE original_server_port_name); +// OBSOLETE CHK ("deallocating fake server send right", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_insert_right (inferior_task, +// OBSOLETE original_server_port_name, +// OBSOLETE original_server_send, +// OBSOLETE MACH_MSG_TYPE_MOVE_SEND); +// OBSOLETE CHK ("Restoring the original bsd server send right", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_destroy (mach_task_self (), +// OBSOLETE fake_server); +// OBSOLETE fake_server = MACH_PORT_DEAD; +// OBSOLETE CHK ("mach_port_destroy (fake_server)", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_destroy (mach_task_self (), +// OBSOLETE exec_reply); +// OBSOLETE exec_reply = MACH_PORT_DEAD; +// OBSOLETE CHK ("mach_port_destroy (exec_reply)", ret); +// OBSOLETE +// OBSOLETE xx_debug ("Done with exec call interception\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE consume_send_rights (thread_array_t thread_list, int thread_count) +// OBSOLETE { +// OBSOLETE int index; +// OBSOLETE +// OBSOLETE if (!thread_count) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE /* Since thread kill command kills threads, don't check ret */ +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), +// OBSOLETE thread_list[index]); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* suspend/abort/resume a thread. */ +// OBSOLETE setup_thread (mach_port_t thread, int what) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (what) +// OBSOLETE { +// OBSOLETE ret = thread_suspend (thread); +// OBSOLETE CHK ("setup_thread thread_suspend", ret); +// OBSOLETE +// OBSOLETE ret = thread_abort (thread); +// OBSOLETE CHK ("setup_thread thread_abort", ret); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE ret = thread_resume (thread); +// OBSOLETE CHK ("setup_thread thread_resume", ret); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE map_slot_to_mid (int slot, thread_array_t threads, int thread_count) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE int deallocate = 0; +// OBSOLETE int index; +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE if (!threads) +// OBSOLETE { +// OBSOLETE deallocate++; +// OBSOLETE ret = task_threads (inferior_task, &threads, &thread_count); +// OBSOLETE CHK ("Can not select a thread from a dead task", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (slot < 0 || slot >= thread_count) +// OBSOLETE { +// OBSOLETE if (deallocate) +// OBSOLETE { +// OBSOLETE consume_send_rights (threads, thread_count); +// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE } +// OBSOLETE if (slot < 0) +// OBSOLETE error ("invalid slot number"); +// OBSOLETE else +// OBSOLETE return -(slot + 1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (threads[slot], MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE if (deallocate) +// OBSOLETE { +// OBSOLETE consume_send_rights (threads, thread_count); +// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static int +// OBSOLETE parse_thread_id (char *arg, int thread_count, int slots) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE int mid; +// OBSOLETE int slot; +// OBSOLETE int index; +// OBSOLETE +// OBSOLETE if (arg == 0) +// OBSOLETE return 0; +// OBSOLETE +// OBSOLETE while (*arg && (*arg == ' ' || *arg == '\t')) +// OBSOLETE arg++; +// OBSOLETE +// OBSOLETE if (!*arg) +// OBSOLETE return 0; +// OBSOLETE +// OBSOLETE /* Currently parse MID and @SLOTNUMBER */ +// OBSOLETE if (*arg != '@') +// OBSOLETE { +// OBSOLETE mid = atoi (arg); +// OBSOLETE if (mid <= 0) +// OBSOLETE error ("valid thread mid expected"); +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE arg++; +// OBSOLETE slot = atoi (arg); +// OBSOLETE +// OBSOLETE if (slot < 0) +// OBSOLETE error ("invalid slot number"); +// OBSOLETE +// OBSOLETE /* If you want slot numbers to remain slot numbers, set slots. +// OBSOLETE +// OBSOLETE * Well, since 0 is reserved, return the ordinal number +// OBSOLETE * of the thread rather than the slot number. Awk, this +// OBSOLETE * counts as a kludge. +// OBSOLETE */ +// OBSOLETE if (slots) +// OBSOLETE return -(slot + 1); +// OBSOLETE +// OBSOLETE if (thread_count && slot >= thread_count) +// OBSOLETE return -(slot + 1); +// OBSOLETE +// OBSOLETE mid = map_slot_to_mid (slot); +// OBSOLETE +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* THREAD_ID 0 is special; it selects the first kernel +// OBSOLETE * thread from the list (i.e. SLOTNUMBER 0) +// OBSOLETE * This is used when starting the program with 'run' or when attaching. +// OBSOLETE * +// OBSOLETE * If FLAG is 0 the context is not changed, and the registers, frame, etc +// OBSOLETE * will continue to describe the old thread. +// OBSOLETE * +// OBSOLETE * If FLAG is nonzero, really select the thread. +// OBSOLETE * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid. +// OBSOLETE * +// OBSOLETE */ +// OBSOLETE kern_return_t +// OBSOLETE select_thread (mach_port_t task, int thread_id, int flag) +// OBSOLETE { +// OBSOLETE thread_array_t thread_list; +// OBSOLETE int thread_count; +// OBSOLETE kern_return_t ret; +// OBSOLETE int index; +// OBSOLETE thread_t new_thread = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE if (thread_id < 0) +// OBSOLETE error ("Can't select cprocs without kernel thread"); +// OBSOLETE +// OBSOLETE ret = task_threads (task, &thread_list, &thread_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Can not select a thread from a dead task"); +// OBSOLETE m3_kill_inferior (); +// OBSOLETE return KERN_FAILURE; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (thread_count == 0) +// OBSOLETE { +// OBSOLETE /* The task can not do anything anymore, but it still +// OBSOLETE * exists as a container for memory and ports. +// OBSOLETE */ +// OBSOLETE registers_changed (); +// OBSOLETE warning ("Task %d has no threads", +// OBSOLETE map_port_name_to_mid (task, MACH_TYPE_TASK)); +// OBSOLETE current_thread = MACH_PORT_NULL; +// OBSOLETE (void) vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE return KERN_FAILURE; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!thread_id || flag == 2) +// OBSOLETE { +// OBSOLETE /* First thread or a slotnumber */ +// OBSOLETE if (!thread_id) +// OBSOLETE new_thread = thread_list[0]; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (thread_id < thread_count) +// OBSOLETE new_thread = thread_list[thread_id]; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE (void) vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE error ("No such thread slot number : %d", thread_id); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE if (thread_id == map_port_name_to_mid (thread_list[index], +// OBSOLETE MACH_TYPE_THREAD)) +// OBSOLETE { +// OBSOLETE new_thread = thread_list[index]; +// OBSOLETE index = -1; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (index != -1) +// OBSOLETE error ("No thread with mid %d", thread_id); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Notify when the selected thread dies */ +// OBSOLETE request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE ret = vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE CHK ("vm_deallocate", ret); +// OBSOLETE +// OBSOLETE if (!flag) +// OBSOLETE current_thread = new_thread; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE #if 0 +// OBSOLETE if (MACH_PORT_VALID (current_thread)) +// OBSOLETE { +// OBSOLETE /* Store the gdb's view of the thread we are deselecting +// OBSOLETE +// OBSOLETE * @@ I think gdb updates registers immediately when they are +// OBSOLETE * changed, so don't do this. +// OBSOLETE */ +// OBSOLETE ret = thread_abort (current_thread); +// OBSOLETE CHK ("Could not abort system calls when saving state of old thread", +// OBSOLETE ret); +// OBSOLETE target_prepare_to_store (); +// OBSOLETE target_store_registers (-1); +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE registers_changed (); +// OBSOLETE +// OBSOLETE current_thread = new_thread; +// OBSOLETE +// OBSOLETE ret = thread_abort (current_thread); +// OBSOLETE CHK ("Could not abort system calls when selecting a thread", ret); +// OBSOLETE +// OBSOLETE stop_pc = read_pc (); +// OBSOLETE flush_cached_frames (); +// OBSOLETE +// OBSOLETE select_frame (get_current_frame ()); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Switch to use thread named NEW_THREAD. +// OBSOLETE * Return it's MID +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE switch_to_thread (thread_t new_thread) +// OBSOLETE { +// OBSOLETE thread_t saved_thread = current_thread; +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (new_thread, +// OBSOLETE MACH_TYPE_THREAD); +// OBSOLETE if (mid == -1) +// OBSOLETE warning ("Can't map thread name 0x%x to mid", new_thread); +// OBSOLETE else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE if (current_thread) +// OBSOLETE current_thread = saved_thread; +// OBSOLETE error ("Could not select thread %d", mid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Do this in gdb after doing FORK but before STARTUP_INFERIOR. +// OBSOLETE * Note that the registers are not yet valid in the inferior task. +// OBSOLETE */ +// OBSOLETE static int +// OBSOLETE m3_trace_him (int pid) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE push_target (&m3_ops); +// OBSOLETE +// OBSOLETE inferior_task = task_by_pid (pid); +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) +// OBSOLETE error ("Can not map Unix pid %d to Mach task", pid); +// OBSOLETE +// OBSOLETE /* Clean up previous notifications and create new ones */ +// OBSOLETE setup_notify_port (1); +// OBSOLETE +// OBSOLETE /* When notification appears, the inferior task has died */ +// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE emulator_present = have_emulator_p (inferior_task); +// OBSOLETE +// OBSOLETE /* By default, select the first thread, +// OBSOLETE * If task has no threads, gives a warning +// OBSOLETE * Does not fetch registers, since they are not yet valid. +// OBSOLETE */ +// OBSOLETE select_thread (inferior_task, 0, 0); +// OBSOLETE +// OBSOLETE inferior_exception_port = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE setup_exception_port (); +// OBSOLETE +// OBSOLETE xx_debug ("Now the debugged task is created\n"); +// OBSOLETE +// OBSOLETE /* One trap to exec the shell, one to exec the program being debugged. */ +// OBSOLETE intercept_exec_calls (2); +// OBSOLETE +// OBSOLETE return pid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE setup_exception_port (void) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &inferior_exception_port); +// OBSOLETE CHK ("mach_port_allocate", ret); +// OBSOLETE +// OBSOLETE /* add send right */ +// OBSOLETE ret = mach_port_insert_right (mach_task_self (), +// OBSOLETE inferior_exception_port, +// OBSOLETE inferior_exception_port, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); +// OBSOLETE CHK ("mach_port_insert_right", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE inferior_exception_port, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE CHK ("mach_port_move_member", ret); +// OBSOLETE +// OBSOLETE ret = task_get_special_port (inferior_task, +// OBSOLETE TASK_EXCEPTION_PORT, +// OBSOLETE &inferior_old_exception_port); +// OBSOLETE CHK ("task_get_special_port(old exc)", ret); +// OBSOLETE +// OBSOLETE ret = task_set_special_port (inferior_task, +// OBSOLETE TASK_EXCEPTION_PORT, +// OBSOLETE inferior_exception_port); +// OBSOLETE CHK ("task_set_special_port", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), +// OBSOLETE inferior_exception_port); +// OBSOLETE CHK ("mack_port_deallocate", ret); +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* When notify appears, the inferior_task's exception +// OBSOLETE * port has been destroyed. +// OBSOLETE * +// OBSOLETE * Not used, since the dead_name_notification already +// OBSOLETE * appears when task dies. +// OBSOLETE * +// OBSOLETE */ +// OBSOLETE request_notify (inferior_exception_port, +// OBSOLETE MACH_NOTIFY_NO_SENDERS, +// OBSOLETE MACH_TYPE_EXCEPTION_PORT); +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Nonzero if gdb is waiting for a message */ +// OBSOLETE int mach_really_waiting; +// OBSOLETE +// OBSOLETE /* Wait for the inferior to stop for some reason. +// OBSOLETE - Loop on notifications until inferior_task dies. +// OBSOLETE - Loop on exceptions until stopped_in_exception comes true. +// OBSOLETE (e.g. we receive a single step trace trap) +// OBSOLETE - a message arrives to gdb's message port +// OBSOLETE +// OBSOLETE There is no other way to exit this loop. +// OBSOLETE +// OBSOLETE Returns the inferior_ptid for rest of gdb. +// OBSOLETE Side effects: Set *OURSTATUS. */ +// OBSOLETE ptid_t +// OBSOLETE mach_really_wait (ptid_t ptid, struct target_waitstatus *ourstatus) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE int w; +// OBSOLETE +// OBSOLETE struct msg +// OBSOLETE { +// OBSOLETE mach_msg_header_t header; +// OBSOLETE mach_msg_type_t foo; +// OBSOLETE int data[8000]; +// OBSOLETE } +// OBSOLETE in_msg, out_msg; +// OBSOLETE +// OBSOLETE /* Either notify (death), exception or message can stop the inferior */ +// OBSOLETE stopped_in_exception = FALSE; +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE QUIT; +// OBSOLETE +// OBSOLETE stop_exception = stop_code = stop_subcode = -1; +// OBSOLETE stop_thread = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE mach_really_waiting = 1; +// OBSOLETE ret = mach_msg (&in_msg.header, /* header */ +// OBSOLETE MACH_RCV_MSG, /* options */ +// OBSOLETE 0, /* send size */ +// OBSOLETE sizeof (struct msg), /* receive size */ +// OBSOLETE currently_waiting_for, /* receive name */ +// OBSOLETE MACH_MSG_TIMEOUT_NONE, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE mach_really_waiting = 0; +// OBSOLETE CHK ("mach_msg (receive)", ret); +// OBSOLETE +// OBSOLETE /* Check if we received a notify of the childs' death */ +// OBSOLETE if (notify_server (&in_msg.header, &out_msg.header)) +// OBSOLETE { +// OBSOLETE /* If inferior_task is null then the inferior has +// OBSOLETE gone away and we want to return to command level. +// OBSOLETE Otherwise it was just an informative message and we +// OBSOLETE need to look to see if there are any more. */ +// OBSOLETE if (inferior_task != MACH_PORT_NULL) +// OBSOLETE continue; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* Collect Unix exit status for gdb */ +// OBSOLETE +// OBSOLETE wait3 (&w, WNOHANG, 0); +// OBSOLETE +// OBSOLETE /* This mess is here to check that the rest of +// OBSOLETE * gdb knows that the inferior died. It also +// OBSOLETE * tries to hack around the fact that Mach 3.0 (mk69) +// OBSOLETE * unix server (ux28) does not always know what +// OBSOLETE * has happened to it's children when mach-magic +// OBSOLETE * is applied on them. +// OBSOLETE */ +// OBSOLETE if ((!WIFEXITED (w) && WIFSTOPPED (w)) || +// OBSOLETE (WIFEXITED (w) && WEXITSTATUS (w) > 0377)) +// OBSOLETE { +// OBSOLETE WSETEXIT (w, 0); +// OBSOLETE warning ("Using exit value 0 for terminated task"); +// OBSOLETE } +// OBSOLETE else if (!WIFEXITED (w)) +// OBSOLETE { +// OBSOLETE int sig = WTERMSIG (w); +// OBSOLETE +// OBSOLETE /* Signals cause problems. Warn the user. */ +// OBSOLETE if (sig != SIGKILL) /* Bad luck if garbage matches this */ +// OBSOLETE warning ("The terminating signal stuff may be nonsense"); +// OBSOLETE else if (sig > NSIG) +// OBSOLETE { +// OBSOLETE WSETEXIT (w, 0); +// OBSOLETE warning ("Using exit value 0 for terminated task"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE store_waitstatus (ourstatus, w); +// OBSOLETE return inferior_ptid; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Hmm. Check for exception, as it was not a notification. +// OBSOLETE exc_server() does an upcall to catch_exception_raise() +// OBSOLETE if this rpc is an exception. Further actions are decided +// OBSOLETE there. +// OBSOLETE */ +// OBSOLETE if (!exc_server (&in_msg.header, &out_msg.header)) +// OBSOLETE { +// OBSOLETE +// OBSOLETE /* Not an exception, check for message. +// OBSOLETE +// OBSOLETE * Messages don't come from the inferior, or if they +// OBSOLETE * do they better be asynchronous or it will hang. +// OBSOLETE */ +// OBSOLETE if (gdb_message_server (&in_msg.header)) +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE error ("Unrecognized message received in mach_really_wait"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Send the reply of the exception rpc to the suspended task */ +// OBSOLETE ret = mach_msg_send (&out_msg.header); +// OBSOLETE CHK ("mach_msg_send (exc reply)", ret); +// OBSOLETE +// OBSOLETE if (stopped_in_exception) +// OBSOLETE { +// OBSOLETE /* Get unix state. May be changed in mach3_exception_actions() */ +// OBSOLETE wait3 (&w, WNOHANG, 0); +// OBSOLETE +// OBSOLETE mach3_exception_actions (&w, FALSE, "Task"); +// OBSOLETE +// OBSOLETE store_waitstatus (ourstatus, w); +// OBSOLETE return inferior_ptid; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Called by macro DO_QUIT() in utils.c(quit). +// OBSOLETE * This is called just before calling error() to return to command level +// OBSOLETE */ +// OBSOLETE void +// OBSOLETE mach3_quit (void) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (mach_really_waiting) +// OBSOLETE { +// OBSOLETE ret = task_suspend (inferior_task); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Could not suspend task for interrupt: %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE mach_really_waiting = 0; +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE must_suspend_thread = 0; +// OBSOLETE mach_really_waiting = 0; +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); +// OBSOLETE if (mid == -1) +// OBSOLETE { +// OBSOLETE warning ("Selecting first existing kernel thread"); +// OBSOLETE mid = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE current_thread = MACH_PORT_NULL; /* Force setup */ +// OBSOLETE select_thread (inferior_task, mid, 1); +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* bogus bogus bogus. It is NOT OK to quit out of target_wait. */ +// OBSOLETE +// OBSOLETE /* If ^C is typed when we are waiting for a message +// OBSOLETE * and your Unix server is able to notice that we +// OBSOLETE * should quit now. +// OBSOLETE * +// OBSOLETE * Called by REQUEST_QUIT() from utils.c(request_quit) +// OBSOLETE */ +// OBSOLETE void +// OBSOLETE mach3_request_quit (void) +// OBSOLETE { +// OBSOLETE if (mach_really_waiting) +// OBSOLETE immediate_quit = 1; +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Gdb message server. +// OBSOLETE * Currently implemented is the STOP message, that causes +// OBSOLETE * gdb to return to the command level like ^C had been typed from terminal. +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE gdb_message_server (mach_msg_header_t *InP) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE if (InP->msgh_local_port == our_message_port) +// OBSOLETE { +// OBSOLETE /* A message coming to our_message_port. Check validity */ +// OBSOLETE switch (InP->msgh_id) +// OBSOLETE { +// OBSOLETE +// OBSOLETE case GDB_MESSAGE_ID_STOP: +// OBSOLETE ret = task_suspend (inferior_task); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("Could not suspend task for stop message: %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE +// OBSOLETE /* QUIT in mach_really_wait() loop. */ +// OBSOLETE request_quit (0); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE warning ("Invalid message id %d received, ignored.", +// OBSOLETE InP->msgh_id); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Message not handled by this server */ +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* NOTE: This is not an RPC call. It is a simpleroutine. +// OBSOLETE +// OBSOLETE * This is not called from this gdb code. +// OBSOLETE * +// OBSOLETE * It may be called by another debugger to cause this +// OBSOLETE * debugger to enter command level: +// OBSOLETE * +// OBSOLETE * (gdb) set stop_inferior_gdb () +// OBSOLETE * (gdb) continue +// OBSOLETE * +// OBSOLETE * External program "stop-gdb" implements this also. +// OBSOLETE */ +// OBSOLETE void +// OBSOLETE stop_inferior_gdb (void) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE /* Code generated by mig, with minor cleanups :-) +// OBSOLETE +// OBSOLETE * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t); +// OBSOLETE */ +// OBSOLETE +// OBSOLETE typedef struct +// OBSOLETE { +// OBSOLETE mach_msg_header_t Head; +// OBSOLETE } +// OBSOLETE Request; +// OBSOLETE +// OBSOLETE Request Mess; +// OBSOLETE +// OBSOLETE register Request *InP = &Mess; +// OBSOLETE +// OBSOLETE InP->Head.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0); +// OBSOLETE +// OBSOLETE /* msgh_size passed as argument */ +// OBSOLETE InP->Head.msgh_remote_port = our_message_port; +// OBSOLETE InP->Head.msgh_local_port = MACH_PORT_NULL; +// OBSOLETE InP->Head.msgh_seqno = 0; +// OBSOLETE InP->Head.msgh_id = GDB_MESSAGE_ID_STOP; +// OBSOLETE +// OBSOLETE ret = mach_msg (&InP->Head, +// OBSOLETE MACH_SEND_MSG | MACH_MSG_OPTION_NONE, +// OBSOLETE sizeof (Request), +// OBSOLETE 0, +// OBSOLETE MACH_PORT_NULL, +// OBSOLETE MACH_MSG_TIMEOUT_NONE, +// OBSOLETE MACH_PORT_NULL); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef THREAD_ALLOWED_TO_BREAK +// OBSOLETE /* +// OBSOLETE * Return 1 if the MID specifies the thread that caused the +// OBSOLETE * last exception. +// OBSOLETE * Since catch_exception_raise() selects the thread causing +// OBSOLETE * the last exception to current_thread, we just check that +// OBSOLETE * it is selected and the last exception was a breakpoint. +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE mach_thread_for_breakpoint (int mid) +// OBSOLETE { +// OBSOLETE int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE if (mid < 0) +// OBSOLETE { +// OBSOLETE mid = map_slot_to_mid (-(mid + 1), 0, 0); +// OBSOLETE if (mid < 0) +// OBSOLETE return 0; /* Don't stop, no such slot */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!mid || cmid == -1) +// OBSOLETE return 1; /* stop */ +// OBSOLETE +// OBSOLETE return cmid == mid && stop_exception == EXC_BREAKPOINT; +// OBSOLETE } +// OBSOLETE #endif /* THREAD_ALLOWED_TO_BREAK */ +// OBSOLETE +// OBSOLETE #ifdef THREAD_PARSE_ID +// OBSOLETE /* +// OBSOLETE * Map a thread id string (MID or a @SLOTNUMBER) +// OBSOLETE * to a thread-id. +// OBSOLETE * +// OBSOLETE * 0 matches all threads. +// OBSOLETE * Otherwise the meaning is defined only in this file. +// OBSOLETE * (mach_thread_for_breakpoint uses it) +// OBSOLETE * +// OBSOLETE * @@ This allows non-existent MIDs to be specified. +// OBSOLETE * It now also allows non-existent slots to be +// OBSOLETE * specified. (Slot numbers stored are negative, +// OBSOLETE * and the magnitude is one greater than the actual +// OBSOLETE * slot index. (Since 0 is reserved)) +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE mach_thread_parse_id (char *arg) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE if (arg == 0) +// OBSOLETE error ("thread id expected"); +// OBSOLETE mid = parse_thread_id (arg, 0, 1); +// OBSOLETE +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE #endif /* THREAD_PARSE_ID */ +// OBSOLETE +// OBSOLETE #ifdef THREAD_OUTPUT_ID +// OBSOLETE char * +// OBSOLETE mach_thread_output_id (int mid) +// OBSOLETE { +// OBSOLETE static char foobar[20]; +// OBSOLETE +// OBSOLETE if (mid > 0) +// OBSOLETE sprintf (foobar, "mid %d", mid); +// OBSOLETE else if (mid < 0) +// OBSOLETE sprintf (foobar, "@%d", -(mid + 1)); +// OBSOLETE else +// OBSOLETE sprintf (foobar, "*any thread*"); +// OBSOLETE +// OBSOLETE return foobar; +// OBSOLETE } +// OBSOLETE #endif /* THREAD_OUTPUT_ID */ +// OBSOLETE +// OBSOLETE /* Called with hook PREPARE_TO_PROCEED() from infrun.c. +// OBSOLETE +// OBSOLETE * If we have switched threads and stopped at breakpoint return 1 otherwise 0. +// OBSOLETE * +// OBSOLETE * if SELECT_IT is nonzero, reselect the thread that was active when +// OBSOLETE * we stopped at a breakpoint. +// OBSOLETE * +// OBSOLETE * Note that this implementation is potentially redundant now that +// OBSOLETE * default_prepare_to_proceed() has been added. +// OBSOLETE * +// OBSOLETE * FIXME This may not support switching threads after Ctrl-C +// OBSOLETE * correctly. The default implementation does support this. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE mach3_prepare_to_proceed (int select_it) +// OBSOLETE { +// OBSOLETE if (stop_thread && +// OBSOLETE stop_thread != current_thread && +// OBSOLETE stop_exception == EXC_BREAKPOINT) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE if (!select_it) +// OBSOLETE return 1; +// OBSOLETE +// OBSOLETE mid = switch_to_thread (stop_thread); +// OBSOLETE +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* this stuff here is an upcall via libmach/excServer.c +// OBSOLETE and mach_really_wait which does the actual upcall. +// OBSOLETE +// OBSOLETE The code will pass the exception to the inferior if: +// OBSOLETE +// OBSOLETE - The task that signaled is not the inferior task +// OBSOLETE (e.g. when debugging another debugger) +// OBSOLETE +// OBSOLETE - The user has explicitely requested to pass on the exceptions. +// OBSOLETE (e.g to the default unix exception handler, which maps +// OBSOLETE exceptions to signals, or the user has her own exception handler) +// OBSOLETE +// OBSOLETE - If the thread that signaled is being single-stepped and it +// OBSOLETE has set it's own exception port and the exception is not +// OBSOLETE EXC_BREAKPOINT. (Maybe this is not desirable?) +// OBSOLETE */ +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE catch_exception_raise (mach_port_t port, thread_t thread, task_t task, +// OBSOLETE int exception, int code, int subcode) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE boolean_t signal_thread; +// OBSOLETE int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (thread)) +// OBSOLETE { +// OBSOLETE /* If the exception was sent and thread dies before we +// OBSOLETE receive it, THREAD will be MACH_PORT_DEAD +// OBSOLETE */ +// OBSOLETE +// OBSOLETE current_thread = thread = MACH_PORT_NULL; +// OBSOLETE error ("Received exception from nonexistent thread"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Check if the task died in transit. +// OBSOLETE * @@ Isn't the thread also invalid in such case? +// OBSOLETE */ +// OBSOLETE if (!MACH_PORT_VALID (task)) +// OBSOLETE { +// OBSOLETE current_thread = thread = MACH_PORT_NULL; +// OBSOLETE error ("Received exception from nonexistent task"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (exception < 0 || exception > MAX_EXCEPTION) +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "catch_exception_raise: unknown exception code %d thread %d", +// OBSOLETE exception, +// OBSOLETE mid); +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) +// OBSOLETE error ("got an exception, but inferior_task is null or dead"); +// OBSOLETE +// OBSOLETE stop_exception = exception; +// OBSOLETE stop_code = code; +// OBSOLETE stop_subcode = subcode; +// OBSOLETE stop_thread = thread; +// OBSOLETE +// OBSOLETE signal_thread = exception != EXC_BREAKPOINT && +// OBSOLETE port == singlestepped_thread_port && +// OBSOLETE MACH_PORT_VALID (thread_saved_exception_port); +// OBSOLETE +// OBSOLETE /* If it was not our inferior or if we want to forward +// OBSOLETE * the exception to the inferior's handler, do it here +// OBSOLETE * +// OBSOLETE * Note: If you have forwarded EXC_BREAKPOINT I trust you know why. +// OBSOLETE */ +// OBSOLETE if (task != inferior_task || +// OBSOLETE signal_thread || +// OBSOLETE exception_map[exception].forward) +// OBSOLETE { +// OBSOLETE mach_port_t eport = inferior_old_exception_port; +// OBSOLETE +// OBSOLETE if (signal_thread) +// OBSOLETE { +// OBSOLETE /* +// OBSOLETE GDB now forwards the exeption to thread's original handler, +// OBSOLETE since the user propably knows what he is doing. +// OBSOLETE Give a message, though. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE mach3_exception_actions ((WAITTYPE *) NULL, TRUE, "Thread"); +// OBSOLETE eport = thread_saved_exception_port; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Send the exception to the original handler */ +// OBSOLETE ret = exception_raise (eport, +// OBSOLETE thread, +// OBSOLETE task, +// OBSOLETE exception, +// OBSOLETE code, +// OBSOLETE subcode); +// OBSOLETE +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task); +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread); +// OBSOLETE +// OBSOLETE /* If we come here, we don't want to trace any more, since we +// OBSOLETE * will never stop for tracing anyway. +// OBSOLETE */ +// OBSOLETE discard_single_step (thread); +// OBSOLETE +// OBSOLETE /* Do not stop the inferior */ +// OBSOLETE return ret; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Now gdb handles the exception */ +// OBSOLETE stopped_in_exception = TRUE; +// OBSOLETE +// OBSOLETE ret = task_suspend (task); +// OBSOLETE CHK ("Error suspending inferior after exception", ret); +// OBSOLETE +// OBSOLETE must_suspend_thread = 0; +// OBSOLETE +// OBSOLETE if (current_thread != thread) +// OBSOLETE { +// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) +// OBSOLETE /* Cleanup discards single stepping */ +// OBSOLETE error ("Exception from thread %d while singlestepping thread %d", +// OBSOLETE mid, +// OBSOLETE map_port_name_to_mid (current_thread, MACH_TYPE_THREAD)); +// OBSOLETE +// OBSOLETE /* Then select the thread that caused the exception */ +// OBSOLETE if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) +// OBSOLETE error ("Could not select thread %d causing exception", mid); +// OBSOLETE else +// OBSOLETE warning ("Gdb selected thread %d", mid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* If we receive an exception that is not breakpoint +// OBSOLETE * exception, we interrupt the single step and return to +// OBSOLETE * debugger. Trace condition is cleared. +// OBSOLETE */ +// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port)) +// OBSOLETE { +// OBSOLETE if (stop_exception != EXC_BREAKPOINT) +// OBSOLETE warning ("Single step interrupted by exception"); +// OBSOLETE else if (port == singlestepped_thread_port) +// OBSOLETE { +// OBSOLETE /* Single step exception occurred, remove trace bit +// OBSOLETE * and return to gdb. +// OBSOLETE */ +// OBSOLETE if (!MACH_PORT_VALID (current_thread)) +// OBSOLETE error ("Single stepped thread is not valid"); +// OBSOLETE +// OBSOLETE /* Resume threads, but leave the task suspended */ +// OBSOLETE resume_all_threads (0); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE warning ("Breakpoint while single stepping?"); +// OBSOLETE +// OBSOLETE discard_single_step (current_thread); +// OBSOLETE } +// OBSOLETE +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task); +// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread); +// OBSOLETE +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE port_valid (mach_port_t port, int mask) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE mach_port_type_t type; +// OBSOLETE +// OBSOLETE ret = mach_port_type (mach_task_self (), +// OBSOLETE port, +// OBSOLETE &type); +// OBSOLETE if (ret != KERN_SUCCESS || (type & mask) != mask) +// OBSOLETE return 0; +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* @@ No vm read cache implemented yet */ +// OBSOLETE boolean_t vm_read_cache_valid = FALSE; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Read inferior task's LEN bytes from ADDR and copy it to MYADDR +// OBSOLETE * in gdb's address space. +// OBSOLETE * +// OBSOLETE * Return 0 on failure; number of bytes read otherwise. +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr); +// OBSOLETE vm_size_t aligned_length = +// OBSOLETE (vm_size_t) round_page (addr + length) - low_address; +// OBSOLETE pointer_t copied_memory; +// OBSOLETE int copy_count; +// OBSOLETE +// OBSOLETE /* Get memory from inferior with page aligned addresses */ +// OBSOLETE ret = vm_read (inferior_task, +// OBSOLETE low_address, +// OBSOLETE aligned_length, +// OBSOLETE &copied_memory, +// OBSOLETE ©_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE /* the problem is that the inferior might be killed for whatever reason +// OBSOLETE * before we go to mach_really_wait. This is one place that ought to +// OBSOLETE * catch many of those errors. +// OBSOLETE * @@ A better fix would be to make all external events to GDB +// OBSOLETE * to arrive via a SINGLE port set. (Including user input!) +// OBSOLETE */ +// OBSOLETE +// OBSOLETE if (!port_valid (inferior_task, MACH_PORT_TYPE_SEND)) +// OBSOLETE { +// OBSOLETE m3_kill_inferior (); +// OBSOLETE error ("Inferior killed (task port invalid)"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE #ifdef OSF +// OBSOLETE extern int errno; +// OBSOLETE /* valprint.c gives nicer format if this does not +// OBSOLETE screw it. Eamonn seems to like this, so I enable +// OBSOLETE it if OSF is defined... +// OBSOLETE */ +// OBSOLETE warning ("[read inferior %x failed: %s]", +// OBSOLETE addr, mach_error_string (ret)); +// OBSOLETE errno = 0; +// OBSOLETE #endif +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE memcpy (myaddr, (char *) addr - low_address + copied_memory, length); +// OBSOLETE +// OBSOLETE ret = vm_deallocate (mach_task_self (), +// OBSOLETE copied_memory, +// OBSOLETE copy_count); +// OBSOLETE CHK ("mach3_read_inferior vm_deallocate failed", ret); +// OBSOLETE +// OBSOLETE return length; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define CHK_GOTO_OUT(str,ret) \ +// OBSOLETE do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0) +// OBSOLETE +// OBSOLETE struct vm_region_list +// OBSOLETE { +// OBSOLETE struct vm_region_list *next; +// OBSOLETE vm_prot_t protection; +// OBSOLETE vm_address_t start; +// OBSOLETE vm_size_t length; +// OBSOLETE }; +// OBSOLETE +// OBSOLETE struct obstack region_obstack; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Write inferior task's LEN bytes from ADDR and copy it to MYADDR +// OBSOLETE * in gdb's address space. +// OBSOLETE */ +// OBSOLETE int +// OBSOLETE mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr); +// OBSOLETE vm_size_t aligned_length = +// OBSOLETE (vm_size_t) round_page (addr + length) - low_address; +// OBSOLETE pointer_t copied_memory; +// OBSOLETE int copy_count; +// OBSOLETE int deallocate = 0; +// OBSOLETE +// OBSOLETE char *errstr = "Bug in mach3_write_inferior"; +// OBSOLETE +// OBSOLETE struct vm_region_list *region_element; +// OBSOLETE struct vm_region_list *region_head = (struct vm_region_list *) NULL; +// OBSOLETE +// OBSOLETE /* Get memory from inferior with page aligned addresses */ +// OBSOLETE ret = vm_read (inferior_task, +// OBSOLETE low_address, +// OBSOLETE aligned_length, +// OBSOLETE &copied_memory, +// OBSOLETE ©_count); +// OBSOLETE CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret); +// OBSOLETE +// OBSOLETE deallocate++; +// OBSOLETE +// OBSOLETE memcpy ((char *) addr - low_address + copied_memory, myaddr, length); +// OBSOLETE +// OBSOLETE obstack_init (®ion_obstack); +// OBSOLETE +// OBSOLETE /* Do writes atomically. +// OBSOLETE * First check for holes and unwritable memory. +// OBSOLETE */ +// OBSOLETE { +// OBSOLETE vm_size_t remaining_length = aligned_length; +// OBSOLETE vm_address_t region_address = low_address; +// OBSOLETE +// OBSOLETE struct vm_region_list *scan; +// OBSOLETE +// OBSOLETE while (region_address < low_address + aligned_length) +// OBSOLETE { +// OBSOLETE vm_prot_t protection; +// OBSOLETE vm_prot_t max_protection; +// OBSOLETE vm_inherit_t inheritance; +// OBSOLETE boolean_t shared; +// OBSOLETE mach_port_t object_name; +// OBSOLETE vm_offset_t offset; +// OBSOLETE vm_size_t region_length = remaining_length; +// OBSOLETE vm_address_t old_address = region_address; +// OBSOLETE +// OBSOLETE ret = vm_region (inferior_task, +// OBSOLETE ®ion_address, +// OBSOLETE ®ion_length, +// OBSOLETE &protection, +// OBSOLETE &max_protection, +// OBSOLETE &inheritance, +// OBSOLETE &shared, +// OBSOLETE &object_name, +// OBSOLETE &offset); +// OBSOLETE CHK_GOTO_OUT ("vm_region failed", ret); +// OBSOLETE +// OBSOLETE /* Check for holes in memory */ +// OBSOLETE if (old_address != region_address) +// OBSOLETE { +// OBSOLETE warning ("No memory at 0x%x. Nothing written", +// OBSOLETE old_address); +// OBSOLETE ret = KERN_SUCCESS; +// OBSOLETE length = 0; +// OBSOLETE goto out; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!(max_protection & VM_PROT_WRITE)) +// OBSOLETE { +// OBSOLETE warning ("Memory at address 0x%x is unwritable. Nothing written", +// OBSOLETE old_address); +// OBSOLETE ret = KERN_SUCCESS; +// OBSOLETE length = 0; +// OBSOLETE goto out; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Chain the regions for later use */ +// OBSOLETE region_element = +// OBSOLETE (struct vm_region_list *) +// OBSOLETE obstack_alloc (®ion_obstack, sizeof (struct vm_region_list)); +// OBSOLETE +// OBSOLETE region_element->protection = protection; +// OBSOLETE region_element->start = region_address; +// OBSOLETE region_element->length = region_length; +// OBSOLETE +// OBSOLETE /* Chain the regions along with protections */ +// OBSOLETE region_element->next = region_head; +// OBSOLETE region_head = region_element; +// OBSOLETE +// OBSOLETE region_address += region_length; +// OBSOLETE remaining_length = remaining_length - region_length; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* If things fail after this, we give up. +// OBSOLETE * Somebody is messing up inferior_task's mappings. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Enable writes to the chained vm regions */ +// OBSOLETE for (scan = region_head; scan; scan = scan->next) +// OBSOLETE { +// OBSOLETE boolean_t protection_changed = FALSE; +// OBSOLETE +// OBSOLETE if (!(scan->protection & VM_PROT_WRITE)) +// OBSOLETE { +// OBSOLETE ret = vm_protect (inferior_task, +// OBSOLETE scan->start, +// OBSOLETE scan->length, +// OBSOLETE FALSE, +// OBSOLETE scan->protection | VM_PROT_WRITE); +// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = vm_write (inferior_task, +// OBSOLETE low_address, +// OBSOLETE copied_memory, +// OBSOLETE aligned_length); +// OBSOLETE CHK_GOTO_OUT ("vm_write failed", ret); +// OBSOLETE +// OBSOLETE /* Set up the original region protections, if they were changed */ +// OBSOLETE for (scan = region_head; scan; scan = scan->next) +// OBSOLETE { +// OBSOLETE boolean_t protection_changed = FALSE; +// OBSOLETE +// OBSOLETE if (!(scan->protection & VM_PROT_WRITE)) +// OBSOLETE { +// OBSOLETE ret = vm_protect (inferior_task, +// OBSOLETE scan->start, +// OBSOLETE scan->length, +// OBSOLETE FALSE, +// OBSOLETE scan->protection); +// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE out: +// OBSOLETE if (deallocate) +// OBSOLETE { +// OBSOLETE obstack_free (®ion_obstack, 0); +// OBSOLETE +// OBSOLETE (void) vm_deallocate (mach_task_self (), +// OBSOLETE copied_memory, +// OBSOLETE copy_count); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("%s %s", errstr, mach_error_string (ret)); +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return length; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return 0 on failure, number of bytes handled otherwise. TARGET is +// OBSOLETE ignored. */ +// OBSOLETE static int +// OBSOLETE m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, +// OBSOLETE struct target_ops *target) +// OBSOLETE { +// OBSOLETE int result; +// OBSOLETE +// OBSOLETE if (write) +// OBSOLETE result = mach3_write_inferior (memaddr, myaddr, len); +// OBSOLETE else +// OBSOLETE result = mach3_read_inferior (memaddr, myaddr, len); +// OBSOLETE +// OBSOLETE return result; +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE translate_state (int state) +// OBSOLETE { +// OBSOLETE switch (state) +// OBSOLETE { +// OBSOLETE case TH_STATE_RUNNING: +// OBSOLETE return ("R"); +// OBSOLETE case TH_STATE_STOPPED: +// OBSOLETE return ("S"); +// OBSOLETE case TH_STATE_WAITING: +// OBSOLETE return ("W"); +// OBSOLETE case TH_STATE_UNINTERRUPTIBLE: +// OBSOLETE return ("U"); +// OBSOLETE case TH_STATE_HALTED: +// OBSOLETE return ("H"); +// OBSOLETE default: +// OBSOLETE return ("?"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE translate_cstate (int state) +// OBSOLETE { +// OBSOLETE switch (state) +// OBSOLETE { +// OBSOLETE case CPROC_RUNNING: +// OBSOLETE return "R"; +// OBSOLETE case CPROC_SWITCHING: +// OBSOLETE return "S"; +// OBSOLETE case CPROC_BLOCKED: +// OBSOLETE return "B"; +// OBSOLETE case CPROC_CONDWAIT: +// OBSOLETE return "C"; +// OBSOLETE case CPROC_CONDWAIT | CPROC_SWITCHING: +// OBSOLETE return "CS"; +// OBSOLETE default: +// OBSOLETE return "?"; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */ +// OBSOLETE +// OBSOLETE mach_port_t /* no mach_port_name_t found in include files. */ +// OBSOLETE map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE mach_msg_type_name_t acquired; +// OBSOLETE mach_port_t iport; +// OBSOLETE +// OBSOLETE ret = mach_port_extract_right (inferior_task, +// OBSOLETE inferior_name, +// OBSOLETE type, +// OBSOLETE &iport, +// OBSOLETE &acquired); +// OBSOLETE CHK ("mach_port_extract_right (map_inferior_port_name)", ret); +// OBSOLETE +// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND) +// OBSOLETE error ("Incorrect right extracted, (map_inferior_port_name)"); +// OBSOLETE +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), +// OBSOLETE iport); +// OBSOLETE CHK ("Deallocating mapped port (map_inferior_port_name)", ret); +// OBSOLETE +// OBSOLETE return iport; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Naming convention: +// OBSOLETE * Always return user defined name if found. +// OBSOLETE * _K == A kernel thread with no matching CPROC +// OBSOLETE * _C == A cproc with no current cthread +// OBSOLETE * _t == A cthread with no user defined name +// OBSOLETE * +// OBSOLETE * The digits that follow the _names are the SLOT number of the +// OBSOLETE * kernel thread if there is such a thing, otherwise just a negation +// OBSOLETE * of the sequential number of such cprocs. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static char buf[7]; +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE get_thread_name (gdb_thread_t one_cproc, int id) +// OBSOLETE { +// OBSOLETE if (one_cproc) +// OBSOLETE if (one_cproc->cthread == NULL) +// OBSOLETE { +// OBSOLETE /* cproc not mapped to any cthread */ +// OBSOLETE sprintf (buf, "_C%d", id); +// OBSOLETE } +// OBSOLETE else if (!one_cproc->cthread->name) +// OBSOLETE { +// OBSOLETE /* cproc and cthread, but no name */ +// OBSOLETE sprintf (buf, "_t%d", id); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE return (char *) (one_cproc->cthread->name); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (id < 0) +// OBSOLETE warning ("Inconsistency in thread name id %d", id); +// OBSOLETE +// OBSOLETE /* Kernel thread without cproc */ +// OBSOLETE sprintf (buf, "_K%d", id); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return buf; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_array_t th_table; +// OBSOLETE int th_count; +// OBSOLETE gdb_thread_t mthreads = NULL; +// OBSOLETE int index; +// OBSOLETE +// OBSOLETE ret = task_threads (task, &th_table, &th_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Error getting inferior's thread list:%s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE m3_kill_inferior (); +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE mthreads = (gdb_thread_t) +// OBSOLETE obstack_alloc +// OBSOLETE (cproc_obstack, +// OBSOLETE th_count * sizeof (struct gdb_thread)); +// OBSOLETE +// OBSOLETE for (index = 0; index < th_count; index++) +// OBSOLETE { +// OBSOLETE thread_t saved_thread = MACH_PORT_NULL; +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE if (must_suspend_thread) +// OBSOLETE setup_thread (th_table[index], 1); +// OBSOLETE +// OBSOLETE if (th_table[index] != current_thread) +// OBSOLETE { +// OBSOLETE saved_thread = current_thread; +// OBSOLETE +// OBSOLETE mid = switch_to_thread (th_table[index]); +// OBSOLETE } +// OBSOLETE +// OBSOLETE mthreads[index].name = th_table[index]; +// OBSOLETE mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */ +// OBSOLETE mthreads[index].in_emulator = FALSE; +// OBSOLETE mthreads[index].slotid = index; +// OBSOLETE +// OBSOLETE mthreads[index].sp = read_register (SP_REGNUM); +// OBSOLETE mthreads[index].fp = read_register (FP_REGNUM); +// OBSOLETE mthreads[index].pc = read_pc (); +// OBSOLETE +// OBSOLETE if (MACH_PORT_VALID (saved_thread)) +// OBSOLETE mid = switch_to_thread (saved_thread); +// OBSOLETE +// OBSOLETE if (must_suspend_thread) +// OBSOLETE setup_thread (th_table[index], 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE consume_send_rights (th_table, th_count); +// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) th_table, +// OBSOLETE (th_count * sizeof (mach_port_t))); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Error trying to deallocate thread list : %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE *mthreads_out = mthreads; +// OBSOLETE +// OBSOLETE return th_count; +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Current emulator always saves the USP on top of +// OBSOLETE * emulator stack below struct emul_stack_top stuff. +// OBSOLETE */ +// OBSOLETE CORE_ADDR +// OBSOLETE fetch_usp_from_emulator_stack (CORE_ADDR sp) +// OBSOLETE { +// OBSOLETE CORE_ADDR stack_pointer; +// OBSOLETE +// OBSOLETE sp = (sp & ~(EMULATOR_STACK_SIZE - 1)) + +// OBSOLETE EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top); +// OBSOLETE +// OBSOLETE if (mach3_read_inferior (sp, +// OBSOLETE &stack_pointer, +// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) +// OBSOLETE { +// OBSOLETE warning ("Can't read user sp from emulator stack address 0x%x", sp); +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return stack_pointer; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef MK67 +// OBSOLETE +// OBSOLETE /* get_emulation_vector() interface was changed after mk67 */ +// OBSOLETE #define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */ +// OBSOLETE +// OBSOLETE #endif /* MK67 */ +// OBSOLETE +// OBSOLETE /* Check if the emulator exists at task's address space. +// OBSOLETE */ +// OBSOLETE boolean_t +// OBSOLETE have_emulator_p (task_t task) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE #ifndef EMUL_VECTOR_COUNT +// OBSOLETE vm_offset_t *emulation_vector; +// OBSOLETE int n; +// OBSOLETE #else +// OBSOLETE vm_offset_t emulation_vector[EMUL_VECTOR_COUNT]; +// OBSOLETE int n = EMUL_VECTOR_COUNT; +// OBSOLETE #endif +// OBSOLETE int i; +// OBSOLETE int vector_start; +// OBSOLETE +// OBSOLETE ret = task_get_emulation_vector (task, +// OBSOLETE &vector_start, +// OBSOLETE #ifndef EMUL_VECTOR_COUNT +// OBSOLETE &emulation_vector, +// OBSOLETE #else +// OBSOLETE emulation_vector, +// OBSOLETE #endif +// OBSOLETE &n); +// OBSOLETE CHK ("task_get_emulation_vector", ret); +// OBSOLETE xx_debug ("%d vectors from %d at 0x%08x\n", +// OBSOLETE n, vector_start, emulation_vector); +// OBSOLETE +// OBSOLETE for (i = 0; i < n; i++) +// OBSOLETE { +// OBSOLETE vm_offset_t entry = emulation_vector[i]; +// OBSOLETE +// OBSOLETE if (EMULATOR_BASE <= entry && entry <= EMULATOR_END) +// OBSOLETE return TRUE; +// OBSOLETE else if (entry) +// OBSOLETE { +// OBSOLETE static boolean_t informed = FALSE; +// OBSOLETE if (!informed) +// OBSOLETE { +// OBSOLETE warning ("Emulation vector address 0x08%x outside emulator space", +// OBSOLETE entry); +// OBSOLETE informed = TRUE; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE return FALSE; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Map cprocs to kernel threads and vice versa. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads, +// OBSOLETE int thread_count) +// OBSOLETE { +// OBSOLETE int index; +// OBSOLETE gdb_thread_t scan; +// OBSOLETE boolean_t all_mapped = TRUE; +// OBSOLETE LONGEST stack_base; +// OBSOLETE LONGEST stack_size; +// OBSOLETE +// OBSOLETE for (scan = cprocs; scan; scan = scan->next) +// OBSOLETE { +// OBSOLETE /* Default to: no kernel thread for this cproc */ +// OBSOLETE scan->reverse_map = -1; +// OBSOLETE +// OBSOLETE /* Check if the cproc is found by its stack */ +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE stack_base = +// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET, +// OBSOLETE CPROC_BASE_SIZE); +// OBSOLETE stack_size = +// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET, +// OBSOLETE CPROC_SIZE_SIZE); +// OBSOLETE if ((mthreads + index)->sp > stack_base && +// OBSOLETE (mthreads + index)->sp <= stack_base + stack_size) +// OBSOLETE { +// OBSOLETE (mthreads + index)->cproc = scan; +// OBSOLETE scan->reverse_map = index; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE all_mapped &= (scan->reverse_map != -1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Check for threads that are currently in the emulator. +// OBSOLETE * If so, they have a different stack, and the still unmapped +// OBSOLETE * cprocs may well get mapped to these threads. +// OBSOLETE * +// OBSOLETE * If: +// OBSOLETE * - cproc stack does not match any kernel thread stack pointer +// OBSOLETE * - there is at least one extra kernel thread +// OBSOLETE * that has no cproc mapped above. +// OBSOLETE * - some kernel thread stack pointer points to emulator space +// OBSOLETE * then we find the user stack pointer saved in the emulator +// OBSOLETE * stack, and try to map that to the cprocs. +// OBSOLETE * +// OBSOLETE * Also set in_emulator for kernel threads. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE if (emulator_present) +// OBSOLETE { +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE CORE_ADDR emul_sp; +// OBSOLETE CORE_ADDR usp; +// OBSOLETE +// OBSOLETE gdb_thread_t mthread = (mthreads + index); +// OBSOLETE emul_sp = mthread->sp; +// OBSOLETE +// OBSOLETE if (mthread->cproc == NULL && +// OBSOLETE EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END) +// OBSOLETE { +// OBSOLETE mthread->in_emulator = emulator_present; +// OBSOLETE +// OBSOLETE if (!all_mapped && cprocs) +// OBSOLETE { +// OBSOLETE usp = fetch_usp_from_emulator_stack (emul_sp); +// OBSOLETE +// OBSOLETE /* @@ Could be more accurate */ +// OBSOLETE if (!usp) +// OBSOLETE error ("Zero stack pointer read from emulator?"); +// OBSOLETE +// OBSOLETE /* Try to match this stack pointer to the cprocs that +// OBSOLETE * don't yet have a kernel thread. +// OBSOLETE */ +// OBSOLETE for (scan = cprocs; scan; scan = scan->next) +// OBSOLETE { +// OBSOLETE +// OBSOLETE /* Check is this unmapped CPROC stack contains +// OBSOLETE * the user stack pointer saved in the +// OBSOLETE * emulator. +// OBSOLETE */ +// OBSOLETE if (scan->reverse_map == -1) +// OBSOLETE { +// OBSOLETE stack_base = +// OBSOLETE extract_signed_integer +// OBSOLETE (scan->raw_cproc + CPROC_BASE_OFFSET, +// OBSOLETE CPROC_BASE_SIZE); +// OBSOLETE stack_size = +// OBSOLETE extract_signed_integer +// OBSOLETE (scan->raw_cproc + CPROC_SIZE_OFFSET, +// OBSOLETE CPROC_SIZE_SIZE); +// OBSOLETE if (usp > stack_base && +// OBSOLETE usp <= stack_base + stack_size) +// OBSOLETE { +// OBSOLETE mthread->cproc = scan; +// OBSOLETE scan->reverse_map = index; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Format of the thread_list command +// OBSOLETE * +// OBSOLETE * slot mid sel name emul ks susp cstate wired address +// OBSOLETE */ +// OBSOLETE #define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s " +// OBSOLETE +// OBSOLETE #define TL_HEADER "\n@ MID Name KState CState Where\n" +// OBSOLETE +// OBSOLETE void +// OBSOLETE print_tl_address (struct ui_file *stream, CORE_ADDR pc) +// OBSOLETE { +// OBSOLETE if (!lookup_minimal_symbol_by_pc (pc)) +// OBSOLETE fprintf_filtered (stream, local_hex_format (), pc); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE extern int addressprint; +// OBSOLETE extern int asm_demangle; +// OBSOLETE +// OBSOLETE int store = addressprint; +// OBSOLETE addressprint = 0; +// OBSOLETE print_address_symbolic (pc, stream, asm_demangle, ""); +// OBSOLETE addressprint = store; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* For thread names, but also for gdb_message_port external name */ +// OBSOLETE #define MAX_NAME_LEN 50 +// OBSOLETE +// OBSOLETE /* Returns the address of variable NAME or 0 if not found */ +// OBSOLETE CORE_ADDR +// OBSOLETE lookup_address_of_variable (char *name) +// OBSOLETE { +// OBSOLETE struct symbol *sym; +// OBSOLETE CORE_ADDR symaddr = 0; +// OBSOLETE struct minimal_symbol *msymbol; +// OBSOLETE +// OBSOLETE sym = lookup_symbol (name, +// OBSOLETE (struct block *) NULL, +// OBSOLETE VAR_NAMESPACE, +// OBSOLETE (int *) NULL, +// OBSOLETE (struct symtab **) NULL); +// OBSOLETE +// OBSOLETE if (sym) +// OBSOLETE symaddr = SYMBOL_VALUE (sym); +// OBSOLETE +// OBSOLETE if (!symaddr) +// OBSOLETE { +// OBSOLETE msymbol = lookup_minimal_symbol (name, NULL, NULL); +// OBSOLETE +// OBSOLETE if (msymbol && msymbol->type == mst_data) +// OBSOLETE symaddr = SYMBOL_VALUE_ADDRESS (msymbol); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return symaddr; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static gdb_thread_t +// OBSOLETE get_cprocs (void) +// OBSOLETE { +// OBSOLETE gdb_thread_t cproc_head; +// OBSOLETE gdb_thread_t cproc_copy; +// OBSOLETE CORE_ADDR their_cprocs; +// OBSOLETE char *buf; +// OBSOLETE char *name; +// OBSOLETE cthread_t cthread; +// OBSOLETE CORE_ADDR symaddr; +// OBSOLETE +// OBSOLETE buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT); +// OBSOLETE symaddr = lookup_address_of_variable ("cproc_list"); +// OBSOLETE +// OBSOLETE if (!symaddr) +// OBSOLETE { +// OBSOLETE /* cproc_list is not in a file compiled with debugging +// OBSOLETE symbols, but don't give up yet */ +// OBSOLETE +// OBSOLETE symaddr = lookup_address_of_variable ("cprocs"); +// OBSOLETE +// OBSOLETE if (symaddr) +// OBSOLETE { +// OBSOLETE static int informed = 0; +// OBSOLETE if (!informed) +// OBSOLETE { +// OBSOLETE informed++; +// OBSOLETE warning ("Your program is loaded with an old threads library."); +// OBSOLETE warning ("GDB does not know the old form of threads"); +// OBSOLETE warning ("so things may not work."); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */ +// OBSOLETE if (!symaddr) +// OBSOLETE return NULL; +// OBSOLETE +// OBSOLETE /* Get the address of the first cproc in the task */ +// OBSOLETE if (!mach3_read_inferior (symaddr, +// OBSOLETE buf, +// OBSOLETE TARGET_PTR_BIT / HOST_CHAR_BIT)) +// OBSOLETE error ("Can't read cproc master list at address (0x%x).", symaddr); +// OBSOLETE their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT); +// OBSOLETE +// OBSOLETE /* Scan the CPROCs in the task. +// OBSOLETE CPROCs are chained with LIST field, not NEXT field, which +// OBSOLETE chains mutexes, condition variables and queues */ +// OBSOLETE +// OBSOLETE cproc_head = NULL; +// OBSOLETE +// OBSOLETE while (their_cprocs != (CORE_ADDR) 0) +// OBSOLETE { +// OBSOLETE CORE_ADDR cproc_copy_incarnation; +// OBSOLETE cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack, +// OBSOLETE sizeof (struct gdb_thread)); +// OBSOLETE +// OBSOLETE if (!mach3_read_inferior (their_cprocs, +// OBSOLETE &cproc_copy->raw_cproc[0], +// OBSOLETE CPROC_SIZE)) +// OBSOLETE error ("Can't read next cproc at 0x%x.", their_cprocs); +// OBSOLETE +// OBSOLETE their_cprocs = +// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET, +// OBSOLETE CPROC_LIST_SIZE); +// OBSOLETE cproc_copy_incarnation = +// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET, +// OBSOLETE CPROC_INCARNATION_SIZE); +// OBSOLETE +// OBSOLETE if (cproc_copy_incarnation == (CORE_ADDR) 0) +// OBSOLETE cproc_copy->cthread = NULL; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* This CPROC has an attached CTHREAD. Get its name */ +// OBSOLETE cthread = (cthread_t) obstack_alloc (cproc_obstack, +// OBSOLETE sizeof (struct cthread)); +// OBSOLETE +// OBSOLETE if (!mach3_read_inferior (cproc_copy_incarnation, +// OBSOLETE cthread, +// OBSOLETE sizeof (struct cthread))) +// OBSOLETE error ("Can't read next thread at 0x%x.", +// OBSOLETE cproc_copy_incarnation); +// OBSOLETE +// OBSOLETE cproc_copy->cthread = cthread; +// OBSOLETE +// OBSOLETE if (cthread->name) +// OBSOLETE { +// OBSOLETE name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN); +// OBSOLETE +// OBSOLETE if (!mach3_read_inferior (cthread->name, name, MAX_NAME_LEN)) +// OBSOLETE error ("Can't read next thread's name at 0x%x.", cthread->name); +// OBSOLETE +// OBSOLETE cthread->name = name; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* insert in front */ +// OBSOLETE cproc_copy->next = cproc_head; +// OBSOLETE cproc_head = cproc_copy; +// OBSOLETE } +// OBSOLETE return cproc_head; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifndef FETCH_CPROC_STATE +// OBSOLETE /* +// OBSOLETE * Check if your machine does not grok the way this routine +// OBSOLETE * fetches the FP,PC and SP of a cproc that is not +// OBSOLETE * currently attached to any kernel thread (e.g. its cproc.context +// OBSOLETE * field points to the place in stack where the context +// OBSOLETE * is saved). +// OBSOLETE * +// OBSOLETE * If it doesn't, define your own routine. +// OBSOLETE */ +// OBSOLETE #define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth) +// OBSOLETE +// OBSOLETE int +// OBSOLETE mach3_cproc_state (gdb_thread_t mthread) +// OBSOLETE { +// OBSOLETE int context; +// OBSOLETE +// OBSOLETE if (!mthread || !mthread->cproc) +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE context = extract_signed_integer +// OBSOLETE (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET, +// OBSOLETE CPROC_CONTEXT_SIZE); +// OBSOLETE if (context == 0) +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE mthread->sp = context + MACHINE_CPROC_SP_OFFSET; +// OBSOLETE +// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET, +// OBSOLETE &mthread->pc, +// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) +// OBSOLETE { +// OBSOLETE warning ("Can't read cproc pc from inferior"); +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET, +// OBSOLETE &mthread->fp, +// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) +// OBSOLETE { +// OBSOLETE warning ("Can't read cproc fp from inferior"); +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE #endif /* FETCH_CPROC_STATE */ +// OBSOLETE +// OBSOLETE +// OBSOLETE void +// OBSOLETE thread_list_command (void) +// OBSOLETE { +// OBSOLETE thread_basic_info_data_t ths; +// OBSOLETE int thread_count; +// OBSOLETE gdb_thread_t cprocs; +// OBSOLETE gdb_thread_t scan; +// OBSOLETE int index; +// OBSOLETE char *name; +// OBSOLETE char selected; +// OBSOLETE char *wired; +// OBSOLETE int infoCnt; +// OBSOLETE kern_return_t ret; +// OBSOLETE mach_port_t mid_or_port; +// OBSOLETE gdb_thread_t their_threads; +// OBSOLETE gdb_thread_t kthread; +// OBSOLETE +// OBSOLETE int neworder = 1; +// OBSOLETE +// OBSOLETE char *fmt = "There are %d kernel threads in task %d.\n"; +// OBSOLETE +// OBSOLETE int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE thread_count = fetch_thread_info (inferior_task, +// OBSOLETE &their_threads); +// OBSOLETE if (thread_count == -1) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (thread_count == 1) +// OBSOLETE fmt = "There is %d kernel thread in task %d.\n"; +// OBSOLETE +// OBSOLETE printf_filtered (fmt, thread_count, tmid); +// OBSOLETE +// OBSOLETE puts_filtered (TL_HEADER); +// OBSOLETE +// OBSOLETE cprocs = get_cprocs (); +// OBSOLETE +// OBSOLETE map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count); +// OBSOLETE +// OBSOLETE for (scan = cprocs; scan; scan = scan->next) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE char buf[10]; +// OBSOLETE char slot[3]; +// OBSOLETE int cproc_state = +// OBSOLETE extract_signed_integer +// OBSOLETE (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE); +// OBSOLETE +// OBSOLETE selected = ' '; +// OBSOLETE +// OBSOLETE /* a wired cproc? */ +// OBSOLETE wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET, +// OBSOLETE CPROC_WIRED_SIZE) +// OBSOLETE ? "wired" : ""); +// OBSOLETE +// OBSOLETE if (scan->reverse_map != -1) +// OBSOLETE kthread = (their_threads + scan->reverse_map); +// OBSOLETE else +// OBSOLETE kthread = NULL; +// OBSOLETE +// OBSOLETE if (kthread) +// OBSOLETE { +// OBSOLETE /* These cprocs have a kernel thread */ +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE +// OBSOLETE ret = thread_info (kthread->name, +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & ths, +// OBSOLETE &infoCnt); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Unable to get basic info on thread %d : %s", +// OBSOLETE mid, +// OBSOLETE mach_error_string (ret)); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Who is the first to have more than 100 threads */ +// OBSOLETE sprintf (slot, "%d", kthread->slotid % 100); +// OBSOLETE +// OBSOLETE if (kthread->name == current_thread) +// OBSOLETE selected = '*'; +// OBSOLETE +// OBSOLETE if (ths.suspend_count) +// OBSOLETE sprintf (buf, "%d", ths.suspend_count); +// OBSOLETE else +// OBSOLETE buf[0] = '\000'; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED) +// OBSOLETE strcat (buf, "S"); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE if (ths.flags & TH_FLAGS_IDLE) +// OBSOLETE strcat (buf, "I"); +// OBSOLETE +// OBSOLETE printf_filtered (TL_FORMAT, +// OBSOLETE slot, +// OBSOLETE mid, +// OBSOLETE selected, +// OBSOLETE get_thread_name (scan, kthread->slotid), +// OBSOLETE kthread->in_emulator ? "E" : "", +// OBSOLETE translate_state (ths.run_state), +// OBSOLETE buf, +// OBSOLETE translate_cstate (cproc_state), +// OBSOLETE wired); +// OBSOLETE print_tl_address (gdb_stdout, kthread->pc); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* These cprocs don't have a kernel thread. +// OBSOLETE * find out the calling frame with +// OBSOLETE * FETCH_CPROC_STATE. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE struct gdb_thread state; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* jtv -> emcmanus: why do you want this here? */ +// OBSOLETE if (scan->incarnation == NULL) +// OBSOLETE continue; /* EMcM */ +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE printf_filtered (TL_FORMAT, +// OBSOLETE "-", +// OBSOLETE -neworder, /* Pseudo MID */ +// OBSOLETE selected, +// OBSOLETE get_thread_name (scan, -neworder), +// OBSOLETE "", +// OBSOLETE "-", /* kernel state */ +// OBSOLETE "", +// OBSOLETE translate_cstate (cproc_state), +// OBSOLETE ""); +// OBSOLETE state.cproc = scan; +// OBSOLETE +// OBSOLETE if (FETCH_CPROC_STATE (&state) == -1) +// OBSOLETE puts_filtered ("???"); +// OBSOLETE else +// OBSOLETE print_tl_address (gdb_stdout, state.pc); +// OBSOLETE +// OBSOLETE neworder++; +// OBSOLETE } +// OBSOLETE puts_filtered ("\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Scan for kernel threads without cprocs */ +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE if (!their_threads[index].cproc) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE char buf[10]; +// OBSOLETE char slot[3]; +// OBSOLETE +// OBSOLETE mach_port_t name = their_threads[index].name; +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (name, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE +// OBSOLETE ret = thread_info (name, +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & ths, +// OBSOLETE &infoCnt); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Unable to get basic info on thread %d : %s", +// OBSOLETE mid, +// OBSOLETE mach_error_string (ret)); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE sprintf (slot, "%d", index % 100); +// OBSOLETE +// OBSOLETE if (name == current_thread) +// OBSOLETE selected = '*'; +// OBSOLETE else +// OBSOLETE selected = ' '; +// OBSOLETE +// OBSOLETE if (ths.suspend_count) +// OBSOLETE sprintf (buf, "%d", ths.suspend_count); +// OBSOLETE else +// OBSOLETE buf[0] = '\000'; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED) +// OBSOLETE strcat (buf, "S"); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE if (ths.flags & TH_FLAGS_IDLE) +// OBSOLETE strcat (buf, "I"); +// OBSOLETE +// OBSOLETE printf_filtered (TL_FORMAT, +// OBSOLETE slot, +// OBSOLETE mid, +// OBSOLETE selected, +// OBSOLETE get_thread_name (NULL, index), +// OBSOLETE their_threads[index].in_emulator ? "E" : "", +// OBSOLETE translate_state (ths.run_state), +// OBSOLETE buf, +// OBSOLETE "", /* No cproc state */ +// OBSOLETE ""); /* Can't be wired */ +// OBSOLETE print_tl_address (gdb_stdout, their_threads[index].pc); +// OBSOLETE puts_filtered ("\n"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE obstack_free (cproc_obstack, 0); +// OBSOLETE obstack_init (cproc_obstack); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE thread_select_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE thread_array_t thread_list; +// OBSOLETE int thread_count; +// OBSOLETE kern_return_t ret; +// OBSOLETE int is_slot = 0; +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE error_no_arg ("MID or @SLOTNUMBER to specify a thread to select"); +// OBSOLETE +// OBSOLETE while (*args == ' ' || *args == '\t') +// OBSOLETE args++; +// OBSOLETE +// OBSOLETE if (*args == '@') +// OBSOLETE { +// OBSOLETE is_slot++; +// OBSOLETE args++; +// OBSOLETE } +// OBSOLETE +// OBSOLETE mid = atoi (args); +// OBSOLETE +// OBSOLETE if (mid == 0) +// OBSOLETE if (!is_slot || *args != '0') /* Rudimentary checks */ +// OBSOLETE error ("You must select threads by MID or @SLOTNUMBER"); +// OBSOLETE +// OBSOLETE if (select_thread (inferior_task, mid, is_slot ? 2 : 1) != KERN_SUCCESS) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (from_tty) +// OBSOLETE printf_filtered ("Thread %d selected\n", +// OBSOLETE is_slot ? map_port_name_to_mid (current_thread, +// OBSOLETE MACH_TYPE_THREAD) : mid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE thread_trace (mach_port_t thread, boolean_t set) +// OBSOLETE { +// OBSOLETE int flavor = TRACE_FLAVOR; +// OBSOLETE unsigned int stateCnt = TRACE_FLAVOR_SIZE; +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_state_data_t state; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (thread)) +// OBSOLETE { +// OBSOLETE warning ("thread_trace: invalid thread"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (must_suspend_thread) +// OBSOLETE setup_thread (thread, 1); +// OBSOLETE +// OBSOLETE ret = thread_get_state (thread, flavor, state, &stateCnt); +// OBSOLETE CHK ("thread_trace: error reading thread state", ret); +// OBSOLETE +// OBSOLETE if (set) +// OBSOLETE { +// OBSOLETE TRACE_SET (thread, state); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (!TRACE_CLEAR (thread, state)) +// OBSOLETE { +// OBSOLETE if (must_suspend_thread) +// OBSOLETE setup_thread (thread, 0); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = thread_set_state (thread, flavor, state, stateCnt); +// OBSOLETE CHK ("thread_trace: error writing thread state", ret); +// OBSOLETE if (must_suspend_thread) +// OBSOLETE setup_thread (thread, 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef FLUSH_INFERIOR_CACHE +// OBSOLETE +// OBSOLETE /* When over-writing code on some machines the I-Cache must be flushed +// OBSOLETE explicitly, because it is not kept coherent by the lazy hardware. +// OBSOLETE This definitely includes breakpoints, for instance, or else we +// OBSOLETE end up looping in mysterious Bpt traps */ +// OBSOLETE +// OBSOLETE flush_inferior_icache (CORE_ADDR pc, int amount) +// OBSOLETE { +// OBSOLETE vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH; +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE ret = vm_machine_attribute (inferior_task, +// OBSOLETE pc, +// OBSOLETE amount, +// OBSOLETE MATTR_CACHE, +// OBSOLETE &flush); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("Error flushing inferior's cache : %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE } +// OBSOLETE #endif /* FLUSH_INFERIOR_CACHE */ +// OBSOLETE +// OBSOLETE +// OBSOLETE static +// OBSOLETE suspend_all_threads (int from_tty) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_array_t thread_list; +// OBSOLETE int thread_count, index; +// OBSOLETE int infoCnt; +// OBSOLETE thread_basic_info_data_t th_info; +// OBSOLETE +// OBSOLETE +// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("Could not suspend inferior threads."); +// OBSOLETE m3_kill_inferior (); +// OBSOLETE throw_exception (RETURN_ERROR); +// OBSOLETE } +// OBSOLETE +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (thread_list[index], +// OBSOLETE MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE ret = thread_suspend (thread_list[index]); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("Error trying to suspend thread %d : %s", +// OBSOLETE mid, mach_error_string (ret)); +// OBSOLETE +// OBSOLETE if (from_tty) +// OBSOLETE { +// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE ret = thread_info (thread_list[index], +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & th_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("suspend can't get thread info", ret); +// OBSOLETE +// OBSOLETE warning ("Thread %d suspend count is %d", +// OBSOLETE mid, th_info.suspend_count); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE consume_send_rights (thread_list, thread_count); +// OBSOLETE ret = vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (int))); +// OBSOLETE CHK ("Error trying to deallocate thread list", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE thread_suspend_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE int mid; +// OBSOLETE mach_port_t saved_thread; +// OBSOLETE int infoCnt; +// OBSOLETE thread_basic_info_data_t th_info; +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE if (!strcasecmp (args, "all")) +// OBSOLETE { +// OBSOLETE suspend_all_threads (from_tty); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE saved_thread = current_thread; +// OBSOLETE +// OBSOLETE mid = parse_thread_id (args, 0, 0); +// OBSOLETE +// OBSOLETE if (mid < 0) +// OBSOLETE error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER"); +// OBSOLETE +// OBSOLETE if (mid == 0) +// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); +// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE if (current_thread) +// OBSOLETE current_thread = saved_thread; +// OBSOLETE error ("Could not select thread %d", mid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = thread_suspend (current_thread); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("thread_suspend failed : %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE +// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE ret = thread_info (current_thread, +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & th_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("suspend can't get thread info", ret); +// OBSOLETE +// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); +// OBSOLETE +// OBSOLETE current_thread = saved_thread; +// OBSOLETE } +// OBSOLETE +// OBSOLETE resume_all_threads (int from_tty) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_array_t thread_list; +// OBSOLETE int thread_count, index; +// OBSOLETE int mid; +// OBSOLETE int infoCnt; +// OBSOLETE thread_basic_info_data_t th_info; +// OBSOLETE +// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE m3_kill_inferior (); +// OBSOLETE error ("task_threads", mach_error_string (ret)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE ret = thread_info (thread_list[index], +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & th_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("resume_all can't get thread info", ret); +// OBSOLETE +// OBSOLETE mid = map_port_name_to_mid (thread_list[index], +// OBSOLETE MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE if (!th_info.suspend_count) +// OBSOLETE { +// OBSOLETE if (mid != -1 && from_tty) +// OBSOLETE warning ("Thread %d is not suspended", mid); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = thread_resume (thread_list[index]); +// OBSOLETE +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("Error trying to resume thread %d : %s", +// OBSOLETE mid, mach_error_string (ret)); +// OBSOLETE else if (mid != -1 && from_tty) +// OBSOLETE warning ("Thread %d suspend count is %d", +// OBSOLETE mid, --th_info.suspend_count); +// OBSOLETE } +// OBSOLETE +// OBSOLETE consume_send_rights (thread_list, thread_count); +// OBSOLETE ret = vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (int))); +// OBSOLETE CHK ("Error trying to deallocate thread list", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE thread_resume_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE mach_port_t saved_thread; +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_basic_info_data_t th_info; +// OBSOLETE int infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE if (!strcasecmp (args, "all")) +// OBSOLETE { +// OBSOLETE resume_all_threads (from_tty); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE saved_thread = current_thread; +// OBSOLETE +// OBSOLETE mid = parse_thread_id (args, 0, 0); +// OBSOLETE +// OBSOLETE if (mid < 0) +// OBSOLETE error ("You can resume only existing kernel threads with MID or @SLOTNUMBER"); +// OBSOLETE +// OBSOLETE if (mid == 0) +// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); +// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE if (current_thread) +// OBSOLETE current_thread = saved_thread; +// OBSOLETE throw_exception (RETURN_ERROR); +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = thread_info (current_thread, +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & th_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("resume can't get thread info", ret); +// OBSOLETE +// OBSOLETE if (!th_info.suspend_count) +// OBSOLETE { +// OBSOLETE warning ("Thread %d is not suspended", mid); +// OBSOLETE goto out; +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = thread_resume (current_thread); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("thread_resume failed : %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE th_info.suspend_count--; +// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count); +// OBSOLETE } +// OBSOLETE +// OBSOLETE out: +// OBSOLETE current_thread = saved_thread; +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE thread_kill_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int mid; +// OBSOLETE kern_return_t ret; +// OBSOLETE int thread_count; +// OBSOLETE thread_array_t thread_table; +// OBSOLETE int index; +// OBSOLETE mach_port_t thread_to_kill = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE error_no_arg ("thread mid to kill from the inferior task"); +// OBSOLETE +// OBSOLETE mid = parse_thread_id (args, 0, 0); +// OBSOLETE +// OBSOLETE if (mid < 0) +// OBSOLETE error ("You can kill only existing kernel threads with MID or @SLOTNUMBER"); +// OBSOLETE +// OBSOLETE if (mid) +// OBSOLETE { +// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill); +// OBSOLETE CHK ("thread_kill_command: machid_mach_port map failed", ret); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); +// OBSOLETE +// OBSOLETE /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */ +// OBSOLETE ret = task_threads (inferior_task, &thread_table, &thread_count); +// OBSOLETE CHK ("Error getting inferior's thread list", ret); +// OBSOLETE +// OBSOLETE if (thread_to_kill == current_thread) +// OBSOLETE { +// OBSOLETE ret = thread_terminate (thread_to_kill); +// OBSOLETE CHK ("Thread could not be terminated", ret); +// OBSOLETE +// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) +// OBSOLETE warning ("Last thread was killed, use \"kill\" command to kill task"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE if (thread_table[index] == thread_to_kill) +// OBSOLETE { +// OBSOLETE ret = thread_terminate (thread_to_kill); +// OBSOLETE CHK ("Thread could not be terminated", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (thread_count > 1) +// OBSOLETE consume_send_rights (thread_table, thread_count); +// OBSOLETE +// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) thread_table, +// OBSOLETE (thread_count * sizeof (mach_port_t))); +// OBSOLETE CHK ("Error trying to deallocate thread list", ret); +// OBSOLETE +// OBSOLETE warning ("Thread %d killed", mid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Task specific commands; add more if you like */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE task_resume_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE task_basic_info_data_t ta_info; +// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; +// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE /* Would be trivial to change, but is it desirable? */ +// OBSOLETE if (args) +// OBSOLETE error ("Currently gdb can resume only it's inferior task"); +// OBSOLETE +// OBSOLETE ret = task_info (inferior_task, +// OBSOLETE TASK_BASIC_INFO, +// OBSOLETE (task_info_t) & ta_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("task_resume_command: task_info failed", ret); +// OBSOLETE +// OBSOLETE if (ta_info.suspend_count == 0) +// OBSOLETE error ("Inferior task %d is not suspended", mid); +// OBSOLETE else if (ta_info.suspend_count == 1 && +// OBSOLETE from_tty && +// OBSOLETE !query ("Suspend count is now 1. Do you know what you are doing? ")) +// OBSOLETE error ("Task not resumed"); +// OBSOLETE +// OBSOLETE ret = task_resume (inferior_task); +// OBSOLETE CHK ("task_resume_command: task_resume", ret); +// OBSOLETE +// OBSOLETE if (ta_info.suspend_count == 1) +// OBSOLETE { +// OBSOLETE warning ("Inferior task %d is no longer suspended", mid); +// OBSOLETE must_suspend_thread = 1; +// OBSOLETE /* @@ This is not complete: Registers change all the time when not +// OBSOLETE suspended! */ +// OBSOLETE registers_changed (); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE warning ("Inferior task %d suspend count is now %d", +// OBSOLETE mid, ta_info.suspend_count - 1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE void +// OBSOLETE task_suspend_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE task_basic_info_data_t ta_info; +// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; +// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE /* Would be trivial to change, but is it desirable? */ +// OBSOLETE if (args) +// OBSOLETE error ("Currently gdb can suspend only it's inferior task"); +// OBSOLETE +// OBSOLETE ret = task_suspend (inferior_task); +// OBSOLETE CHK ("task_suspend_command: task_suspend", ret); +// OBSOLETE +// OBSOLETE must_suspend_thread = 0; +// OBSOLETE +// OBSOLETE ret = task_info (inferior_task, +// OBSOLETE TASK_BASIC_INFO, +// OBSOLETE (task_info_t) & ta_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("task_suspend_command: task_info failed", ret); +// OBSOLETE +// OBSOLETE warning ("Inferior task %d suspend count is now %d", +// OBSOLETE mid, ta_info.suspend_count); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE get_size (int bytes) +// OBSOLETE { +// OBSOLETE static char size[30]; +// OBSOLETE int zz = bytes / 1024; +// OBSOLETE +// OBSOLETE if (zz / 1024) +// OBSOLETE sprintf (size, "%-2.1f M", ((float) bytes) / (1024.0 * 1024.0)); +// OBSOLETE else +// OBSOLETE sprintf (size, "%d K", zz); +// OBSOLETE +// OBSOLETE return size; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Does this require the target task to be suspended?? I don't think so. */ +// OBSOLETE void +// OBSOLETE task_info_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int mid = -5; +// OBSOLETE mach_port_t task; +// OBSOLETE kern_return_t ret; +// OBSOLETE task_basic_info_data_t ta_info; +// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT; +// OBSOLETE int page_size = round_page (1); +// OBSOLETE int thread_count = 0; +// OBSOLETE +// OBSOLETE if (MACH_PORT_VALID (inferior_task)) +// OBSOLETE mid = map_port_name_to_mid (inferior_task, +// OBSOLETE MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE task = inferior_task; +// OBSOLETE +// OBSOLETE if (args) +// OBSOLETE { +// OBSOLETE int tmid = atoi (args); +// OBSOLETE +// OBSOLETE if (tmid <= 0) +// OBSOLETE error ("Invalid mid %d for task info", tmid); +// OBSOLETE +// OBSOLETE if (tmid != mid) +// OBSOLETE { +// OBSOLETE mid = tmid; +// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, tmid, &task); +// OBSOLETE CHK ("task_info_command: machid_mach_port map failed", ret); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (mid < 0) +// OBSOLETE error ("You have to give the task MID as an argument"); +// OBSOLETE +// OBSOLETE ret = task_info (task, +// OBSOLETE TASK_BASIC_INFO, +// OBSOLETE (task_info_t) & ta_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("task_info_command: task_info failed", ret); +// OBSOLETE +// OBSOLETE printf_filtered ("\nTask info for task %d:\n\n", mid); +// OBSOLETE printf_filtered (" Suspend count : %d\n", ta_info.suspend_count); +// OBSOLETE printf_filtered (" Base priority : %d\n", ta_info.base_priority); +// OBSOLETE printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size)); +// OBSOLETE printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size)); +// OBSOLETE +// OBSOLETE { +// OBSOLETE thread_array_t thread_list; +// OBSOLETE +// OBSOLETE ret = task_threads (task, &thread_list, &thread_count); +// OBSOLETE CHK ("task_info_command: task_threads", ret); +// OBSOLETE +// OBSOLETE printf_filtered (" Thread count : %d\n", thread_count); +// OBSOLETE +// OBSOLETE consume_send_rights (thread_list, thread_count); +// OBSOLETE ret = vm_deallocate (mach_task_self (), +// OBSOLETE (vm_address_t) thread_list, +// OBSOLETE (thread_count * sizeof (int))); +// OBSOLETE CHK ("Error trying to deallocate thread list", ret); +// OBSOLETE } +// OBSOLETE if (have_emulator_p (task)) +// OBSOLETE printf_filtered (" Emulator at : 0x%x..0x%x\n", +// OBSOLETE EMULATOR_BASE, EMULATOR_END); +// OBSOLETE else +// OBSOLETE printf_filtered (" No emulator.\n"); +// OBSOLETE +// OBSOLETE if (thread_count && task == inferior_task) +// OBSOLETE printf_filtered ("\nUse the \"thread list\" command to see the threads\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* You may either FORWARD the exception to the inferior, or KEEP +// OBSOLETE * it and return to GDB command level. +// OBSOLETE * +// OBSOLETE * exception mid [ forward | keep ] +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE exception_command (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE char *scan = args; +// OBSOLETE int exception; +// OBSOLETE int len; +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE error_no_arg ("exception number action"); +// OBSOLETE +// OBSOLETE while (*scan == ' ' || *scan == '\t') +// OBSOLETE scan++; +// OBSOLETE +// OBSOLETE if ('0' <= *scan && *scan <= '9') +// OBSOLETE while ('0' <= *scan && *scan <= '9') +// OBSOLETE scan++; +// OBSOLETE else +// OBSOLETE error ("exception number action"); +// OBSOLETE +// OBSOLETE exception = atoi (args); +// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION) +// OBSOLETE error ("Allowed exception numbers are in range 1..%d", +// OBSOLETE MAX_EXCEPTION); +// OBSOLETE +// OBSOLETE if (*scan != ' ' && *scan != '\t') +// OBSOLETE error ("exception number must be followed by a space"); +// OBSOLETE else +// OBSOLETE while (*scan == ' ' || *scan == '\t') +// OBSOLETE scan++; +// OBSOLETE +// OBSOLETE args = scan; +// OBSOLETE len = 0; +// OBSOLETE while (*scan) +// OBSOLETE { +// OBSOLETE len++; +// OBSOLETE scan++; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!len) +// OBSOLETE error ("exception number action"); +// OBSOLETE +// OBSOLETE if (!strncasecmp (args, "forward", len)) +// OBSOLETE exception_map[exception].forward = TRUE; +// OBSOLETE else if (!strncasecmp (args, "keep", len)) +// OBSOLETE exception_map[exception].forward = FALSE; +// OBSOLETE else +// OBSOLETE error ("exception action is either \"keep\" or \"forward\""); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE print_exception_info (int exception) +// OBSOLETE { +// OBSOLETE boolean_t forward = exception_map[exception].forward; +// OBSOLETE +// OBSOLETE printf_filtered ("%s\t(%d): ", exception_map[exception].name, +// OBSOLETE exception); +// OBSOLETE if (!forward) +// OBSOLETE if (exception_map[exception].sigmap != SIG_UNKNOWN) +// OBSOLETE printf_filtered ("keep and handle as signal %d\n", +// OBSOLETE exception_map[exception].sigmap); +// OBSOLETE else +// OBSOLETE printf_filtered ("keep and handle as unknown signal %d\n", +// OBSOLETE exception_map[exception].sigmap); +// OBSOLETE else +// OBSOLETE printf_filtered ("forward exception to inferior\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE exception_info (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int exception; +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE for (exception = 1; exception <= MAX_EXCEPTION; exception++) +// OBSOLETE print_exception_info (exception); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE exception = atoi (args); +// OBSOLETE +// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION) +// OBSOLETE error ("Invalid exception number, values from 1 to %d allowed", +// OBSOLETE MAX_EXCEPTION); +// OBSOLETE print_exception_info (exception); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Check for actions for mach exceptions. +// OBSOLETE */ +// OBSOLETE mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who) +// OBSOLETE { +// OBSOLETE boolean_t force_print = FALSE; +// OBSOLETE +// OBSOLETE +// OBSOLETE if (force_print_only || +// OBSOLETE exception_map[stop_exception].sigmap == SIG_UNKNOWN) +// OBSOLETE force_print = TRUE; +// OBSOLETE else +// OBSOLETE WSETSTOP (*w, exception_map[stop_exception].sigmap); +// OBSOLETE +// OBSOLETE if (exception_map[stop_exception].print || force_print) +// OBSOLETE { +// OBSOLETE target_terminal_ours (); +// OBSOLETE +// OBSOLETE printf_filtered ("\n%s received %s exception : ", +// OBSOLETE who, +// OBSOLETE exception_map[stop_exception].name); +// OBSOLETE +// OBSOLETE wrap_here (" "); +// OBSOLETE +// OBSOLETE switch (stop_exception) +// OBSOLETE { +// OBSOLETE case EXC_BAD_ACCESS: +// OBSOLETE printf_filtered ("referencing address 0x%x : %s\n", +// OBSOLETE stop_subcode, +// OBSOLETE mach_error_string (stop_code)); +// OBSOLETE break; +// OBSOLETE case EXC_BAD_INSTRUCTION: +// OBSOLETE printf_filtered +// OBSOLETE ("illegal or undefined instruction. code %d subcode %d\n", +// OBSOLETE stop_code, stop_subcode); +// OBSOLETE break; +// OBSOLETE case EXC_ARITHMETIC: +// OBSOLETE printf_filtered ("code %d\n", stop_code); +// OBSOLETE break; +// OBSOLETE case EXC_EMULATION: +// OBSOLETE printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode); +// OBSOLETE break; +// OBSOLETE case EXC_SOFTWARE: +// OBSOLETE printf_filtered ("%s specific, code 0x%x\n", +// OBSOLETE stop_code < 0xffff ? "hardware" : "os emulation", +// OBSOLETE stop_code); +// OBSOLETE break; +// OBSOLETE case EXC_BREAKPOINT: +// OBSOLETE printf_filtered ("type %d (machine dependent)\n", +// OBSOLETE stop_code); +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "Unknown exception"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE setup_notify_port (int create_new) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (MACH_PORT_VALID (our_notify_port)) +// OBSOLETE { +// OBSOLETE ret = mach_port_destroy (mach_task_self (), our_notify_port); +// OBSOLETE CHK ("Could not destroy our_notify_port", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE our_notify_port = MACH_PORT_NULL; +// OBSOLETE notify_chain = (port_chain_t) NULL; +// OBSOLETE port_chain_destroy (port_chain_obstack); +// OBSOLETE +// OBSOLETE if (create_new) +// OBSOLETE { +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &our_notify_port); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "Creating notify port %s", mach_error_string (ret)); +// OBSOLETE +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE our_notify_port, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "initial move member %s", mach_error_string (ret)); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Register our message port to the net name server +// OBSOLETE * +// OBSOLETE * Currently used only by the external stop-gdb program +// OBSOLETE * since ^C does not work if you would like to enter +// OBSOLETE * gdb command level while debugging your program. +// OBSOLETE * +// OBSOLETE * NOTE: If the message port is sometimes used for other +// OBSOLETE * purposes also, the NAME must not be a guessable one. +// OBSOLETE * Then, there should be a way to change it. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE char registered_name[MAX_NAME_LEN]; +// OBSOLETE +// OBSOLETE void +// OBSOLETE message_port_info (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE if (registered_name[0]) +// OBSOLETE printf_filtered ("gdb's message port name: '%s'\n", +// OBSOLETE registered_name); +// OBSOLETE else +// OBSOLETE printf_filtered ("gdb's message port is not currently registered\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE gdb_register_port (char *name, mach_port_t port) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE static int already_signed = 0; +// OBSOLETE int len; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (port) || !name || !*name) +// OBSOLETE { +// OBSOLETE warning ("Invalid registration request"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!already_signed) +// OBSOLETE { +// OBSOLETE ret = mach_port_insert_right (mach_task_self (), +// OBSOLETE our_message_port, +// OBSOLETE our_message_port, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); +// OBSOLETE CHK ("Failed to create a signature to our_message_port", ret); +// OBSOLETE already_signed = 1; +// OBSOLETE } +// OBSOLETE else if (already_signed > 1) +// OBSOLETE { +// OBSOLETE ret = netname_check_out (name_server_port, +// OBSOLETE registered_name, +// OBSOLETE our_message_port); +// OBSOLETE CHK ("Failed to check out gdb's message port", ret); +// OBSOLETE registered_name[0] = '\000'; +// OBSOLETE already_signed = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = netname_check_in (name_server_port, /* Name server port */ +// OBSOLETE name, /* Name of service */ +// OBSOLETE our_message_port, /* Signature */ +// OBSOLETE port); /* Creates a new send right */ +// OBSOLETE CHK ("Failed to check in the port", ret); +// OBSOLETE +// OBSOLETE len = 0; +// OBSOLETE while (len < MAX_NAME_LEN && *(name + len)) +// OBSOLETE { +// OBSOLETE registered_name[len] = *(name + len); +// OBSOLETE len++; +// OBSOLETE } +// OBSOLETE registered_name[len] = '\000'; +// OBSOLETE already_signed = 2; +// OBSOLETE } +// OBSOLETE +// OBSOLETE struct cmd_list_element *cmd_thread_list; +// OBSOLETE struct cmd_list_element *cmd_task_list; +// OBSOLETE +// OBSOLETE /*ARGSUSED */ +// OBSOLETE static void +// OBSOLETE thread_command (char *arg, int from_tty) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n"); +// OBSOLETE help_list (cmd_thread_list, "thread ", -1, gdb_stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /*ARGSUSED */ +// OBSOLETE static void +// OBSOLETE task_command (char *arg, int from_tty) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\"task\" must be followed by the name of a task command.\n"); +// OBSOLETE help_list (cmd_task_list, "task ", -1, gdb_stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE add_mach_specific_commands (void) +// OBSOLETE { +// OBSOLETE /* Thread handling commands */ +// OBSOLETE +// OBSOLETE /* FIXME: Move our thread support into the generic thread.c stuff so we +// OBSOLETE can share that code. */ +// OBSOLETE add_prefix_cmd ("mthread", class_stack, thread_command, +// OBSOLETE "Generic command for handling Mach threads in the debugged task.", +// OBSOLETE &cmd_thread_list, "thread ", 0, &cmdlist); +// OBSOLETE +// OBSOLETE add_com_alias ("th", "mthread", class_stack, 1); +// OBSOLETE +// OBSOLETE add_cmd ("select", class_stack, thread_select_command, +// OBSOLETE "Select and print MID of the selected thread", +// OBSOLETE &cmd_thread_list); +// OBSOLETE add_cmd ("list", class_stack, thread_list_command, +// OBSOLETE "List info of task's threads. Selected thread is marked with '*'", +// OBSOLETE &cmd_thread_list); +// OBSOLETE add_cmd ("suspend", class_run, thread_suspend_command, +// OBSOLETE "Suspend one or all of the threads in the selected task.", +// OBSOLETE &cmd_thread_list); +// OBSOLETE add_cmd ("resume", class_run, thread_resume_command, +// OBSOLETE "Resume one or all of the threads in the selected task.", +// OBSOLETE &cmd_thread_list); +// OBSOLETE add_cmd ("kill", class_run, thread_kill_command, +// OBSOLETE "Kill the specified thread MID from inferior task.", +// OBSOLETE &cmd_thread_list); +// OBSOLETE #if 0 +// OBSOLETE /* The rest of this support (condition_thread) was not merged. It probably +// OBSOLETE should not be merged in this form, but instead added to the generic GDB +// OBSOLETE thread support. */ +// OBSOLETE add_cmd ("break", class_breakpoint, condition_thread, +// OBSOLETE "Breakpoint N will only be effective for thread MID or @SLOT\n\ +// OBSOLETE If MID/@SLOT is omitted allow all threads to break at breakpoint", +// OBSOLETE &cmd_thread_list); +// OBSOLETE #endif +// OBSOLETE /* Thread command shorthands (for backward compatibility) */ +// OBSOLETE add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist); +// OBSOLETE add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist); +// OBSOLETE +// OBSOLETE /* task handling commands */ +// OBSOLETE +// OBSOLETE add_prefix_cmd ("task", class_stack, task_command, +// OBSOLETE "Generic command for handling debugged task.", +// OBSOLETE &cmd_task_list, "task ", 0, &cmdlist); +// OBSOLETE +// OBSOLETE add_com_alias ("ta", "task", class_stack, 1); +// OBSOLETE +// OBSOLETE add_cmd ("suspend", class_run, task_suspend_command, +// OBSOLETE "Suspend the inferior task.", +// OBSOLETE &cmd_task_list); +// OBSOLETE add_cmd ("resume", class_run, task_resume_command, +// OBSOLETE "Resume the inferior task.", +// OBSOLETE &cmd_task_list); +// OBSOLETE add_cmd ("info", no_class, task_info_command, +// OBSOLETE "Print information about the specified task.", +// OBSOLETE &cmd_task_list); +// OBSOLETE +// OBSOLETE /* Print my message port name */ +// OBSOLETE +// OBSOLETE add_info ("message-port", message_port_info, +// OBSOLETE "Returns the name of gdb's message port in the netnameserver"); +// OBSOLETE +// OBSOLETE /* Exception commands */ +// OBSOLETE +// OBSOLETE add_info ("exceptions", exception_info, +// OBSOLETE "What debugger does when program gets various exceptions.\n\ +// OBSOLETE Specify an exception number as argument to print info on that\n\ +// OBSOLETE exception only."); +// OBSOLETE +// OBSOLETE add_com ("exception", class_run, exception_command, +// OBSOLETE "Specify how to handle an exception.\n\ +// OBSOLETE Args are exception number followed by \"forward\" or \"keep\".\n\ +// OBSOLETE `Forward' means forward the exception to the program's normal exception\n\ +// OBSOLETE handler.\n\ +// OBSOLETE `Keep' means reenter debugger if this exception happens, and GDB maps\n\ +// OBSOLETE the exception to some signal (see info exception)\n\ +// OBSOLETE Normally \"keep\" is used to return to GDB on exception."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_dead_name (mach_port_t notify, mach_port_t name) +// OBSOLETE { +// OBSOLETE kern_return_t kr = KERN_SUCCESS; +// OBSOLETE +// OBSOLETE /* Find the thing that notified */ +// OBSOLETE port_chain_t element = port_chain_member (notify_chain, name); +// OBSOLETE +// OBSOLETE /* Take name of from unreceived dead name notification list */ +// OBSOLETE notify_chain = port_chain_delete (notify_chain, name); +// OBSOLETE +// OBSOLETE if (!element) +// OBSOLETE error ("Received a dead name notify from unchained port (0x%x)", name); +// OBSOLETE +// OBSOLETE switch (element->type) +// OBSOLETE { +// OBSOLETE +// OBSOLETE case MACH_TYPE_THREAD: +// OBSOLETE target_terminal_ours_for_output (); +// OBSOLETE if (name == current_thread) +// OBSOLETE { +// OBSOLETE printf_filtered ("\nCurrent thread %d died", element->mid); +// OBSOLETE current_thread = MACH_PORT_NULL; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE printf_filtered ("\nThread %d died", element->mid); +// OBSOLETE +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case MACH_TYPE_TASK: +// OBSOLETE target_terminal_ours_for_output (); +// OBSOLETE if (name != inferior_task) +// OBSOLETE printf_filtered ("Task %d died, but it was not the selected task", +// OBSOLETE element->mid); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE printf_filtered ("Current task %d died", element->mid); +// OBSOLETE +// OBSOLETE mach_port_destroy (mach_task_self (), name); +// OBSOLETE inferior_task = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE if (notify_chain) +// OBSOLETE warning ("There were still unreceived dead_name_notifications???"); +// OBSOLETE +// OBSOLETE /* Destroy the old notifications */ +// OBSOLETE setup_notify_port (0); +// OBSOLETE +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x", +// OBSOLETE name, element->type, element->mid); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name) +// OBSOLETE { +// OBSOLETE warning ("do_mach_notify_msg_accepted : notify %x, name %x", +// OBSOLETE notify, name); +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount) +// OBSOLETE { +// OBSOLETE warning ("do_mach_notify_no_senders : notify %x, mscount %x", +// OBSOLETE notify, mscount); +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name) +// OBSOLETE { +// OBSOLETE warning ("do_mach_notify_port_deleted : notify %x, name %x", +// OBSOLETE notify, name); +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights) +// OBSOLETE { +// OBSOLETE warning ("do_mach_notify_port_destroyed : notify %x, rights %x", +// OBSOLETE notify, rights); +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE kern_return_t +// OBSOLETE do_mach_notify_send_once (mach_port_t notify) +// OBSOLETE { +// OBSOLETE #ifdef DUMP_SYSCALL +// OBSOLETE /* MANY of these are generated. */ +// OBSOLETE warning ("do_mach_notify_send_once : notify %x", +// OBSOLETE notify); +// OBSOLETE #endif +// OBSOLETE return KERN_SUCCESS; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Kills the inferior. It's gone when you call this */ +// OBSOLETE static void +// OBSOLETE kill_inferior_fast (void) +// OBSOLETE { +// OBSOLETE WAITTYPE w; +// OBSOLETE +// OBSOLETE if (PIDGET (inferior_ptid) == 0 || PIDGET (inferior_ptid) == 1) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE /* kill() it, since the Unix server does not otherwise notice when +// OBSOLETE * killed with task_terminate(). +// OBSOLETE */ +// OBSOLETE if (PIDGET (inferior_ptid) > 0) +// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL); +// OBSOLETE +// OBSOLETE /* It's propably terminate already */ +// OBSOLETE (void) task_terminate (inferior_task); +// OBSOLETE +// OBSOLETE inferior_task = MACH_PORT_NULL; +// OBSOLETE current_thread = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE wait3 (&w, WNOHANG, 0); +// OBSOLETE +// OBSOLETE setup_notify_port (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_kill_inferior (void) +// OBSOLETE { +// OBSOLETE kill_inferior_fast (); +// OBSOLETE target_mourn_inferior (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Clean up after the inferior dies. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_mourn_inferior (void) +// OBSOLETE { +// OBSOLETE unpush_target (&m3_ops); +// OBSOLETE generic_mourn_inferior (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Fork an inferior process, and start debugging it. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_create_inferior (char *exec_file, char *allargs, char **env) +// OBSOLETE { +// OBSOLETE fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL); +// OBSOLETE /* We are at the first instruction we care about. */ +// OBSOLETE /* Pedal to the metal... */ +// OBSOLETE proceed ((CORE_ADDR) -1, 0, 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Mark our target-struct as eligible for stray "run" and "attach" +// OBSOLETE commands. */ +// OBSOLETE static int +// OBSOLETE m3_can_run (void) +// OBSOLETE { +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Mach 3.0 does not need ptrace for anything +// OBSOLETE * Make sure nobody uses it on mach. +// OBSOLETE */ +// OBSOLETE ptrace (int a, int b, int c, int d) +// OBSOLETE { +// OBSOLETE error ("Lose, Lose! Somebody called ptrace\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Resume execution of the inferior process. +// OBSOLETE If STEP is nonzero, single-step it. +// OBSOLETE If SIGNAL is nonzero, give it that signal. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE m3_resume (ptid_t ptid, int step, enum target_signal signal) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (step) +// OBSOLETE { +// OBSOLETE thread_basic_info_data_t th_info; +// OBSOLETE unsigned int infoCnt = THREAD_BASIC_INFO_COUNT; +// OBSOLETE +// OBSOLETE /* There is no point in single stepping when current_thread +// OBSOLETE * is dead. +// OBSOLETE */ +// OBSOLETE if (!MACH_PORT_VALID (current_thread)) +// OBSOLETE error ("No thread selected; can not single step"); +// OBSOLETE +// OBSOLETE /* If current_thread is suspended, tracing it would never return. +// OBSOLETE */ +// OBSOLETE ret = thread_info (current_thread, +// OBSOLETE THREAD_BASIC_INFO, +// OBSOLETE (thread_info_t) & th_info, +// OBSOLETE &infoCnt); +// OBSOLETE CHK ("child_resume: can't get thread info", ret); +// OBSOLETE +// OBSOLETE if (th_info.suspend_count) +// OBSOLETE error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE vm_read_cache_valid = FALSE; +// OBSOLETE +// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0) /* Do not signal, if attached by MID */ +// OBSOLETE kill (PIDGET (inferior_ptid), target_signal_to_host (signal)); +// OBSOLETE +// OBSOLETE if (step) +// OBSOLETE { +// OBSOLETE suspend_all_threads (0); +// OBSOLETE +// OBSOLETE setup_single_step (current_thread, TRUE); +// OBSOLETE +// OBSOLETE ret = thread_resume (current_thread); +// OBSOLETE CHK ("thread_resume", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = task_resume (inferior_task); +// OBSOLETE if (ret == KERN_FAILURE) +// OBSOLETE warning ("Task was not suspended"); +// OBSOLETE else +// OBSOLETE CHK ("Resuming task", ret); +// OBSOLETE +// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */ +// OBSOLETE while ((ret = task_resume (inferior_task)) == KERN_SUCCESS) +// OBSOLETE /* make sure it really runs */ ; +// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef ATTACH_DETACH +// OBSOLETE +// OBSOLETE /* Start debugging the process with the given task */ +// OBSOLETE void +// OBSOLETE task_attach (task_t tid) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE inferior_task = tid; +// OBSOLETE +// OBSOLETE ret = task_suspend (inferior_task); +// OBSOLETE CHK ("task_attach: task_suspend", ret); +// OBSOLETE +// OBSOLETE must_suspend_thread = 0; +// OBSOLETE +// OBSOLETE setup_notify_port (1); +// OBSOLETE +// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK); +// OBSOLETE +// OBSOLETE setup_exception_port (); +// OBSOLETE +// OBSOLETE emulator_present = have_emulator_p (inferior_task); +// OBSOLETE +// OBSOLETE attach_flag = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Well, we can call error also here and leave the +// OBSOLETE * target stack inconsistent. Sigh. +// OBSOLETE * Fix this sometime (the only way to fail here is that +// OBSOLETE * the task has no threads at all, which is rare, but +// OBSOLETE * possible; or if the target task has died, which is also +// OBSOLETE * possible, but unlikely, since it has been suspended. +// OBSOLETE * (Someone must have killed it)) +// OBSOLETE */ +// OBSOLETE void +// OBSOLETE attach_to_thread (void) +// OBSOLETE { +// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) +// OBSOLETE error ("Could not select any threads to attach to"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE mid_attach (int mid) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task); +// OBSOLETE CHK ("mid_attach: machid_mach_port", ret); +// OBSOLETE +// OBSOLETE task_attach (inferior_task); +// OBSOLETE +// OBSOLETE return mid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Start debugging the process whose unix process-id is PID. +// OBSOLETE * A negative "pid" value is legal and signifies a mach_id not a unix pid. +// OBSOLETE * +// OBSOLETE * Prevent (possible unwanted) dangerous operations by enabled users +// OBSOLETE * like "atta 0" or "atta foo" (equal to the previous :-) and +// OBSOLETE * "atta pidself". Anyway, the latter is allowed by specifying a MID. +// OBSOLETE */ +// OBSOLETE static int +// OBSOLETE m3_do_attach (int pid) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (pid == 0) +// OBSOLETE error ("MID=0, Debugging the master unix server does not compute"); +// OBSOLETE +// OBSOLETE /* Foo. This assumes gdb has a unix pid */ +// OBSOLETE if (pid == getpid ()) +// OBSOLETE error ("I will debug myself only by mid. (Gdb would suspend itself!)"); +// OBSOLETE +// OBSOLETE if (pid < 0) +// OBSOLETE { +// OBSOLETE mid_attach (-(pid)); +// OBSOLETE +// OBSOLETE /* inferior_ptid will be NEGATIVE! */ +// OBSOLETE inferior_ptid = pid_to_ptid (pid); +// OBSOLETE +// OBSOLETE return PIDGET (inferior_ptid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE inferior_task = task_by_pid (pid); +// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) +// OBSOLETE error ("Cannot map Unix pid %d to Mach task port", pid); +// OBSOLETE +// OBSOLETE task_attach (inferior_task); +// OBSOLETE +// OBSOLETE inferior_ptid = pid_to_ptid (pid); +// OBSOLETE +// OBSOLETE return PIDGET (inferior_ptid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Attach to process PID, then initialize for debugging it +// OBSOLETE and wait for the trace-trap that results from attaching. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_attach (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE char *exec_file; +// OBSOLETE int pid; +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE error_no_arg ("process-id to attach"); +// OBSOLETE +// OBSOLETE pid = atoi (args); +// OBSOLETE +// OBSOLETE if (pid == getpid ()) /* Trying to masturbate? */ +// OBSOLETE error ("I refuse to debug myself!"); +// OBSOLETE +// OBSOLETE if (from_tty) +// OBSOLETE { +// OBSOLETE exec_file = (char *) get_exec_file (0); +// OBSOLETE +// OBSOLETE if (exec_file) +// OBSOLETE printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, +// OBSOLETE target_pid_to_str (pid_to_ptid (pid))); +// OBSOLETE else +// OBSOLETE printf_unfiltered ("Attaching to %s\n", +// OBSOLETE target_pid_to_str (pid_to_ptid (pid))); +// OBSOLETE +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE m3_do_attach (pid_to_ptid (pid)); +// OBSOLETE inferior_ptid = pid_to_ptid (pid); +// OBSOLETE push_target (&m3_ops); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE deallocate_inferior_ports (void) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE thread_array_t thread_list; +// OBSOLETE int thread_count, index; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (inferior_task)) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE warning ("deallocate_inferior_ports: task_threads", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Get rid of send rights to task threads */ +// OBSOLETE for (index = 0; index < thread_count; index++) +// OBSOLETE { +// OBSOLETE int rights; +// OBSOLETE ret = mach_port_get_refs (mach_task_self (), +// OBSOLETE thread_list[index], +// OBSOLETE MACH_PORT_RIGHT_SEND, +// OBSOLETE &rights); +// OBSOLETE CHK ("deallocate_inferior_ports: get refs", ret); +// OBSOLETE +// OBSOLETE if (rights > 0) +// OBSOLETE { +// OBSOLETE ret = mach_port_mod_refs (mach_task_self (), +// OBSOLETE thread_list[index], +// OBSOLETE MACH_PORT_RIGHT_SEND, +// OBSOLETE -rights); +// OBSOLETE CHK ("deallocate_inferior_ports: mod refs", ret); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = mach_port_mod_refs (mach_task_self (), +// OBSOLETE inferior_exception_port, +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE -1); +// OBSOLETE CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_deallocate (mach_task_self (), +// OBSOLETE inferior_task); +// OBSOLETE CHK ("deallocate_task_port: deallocating inferior_task", ret); +// OBSOLETE +// OBSOLETE current_thread = MACH_PORT_NULL; +// OBSOLETE inferior_task = MACH_PORT_NULL; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Stop debugging the process whose number is PID +// OBSOLETE and continue it with signal number SIGNAL. +// OBSOLETE SIGNAL = 0 means just continue it. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_do_detach (int signal) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE MACH_ERROR_NO_INFERIOR; +// OBSOLETE +// OBSOLETE if (current_thread != MACH_PORT_NULL) +// OBSOLETE { +// OBSOLETE /* Store the gdb's view of the thread we are deselecting +// OBSOLETE * before we detach. +// OBSOLETE * @@ I am really not sure if this is ever needeed. +// OBSOLETE */ +// OBSOLETE target_prepare_to_store (); +// OBSOLETE target_store_registers (-1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE ret = task_set_special_port (inferior_task, +// OBSOLETE TASK_EXCEPTION_PORT, +// OBSOLETE inferior_old_exception_port); +// OBSOLETE CHK ("task_set_special_port", ret); +// OBSOLETE +// OBSOLETE /* Discard all requested notifications */ +// OBSOLETE setup_notify_port (0); +// OBSOLETE +// OBSOLETE if (remove_breakpoints ()) +// OBSOLETE warning ("Could not remove breakpoints when detaching"); +// OBSOLETE +// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0) +// OBSOLETE kill (PIDGET (inferior_ptid), signal); +// OBSOLETE +// OBSOLETE /* the task might be dead by now */ +// OBSOLETE (void) task_resume (inferior_task); +// OBSOLETE +// OBSOLETE deallocate_inferior_ports (); +// OBSOLETE +// OBSOLETE attach_flag = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Take a program previously attached to and detaches it. +// OBSOLETE The program resumes execution and will no longer stop +// OBSOLETE on signals, etc. We'd better not have left any breakpoints +// OBSOLETE in the program or it'll die when it hits one. For this +// OBSOLETE to work, it may be necessary for the process to have been +// OBSOLETE previously attached. It *might* work if the program was +// OBSOLETE started via fork. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_detach (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE int siggnal = 0; +// OBSOLETE +// OBSOLETE if (from_tty) +// OBSOLETE { +// OBSOLETE char *exec_file = get_exec_file (0); +// OBSOLETE if (exec_file == 0) +// OBSOLETE exec_file = ""; +// OBSOLETE printf_unfiltered ("Detaching from program: %s %s\n", +// OBSOLETE exec_file, target_pid_to_str (inferior_ptid)); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE if (args) +// OBSOLETE siggnal = atoi (args); +// OBSOLETE +// OBSOLETE m3_do_detach (siggnal); +// OBSOLETE inferior_ptid = null_ptid; +// OBSOLETE unpush_target (&m3_ops); /* Pop out of handling an inferior */ +// OBSOLETE } +// OBSOLETE #endif /* ATTACH_DETACH */ +// OBSOLETE +// OBSOLETE /* Get ready to modify the registers array. On machines which store +// OBSOLETE individual registers, this doesn't need to do anything. On machines +// OBSOLETE which store all the registers in one fell swoop, this makes sure +// OBSOLETE that registers contains all the registers from the program being +// OBSOLETE debugged. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_prepare_to_store (void) +// OBSOLETE { +// OBSOLETE #ifdef CHILD_PREPARE_TO_STORE +// OBSOLETE CHILD_PREPARE_TO_STORE (); +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Print status information about what we're accessing. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_files_info (struct target_ops *ignore) +// OBSOLETE { +// OBSOLETE /* FIXME: should print MID and all that crap. */ +// OBSOLETE printf_unfiltered ("\tUsing the running image of %s %s.\n", +// OBSOLETE attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_open (char *arg, int from_tty) +// OBSOLETE { +// OBSOLETE error ("Use the \"run\" command to start a Unix child process."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef DUMP_SYSCALL +// OBSOLETE #define STR(x) #x +// OBSOLETE +// OBSOLETE char *bsd1_names[] = +// OBSOLETE { +// OBSOLETE "execve", +// OBSOLETE "fork", +// OBSOLETE "take_signal", +// OBSOLETE "sigreturn", +// OBSOLETE "getrusage", +// OBSOLETE "chdir", +// OBSOLETE "chroot", +// OBSOLETE "open", +// OBSOLETE "creat", +// OBSOLETE "mknod", +// OBSOLETE "link", +// OBSOLETE "symlink", +// OBSOLETE "unlink", +// OBSOLETE "access", +// OBSOLETE "stat", +// OBSOLETE "readlink", +// OBSOLETE "chmod", +// OBSOLETE "chown", +// OBSOLETE "utimes", +// OBSOLETE "truncate", +// OBSOLETE "rename", +// OBSOLETE "mkdir", +// OBSOLETE "rmdir", +// OBSOLETE "xutimes", +// OBSOLETE "mount", +// OBSOLETE "umount", +// OBSOLETE "acct", +// OBSOLETE "setquota", +// OBSOLETE "write_short", +// OBSOLETE "write_long", +// OBSOLETE "send_short", +// OBSOLETE "send_long", +// OBSOLETE "sendto_short", +// OBSOLETE "sendto_long", +// OBSOLETE "select", +// OBSOLETE "task_by_pid", +// OBSOLETE "recvfrom_short", +// OBSOLETE "recvfrom_long", +// OBSOLETE "setgroups", +// OBSOLETE "setrlimit", +// OBSOLETE "sigvec", +// OBSOLETE "sigstack", +// OBSOLETE "settimeofday", +// OBSOLETE "adjtime", +// OBSOLETE "setitimer", +// OBSOLETE "sethostname", +// OBSOLETE "bind", +// OBSOLETE "accept", +// OBSOLETE "connect", +// OBSOLETE "setsockopt", +// OBSOLETE "getsockopt", +// OBSOLETE "getsockname", +// OBSOLETE "getpeername", +// OBSOLETE "init_process", +// OBSOLETE "table_set", +// OBSOLETE "table_get", +// OBSOLETE "pioctl", +// OBSOLETE "emulator_error", +// OBSOLETE "readwrite", +// OBSOLETE "share_wakeup", +// OBSOLETE 0, +// OBSOLETE "maprw_request_it", +// OBSOLETE "maprw_release_it", +// OBSOLETE "maprw_remap", +// OBSOLETE "pid_by_task", +// OBSOLETE }; +// OBSOLETE +// OBSOLETE int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]); +// OBSOLETE +// OBSOLETE char * +// OBSOLETE name_str (int name, char *buf) +// OBSOLETE { +// OBSOLETE switch (name) +// OBSOLETE { +// OBSOLETE case MACH_MSG_TYPE_BOOLEAN: +// OBSOLETE return "boolean"; +// OBSOLETE case MACH_MSG_TYPE_INTEGER_16: +// OBSOLETE return "short"; +// OBSOLETE case MACH_MSG_TYPE_INTEGER_32: +// OBSOLETE return "long"; +// OBSOLETE case MACH_MSG_TYPE_CHAR: +// OBSOLETE return "char"; +// OBSOLETE case MACH_MSG_TYPE_BYTE: +// OBSOLETE return "byte"; +// OBSOLETE case MACH_MSG_TYPE_REAL: +// OBSOLETE return "real"; +// OBSOLETE case MACH_MSG_TYPE_STRING: +// OBSOLETE return "string"; +// OBSOLETE default: +// OBSOLETE sprintf (buf, "%d", name); +// OBSOLETE return buf; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE char * +// OBSOLETE id_str (int id, char *buf) +// OBSOLETE { +// OBSOLETE char *p; +// OBSOLETE if (id >= 101000 && id < 101000 + bsd1_nnames) +// OBSOLETE { +// OBSOLETE if (p = bsd1_names[id - 101000]) +// OBSOLETE return p; +// OBSOLETE } +// OBSOLETE if (id == 102000) +// OBSOLETE return "psignal_retry"; +// OBSOLETE if (id == 100000) +// OBSOLETE return "syscall"; +// OBSOLETE sprintf (buf, "%d", id); +// OBSOLETE return buf; +// OBSOLETE } +// OBSOLETE +// OBSOLETE print_msg (mach_msg_header_t *mp) +// OBSOLETE { +// OBSOLETE char *fmt_x = "%20s : 0x%08x\n"; +// OBSOLETE char *fmt_d = "%20s : %10d\n"; +// OBSOLETE char *fmt_s = "%20s : %s\n"; +// OBSOLETE char buf[100]; +// OBSOLETE +// OBSOLETE puts_filtered ("\n"); +// OBSOLETE #define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x) +// OBSOLETE pr (fmt_x, (*mp), msgh_bits); +// OBSOLETE pr (fmt_d, (*mp), msgh_size); +// OBSOLETE pr (fmt_x, (*mp), msgh_remote_port); +// OBSOLETE pr (fmt_x, (*mp), msgh_local_port); +// OBSOLETE pr (fmt_d, (*mp), msgh_kind); +// OBSOLETE printf_filtered (fmt_s, STR (msgh_id), id_str (mp->msgh_id, buf)); +// OBSOLETE +// OBSOLETE if (debug_level > 1) +// OBSOLETE { +// OBSOLETE char *p, *ep, *dp; +// OBSOLETE int plen; +// OBSOLETE p = (char *) mp; +// OBSOLETE ep = p + mp->msgh_size; +// OBSOLETE p += sizeof (*mp); +// OBSOLETE for (; p < ep; p += plen) +// OBSOLETE { +// OBSOLETE mach_msg_type_t *tp; +// OBSOLETE mach_msg_type_long_t *tlp; +// OBSOLETE int name, size, number; +// OBSOLETE tp = (mach_msg_type_t *) p; +// OBSOLETE if (tp->msgt_longform) +// OBSOLETE { +// OBSOLETE tlp = (mach_msg_type_long_t *) tp; +// OBSOLETE name = tlp->msgtl_name; +// OBSOLETE size = tlp->msgtl_size; +// OBSOLETE number = tlp->msgtl_number; +// OBSOLETE plen = sizeof (*tlp); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE name = tp->msgt_name; +// OBSOLETE size = tp->msgt_size; +// OBSOLETE number = tp->msgt_number; +// OBSOLETE plen = sizeof (*tp); +// OBSOLETE } +// OBSOLETE printf_filtered ("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n", +// OBSOLETE name_str (name, buf), size, number, tp->msgt_inline, +// OBSOLETE tp->msgt_longform, tp->msgt_deallocate); +// OBSOLETE dp = p + plen; +// OBSOLETE if (tp->msgt_inline) +// OBSOLETE { +// OBSOLETE int l; +// OBSOLETE l = size * number / 8; +// OBSOLETE l = (l + sizeof (long) - 1) & ~((sizeof (long)) - 1); +// OBSOLETE plen += l; +// OBSOLETE print_data (dp, size, number); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE plen += sizeof (int *); +// OBSOLETE } +// OBSOLETE printf_filtered ("plen=%d\n", plen); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE print_data (char *p, int size, int number) +// OBSOLETE { +// OBSOLETE int *ip; +// OBSOLETE short *sp; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE switch (size) +// OBSOLETE { +// OBSOLETE case 8: +// OBSOLETE for (i = 0; i < number; i++) +// OBSOLETE { +// OBSOLETE printf_filtered (" %02x", p[i]); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE case 16: +// OBSOLETE sp = (short *) p; +// OBSOLETE for (i = 0; i < number; i++) +// OBSOLETE { +// OBSOLETE printf_filtered (" %04x", sp[i]); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE case 32: +// OBSOLETE ip = (int *) p; +// OBSOLETE for (i = 0; i < number; i++) +// OBSOLETE { +// OBSOLETE printf_filtered (" %08x", ip[i]); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE puts_filtered ("\n"); +// OBSOLETE } +// OBSOLETE #endif /* DUMP_SYSCALL */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE m3_stop (void) +// OBSOLETE { +// OBSOLETE error ("to_stop target function not implemented"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE m3_pid_to_exec_file (int pid) +// OBSOLETE { +// OBSOLETE error ("to_pid_to_exec_file target function not implemented"); +// OBSOLETE return NULL; /* To keep all compilers happy. */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE init_m3_ops (void) +// OBSOLETE { +// OBSOLETE m3_ops.to_shortname = "mach"; +// OBSOLETE m3_ops.to_longname = "Mach child process"; +// OBSOLETE m3_ops.to_doc = "Mach child process (started by the \"run\" command)."; +// OBSOLETE m3_ops.to_open = m3_open; +// OBSOLETE m3_ops.to_attach = m3_attach; +// OBSOLETE m3_ops.to_detach = m3_detach; +// OBSOLETE m3_ops.to_resume = m3_resume; +// OBSOLETE m3_ops.to_wait = mach_really_wait; +// OBSOLETE m3_ops.to_fetch_registers = fetch_inferior_registers; +// OBSOLETE m3_ops.to_store_registers = store_inferior_registers; +// OBSOLETE m3_ops.to_prepare_to_store = m3_prepare_to_store; +// OBSOLETE m3_ops.to_xfer_memory = m3_xfer_memory; +// OBSOLETE m3_ops.to_files_info = m3_files_info; +// OBSOLETE m3_ops.to_insert_breakpoint = memory_insert_breakpoint; +// OBSOLETE m3_ops.to_remove_breakpoint = memory_remove_breakpoint; +// OBSOLETE m3_ops.to_terminal_init = terminal_init_inferior; +// OBSOLETE m3_ops.to_terminal_inferior = terminal_inferior; +// OBSOLETE m3_ops.to_terminal_ours_for_output = terminal_ours_for_output; +// OBSOLETE m3_ops.to_terminal_save_ours = terminal_save_ours; +// OBSOLETE m3_ops.to_terminal_ours = terminal_ours; +// OBSOLETE m3_ops.to_terminal_info = child_terminal_info; +// OBSOLETE m3_ops.to_kill = m3_kill_inferior; +// OBSOLETE m3_ops.to_create_inferior = m3_create_inferior; +// OBSOLETE m3_ops.to_mourn_inferior = m3_mourn_inferior; +// OBSOLETE m3_ops.to_can_run = m3_can_run; +// OBSOLETE m3_ops.to_stop = m3_stop; +// OBSOLETE m3_ops.to_pid_to_exec_file = m3_pid_to_exec_file; +// OBSOLETE m3_ops.to_stratum = process_stratum; +// OBSOLETE m3_ops.to_has_all_memory = 1; +// OBSOLETE m3_ops.to_has_memory = 1; +// OBSOLETE m3_ops.to_has_stack = 1; +// OBSOLETE m3_ops.to_has_registers = 1; +// OBSOLETE m3_ops.to_has_execution = 1; +// OBSOLETE m3_ops.to_magic = OPS_MAGIC; +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_m3_nat (void) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE init_m3_ops (); +// OBSOLETE add_target (&m3_ops); +// OBSOLETE +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_PORT_SET, +// OBSOLETE &inferior_wait_port_set); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "initial port set %s", mach_error_string (ret)); +// OBSOLETE +// OBSOLETE /* mach_really_wait now waits for this */ +// OBSOLETE currently_waiting_for = inferior_wait_port_set; +// OBSOLETE +// OBSOLETE ret = netname_look_up (name_server_port, hostname, "MachID", &mid_server); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE { +// OBSOLETE mid_server = MACH_PORT_NULL; +// OBSOLETE +// OBSOLETE warning ("initialize machid: netname_lookup_up(MachID) : %s", +// OBSOLETE mach_error_string (ret)); +// OBSOLETE warning ("Some (most?) features disabled..."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE mid_auth = mach_privileged_host_port (); +// OBSOLETE if (mid_auth == MACH_PORT_NULL) +// OBSOLETE mid_auth = mach_task_self (); +// OBSOLETE +// OBSOLETE obstack_init (port_chain_obstack); +// OBSOLETE +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &thread_exception_port); +// OBSOLETE CHK ("Creating thread_exception_port for single stepping", ret); +// OBSOLETE +// OBSOLETE ret = mach_port_insert_right (mach_task_self (), +// OBSOLETE thread_exception_port, +// OBSOLETE thread_exception_port, +// OBSOLETE MACH_MSG_TYPE_MAKE_SEND); +// OBSOLETE CHK ("Inserting send right to thread_exception_port", ret); +// OBSOLETE +// OBSOLETE /* Allocate message port */ +// OBSOLETE ret = mach_port_allocate (mach_task_self (), +// OBSOLETE MACH_PORT_RIGHT_RECEIVE, +// OBSOLETE &our_message_port); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("Creating message port %s", mach_error_string (ret)); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE char buf[MAX_NAME_LEN]; +// OBSOLETE ret = mach_port_move_member (mach_task_self (), +// OBSOLETE our_message_port, +// OBSOLETE inferior_wait_port_set); +// OBSOLETE if (ret != KERN_SUCCESS) +// OBSOLETE warning ("message move member %s", mach_error_string (ret)); +// OBSOLETE +// OBSOLETE +// OBSOLETE /* @@@@ No way to change message port name currently */ +// OBSOLETE /* Foo. This assumes gdb has a unix pid */ +// OBSOLETE sprintf (buf, "gdb-%d", getpid ()); +// OBSOLETE gdb_register_port (buf, our_message_port); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Heap for thread commands */ +// OBSOLETE obstack_init (cproc_obstack); +// OBSOLETE +// OBSOLETE add_mach_specific_commands (); +// OBSOLETE } diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 6af823e..37d27a5 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -895,7 +895,7 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); m68hc11_frame_init_saved_regs (fi); @@ -1369,7 +1369,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM); set_gdbarch_fp_regnum (gdbarch, SOFT_FP_REGNUM); @@ -1380,51 +1380,45 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_pseudo_register_read (gdbarch, m68hc11_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, m68hc11_pseudo_register_write); - set_gdbarch_call_dummy_length (gdbarch, 0); set_gdbarch_call_dummy_address (gdbarch, m68hc11_call_dummy_address); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/ - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_call_dummy_words (gdbarch, m68hc11_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (m68hc11_call_dummy_words)); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); + set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value); - set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments); - set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address); + set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, m68hc11_push_return_address); set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack); - set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not); - set_gdbarch_frame_chain (gdbarch, m68hc11_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, m68hc11_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address); - set_gdbarch_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); + set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); - set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info); - set_gdbarch_pop_frame (gdbarch, m68hc11_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, m68hc11_pop_frame); set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc); set_gdbarch_stack_align (gdbarch, m68hc11_stack_align); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11); m68hc11_add_reggroups (gdbarch); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 6008a62..1ad176e 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -245,10 +245,10 @@ m68k_store_return_value (struct type *type, char *valbuf) /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the 68000, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. */ +/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces + the frame's chain-pointer. In the case of the 68000, the frame's + nominal address is the address of a 4-byte word containing the + calling frame's address. */ /* If we are chaining from sigtramp, then manufacture a sigtramp frame (which isn't really on the stack. I'm not sure this is right for anything @@ -359,7 +359,7 @@ int isi_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -381,7 +381,7 @@ int delta68_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -403,7 +403,7 @@ int news_frame_num_args (struct frame_info *fi) { int val; - CORE_ADDR pc = FRAME_SAVED_PC (fi); + CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi); int insn = read_memory_unsigned_integer (pc, 2); val = 0; if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ @@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info) } else { - pc = get_pc_function_start (get_frame_pc (frame_info)); + pc = get_frame_func (frame_info); nextinsn = read_memory_unsigned_integer (pc, 2); if (P_PEA_FP == nextinsn @@ -994,24 +994,24 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue); - set_gdbarch_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call); set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc); /* Stack grows down. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_stack_align (gdbarch, m68k_stack_align); - + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_decr_pc_after_break (gdbarch, 2); - set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, m68k_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, m68k_deprecated_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, m68k_store_return_value); - set_gdbarch_frame_chain (gdbarch, m68k_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, m68k_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68k_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs); set_gdbarch_frameless_function_invocation (gdbarch, m68k_frameless_function_invocation); @@ -1038,20 +1038,19 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 24); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_call_dummy_length (gdbarch, 28); set_gdbarch_call_dummy_start_offset (gdbarch, 12); set_gdbarch_call_dummy_words (gdbarch, call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_words)); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_fix_call_dummy (gdbarch, m68k_fix_call_dummy); set_gdbarch_deprecated_push_dummy_frame (gdbarch, m68k_push_dummy_frame); - set_gdbarch_pop_frame (gdbarch, m68k_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, m68k_pop_frame); + + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); return gdbarch; } @@ -570,11 +570,7 @@ extern int gdbtk_test (char *); /* Find it. */ struct interp *interp = interp_lookup (interpreter_p); if (interp == NULL) - { - fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n", - interpreter_p); - exit (1); - } + error ("Interpreter `%s' unrecognized", interpreter_p); /* Install it. */ if (!interp_set (interp)) { @@ -815,7 +811,9 @@ gdb_main (struct captured_main_args *args) { use_windows = args->use_windows; catch_errors (captured_main, args, "", RETURN_MASK_ALL); - return 0; + /* The only way to end up here is by an error (normal exit is + handled by quit_force()), hence always return an error status. */ + return 1; } diff --git a/gdb/maint.c b/gdb/maint.c index f2dfa68..2eb59ee 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -151,17 +151,8 @@ maintenance_demangle (char *args, int from_tty) } else { - switch (current_language->la_language) - { - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /* demangled = objc_demangle (args); */ - /* break; */ - case language_cplus: - default: - demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); - break; - } + demangled = language_demangle (current_language, args, + DMGL_ANSI | DMGL_PARAMS); if (demangled != NULL) { printf_unfiltered ("%s\n", demangled); @@ -443,6 +434,18 @@ maintenance_print_command (char *arg, int from_tty) help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout); } +/* The "maintenance list" command is defined as a prefix, with + allow_unknown 0. Therefore, its own definition is called only for + "maintenance list" with no args. */ + +/* ARGSUSED */ +static void +maintenance_list_command (char *arg, int from_tty) +{ + printf_unfiltered ("\"maintenance list\" must be followed by the name of a list command.\n"); + help_list (maintenancelistlist, "maintenance list ", -1, gdb_stdout); +} + /* The "maintenance translate-address" command converts a section and address to a symbol. This can be called in two ways: maintenance translate-address <secname> <addr> @@ -741,6 +744,11 @@ lists all sections from all object files, including shared libraries.", &maintenanceprintlist, "maintenance print ", 0, &maintenancelist); + add_prefix_cmd ("list", class_maintenance, maintenance_list_command, + "Maintenance command for listing GDB internal state.", + &maintenancelistlist, "maintenance list ", 0, + &maintenancelist); + add_prefix_cmd ("set", class_maintenance, maintenance_set_cmd, "\ Set GDB internal variables used by the GDB maintainer.\n\ Configure variables internal to GDB that aid in GDB's maintenance", @@ -819,6 +827,19 @@ If a SOURCE file is specified, dump only that file's partial symbols.", "Print dump of current object file definitions.", &maintenanceprintlist); + add_cmd ("symtabs", class_maintenance, maintenance_list_symtabs, + "List the full symbol tables for all object files.\n\ +This does not include information about individual symbols, blocks, or\n\ +linetables --- just the symbol table structures themselves.\n\ +With an argument REGEXP, list the symbol tables whose names that match that.", + &maintenancelistlist); + + add_cmd ("psymtabs", class_maintenance, maintenance_list_psymtabs, + "List the partial symbol tables for all object files.\n\ +This does not include information about individual partial symbols,\n\ +just the symbol table structures themselves.", + &maintenancelistlist); + add_cmd ("statistics", class_maintenance, maintenance_print_statistics, "Print statistics about internal gdb state.", &maintenanceprintlist); diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c index e5b6434..ab03f3a 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -671,7 +671,7 @@ mcore_frame_chain (struct frame_info * fi) If our caller does not have a frame pointer, then his frame base is <our base> + -<caller's frame size>. */ - dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi)); + dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi)); if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP) { @@ -803,7 +803,7 @@ mcore_pop_frame (void) else { /* Write out the PC we saved. */ - write_register (PC_REGNUM, FRAME_SAVED_PC (fi)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi)); /* Restore any saved registers. */ for (rn = 0; rn < NUM_REGS; rn++) @@ -1047,7 +1047,7 @@ void mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (fi && get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_saved_regs_zalloc (fi); @@ -1116,34 +1116,26 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call Dummies: */ - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call); set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc); - set_gdbarch_push_return_address (gdbarch, mcore_push_return_address); - set_gdbarch_push_arguments (gdbarch, mcore_push_arguments); - set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_deprecated_push_return_address (gdbarch, mcore_push_return_address); + set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments); /* Frames: */ set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info); - set_gdbarch_frame_chain (gdbarch, mcore_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, mcore_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs); - set_gdbarch_frame_saved_pc (gdbarch, mcore_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mcore_frame_saved_pc); set_gdbarch_deprecated_store_return_value (gdbarch, mcore_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mcore_extract_return_value); - set_gdbarch_store_struct_return (gdbarch, mcore_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, mcore_store_struct_return); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, mcore_extract_struct_value_address); set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue); @@ -1151,7 +1143,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - set_gdbarch_pop_frame (gdbarch, mcore_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame); set_gdbarch_virtual_frame_pointer (gdbarch, mcore_virtual_frame_pointer); /* Misc.: */ @@ -1164,6 +1156,9 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) between registers and stack. */ set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index a40a548..8642ee8 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -914,9 +914,13 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, method whose name is identical to the class name (in particular constructor method names are different from the class name). There is therefore no risk that - this check stops the count on the StEnd of a method. */ - if (strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss, - name) == 0) + this check stops the count on the StEnd of a method. + + Also, assume that we're really at the end when tsym.iss + is 0 (issNull). */ + if (tsym.iss == issNull + || strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss, + name) == 0) goto end_of_fields; break; diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 4d137be..069abfb 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,27 @@ +2003-04-02 Bob Rossi <bob_rossi@cox.net> + + * mi-cmd-file.c: New file to implement mi file commands. + * mi-getopt.c (mi_valid_noargs): Added mi_valid_noargs to verify + if a set of parameters passed to an MI function has no arguments + * mi-getopt.h (mi_valid_noargs): Declare. + * mi-cmds.c (mi_cmds): Added -file-list-exec-source-file command. + * mi-cmds.h (mi_cmd_file_list_exec_source_file): Declare. + +2003-03-27 Andrew Cagney <cagney@redhat.com> + + * gdbmi.texinfo: Delete file. Contents moved to + ../doc/gdb.texinfo. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + + * mi-main.c (get_register): Use frame_register instead of + get_saved_register. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * mi-out.c: Update copyright. + (mi_out_data): Define typedef. Use instead of ui_out_data. + 2003-03-01 Andrew Cagney <cagney@redhat.com> * mi-main.c (get_register): Use register_type instead of diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo deleted file mode 100644 index da8b77c..0000000 --- a/gdb/mi/gdbmi.texinfo +++ /dev/null @@ -1,3902 +0,0 @@ -@c \input texinfo @c -*-texinfo-*- -@c @c %**start of header -@c @setfilename gdbmi.info -@c @settitle GDB/MI Machine Interface -@c @setchapternewpage off -@c @c %**end of header - -@c @ifinfo -@c This file documents GDB/MI, a Machine Interface to GDB. - -@c Copyright 2000, 2001, 2002 Free Software Foundation, Inc. -@c Contributed by Cygnus Solutions. - -@c Permission is granted to copy, distribute and/or modify this document -@c under the terms of the GNU Free Documentation License, Version 1.1 or -@c any later version published by the Free Software Foundation; with no -@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' -@c and with the Back-Cover Texts as in (a) below. - -@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -@c this GNU Manual, like GNU software. Copies published by the Free -@c Software Foundation raise funds for GNU development.'' -@c @end ifinfo - -@c @c This title page illustrates only one of the -@c @c two methods of forming a title page. - -@c @titlepage -@c @title GDB/MI -@c @subtitle Version 0.3 -@c @subtitle Apr 2001 -@c @author Andrew Cagney, Fernando Nasser and Elena Zannoni - -@c @c The following two commands -@c @c start the copyright page. -@c @page -@c @vskip 0pt plus 1filll - -@c Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc. - -@c Permission is granted to copy, distribute and/or modify this document -@c under the terms of the GNU Free Documentation License, Version 1.1 or -@c any later version published by the Free Software Foundation; with no -@c Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' -@c and with the Back-Cover Texts as in (a) below. - -@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -@c this GNU Manual, like GNU software. Copies published by the Free -@c Software Foundation raise funds for GNU development.'' -@c @end titlepage - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI -@chapter The @sc{gdb/mi} Interface - -@unnumberedsec Function and Purpose - -@cindex @sc{gdb/mi}, its purpose -@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is -specifically intended to support the development of systems which use -the debugger as just one small component of a larger system. - -This chapter is a specification of the @sc{gdb/mi} interface. It is written -in the form of a reference manual. - -Note that @sc{gdb/mi} is still under construction, so some of the -features described below are incomplete and subject to change. - -@unnumberedsec Notation and Terminology - -@cindex notational conventions, for @sc{gdb/mi} -This chapter uses the following notation: - -@itemize @bullet -@item -@code{|} separates two alternatives. - -@item -@code{[ @var{something} ]} indicates that @var{something} is optional: -it may or may not be given. - -@item -@code{( @var{group} )*} means that @var{group} inside the parentheses -may repeat zero or more times. - -@item -@code{( @var{group} )+} means that @var{group} inside the parentheses -may repeat one or more times. - -@item -@code{"@var{string}"} means a literal @var{string}. -@end itemize - -@ignore -@heading Dependencies -@end ignore - -@heading Acknowledgments - -In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and -Elena Zannoni. - -@menu -* GDB/MI Command Syntax:: -* GDB/MI Compatibility with CLI:: -* GDB/MI Output Records:: -* GDB/MI Command Description Format:: -* GDB/MI Breakpoint Table Commands:: -* GDB/MI Data Manipulation:: -* GDB/MI Program Control:: -* GDB/MI Miscellaneous Commands:: -@ignore -* GDB/MI Kod Commands:: -* GDB/MI Memory Overlay Commands:: -* GDB/MI Signal Handling Commands:: -@end ignore -* GDB/MI Stack Manipulation:: -* GDB/MI Symbol Query:: -* GDB/MI Target Manipulation:: -* GDB/MI Thread Commands:: -* GDB/MI Tracepoint Commands:: -* GDB/MI Variable Objects:: -@end menu - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Command Syntax -@section @sc{gdb/mi} Command Syntax - -@menu -* GDB/MI Input Syntax:: -* GDB/MI Output Syntax:: -* GDB/MI Simple Examples:: -@end menu - -@node GDB/MI Input Syntax -@subsection @sc{gdb/mi} Input Syntax - -@cindex input syntax for @sc{gdb/mi} -@cindex @sc{gdb/mi}, input syntax -@table @code -@item @var{command} @expansion{} -@code{@var{cli-command} | @var{mi-command}} - -@item @var{cli-command} @expansion{} -@code{[ @var{token} ] @var{cli-command} @var{nl}}, where -@var{cli-command} is any existing @value{GDBN} CLI command. - -@item @var{mi-command} @expansion{} -@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )* -@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}} - -@item @var{token} @expansion{} -"any sequence of digits" - -@item @var{option} @expansion{} -@code{"-" @var{parameter} [ " " @var{parameter} ]} - -@item @var{parameter} @expansion{} -@code{@var{non-blank-sequence} | @var{c-string}} - -@item @var{operation} @expansion{} -@emph{any of the operations described in this chapter} - -@item @var{non-blank-sequence} @expansion{} -@emph{anything, provided it doesn't contain special characters such as -"-", @var{nl}, """ and of course " "} - -@item @var{c-string} @expansion{} -@code{""" @var{seven-bit-iso-c-string-content} """} - -@item @var{nl} @expansion{} -@code{CR | CR-LF} -@end table - -@noindent -Notes: - -@itemize @bullet -@item -The CLI commands are still handled by the @sc{mi} interpreter; their -output is described below. - -@item -The @code{@var{token}}, when present, is passed back when the command -finishes. - -@item -Some @sc{mi} commands accept optional arguments as part of the parameter -list. Each option is identified by a leading @samp{-} (dash) and may be -followed by an optional argument parameter. Options occur first in the -parameter list and can be delimited from normal parameters using -@samp{--} (this is useful when some parameters begin with a dash). -@end itemize - -Pragmatics: - -@itemize @bullet -@item -We want easy access to the existing CLI syntax (for debugging). - -@item -We want it to be easy to spot a @sc{mi} operation. -@end itemize - -@node GDB/MI Output Syntax -@subsection @sc{gdb/mi} Output Syntax - -@cindex output syntax of @sc{gdb/mi} -@cindex @sc{gdb/mi}, output syntax -The output from @sc{gdb/mi} consists of zero or more out-of-band records -followed, optionally, by a single result record. This result record -is for the most recent command. The sequence of output records is -terminated by @samp{(@value{GDBP})}. - -If an input command was prefixed with a @code{@var{token}} then the -corresponding output for that command will also be prefixed by that same -@var{token}. - -@table @code -@item @var{output} @expansion{} -@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}} - -@item @var{result-record} @expansion{} -@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}} - -@item @var{out-of-band-record} @expansion{} -@code{@var{async-record} | @var{stream-record}} - -@item @var{async-record} @expansion{} -@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}} - -@item @var{exec-async-output} @expansion{} -@code{[ @var{token} ] "*" @var{async-output}} - -@item @var{status-async-output} @expansion{} -@code{[ @var{token} ] "+" @var{async-output}} - -@item @var{notify-async-output} @expansion{} -@code{[ @var{token} ] "=" @var{async-output}} - -@item @var{async-output} @expansion{} -@code{@var{async-class} ( "," @var{result} )* @var{nl}} - -@item @var{result-class} @expansion{} -@code{"done" | "running" | "connected" | "error" | "exit"} - -@item @var{async-class} @expansion{} -@code{"stopped" | @var{others}} (where @var{others} will be added -depending on the needs---this is still in development). - -@item @var{result} @expansion{} -@code{ @var{variable} "=" @var{value}} - -@item @var{variable} @expansion{} -@code{ @var{string} } - -@item @var{value} @expansion{} -@code{ @var{const} | @var{tuple} | @var{list} } - -@item @var{const} @expansion{} -@code{@var{c-string}} - -@item @var{tuple} @expansion{} -@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" } - -@item @var{list} @expansion{} -@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "[" -@var{result} ( "," @var{result} )* "]" } - -@item @var{stream-record} @expansion{} -@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}} - -@item @var{console-stream-output} @expansion{} -@code{"~" @var{c-string}} - -@item @var{target-stream-output} @expansion{} -@code{"@@" @var{c-string}} - -@item @var{log-stream-output} @expansion{} -@code{"&" @var{c-string}} - -@item @var{nl} @expansion{} -@code{CR | CR-LF} - -@item @var{token} @expansion{} -@emph{any sequence of digits}. -@end table - -@noindent -Notes: - -@itemize @bullet -@item -All output sequences end in a single line containing a period. - -@item -The @code{@var{token}} is from the corresponding request. If an execution -command is interrupted by the @samp{-exec-interrupt} command, the -@var{token} associated with the @samp{*stopped} message is the one of the -original execution command, not the one of the interrupt command. - -@item -@cindex status output in @sc{gdb/mi} -@var{status-async-output} contains on-going status information about the -progress of a slow operation. It can be discarded. All status output is -prefixed by @samp{+}. - -@item -@cindex async output in @sc{gdb/mi} -@var{exec-async-output} contains asynchronous state change on the target -(stopped, started, disappeared). All async output is prefixed by -@samp{*}. - -@item -@cindex notify output in @sc{gdb/mi} -@var{notify-async-output} contains supplementary information that the -client should handle (e.g., a new breakpoint information). All notify -output is prefixed by @samp{=}. - -@item -@cindex console output in @sc{gdb/mi} -@var{console-stream-output} is output that should be displayed as is in the -console. It is the textual response to a CLI command. All the console -output is prefixed by @samp{~}. - -@item -@cindex target output in @sc{gdb/mi} -@var{target-stream-output} is the output produced by the target program. -All the target output is prefixed by @samp{@@}. - -@item -@cindex log output in @sc{gdb/mi} -@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for -instance messages that should be displayed as part of an error log. All -the log output is prefixed by @samp{&}. - -@item -@cindex list output in @sc{gdb/mi} -New @sc{gdb/mi} commands should only output @var{lists} containing -@var{values}. - - -@end itemize - -@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more -details about the various output records. - -@node GDB/MI Simple Examples -@subsection Simple Examples of @sc{gdb/mi} Interaction -@cindex @sc{gdb/mi}, simple examples - -This subsection presents several simple examples of interaction using -the @sc{gdb/mi} interface. In these examples, @samp{->} means that the -following line is passed to @sc{gdb/mi} as input, while @samp{<-} means -the output received from @sc{gdb/mi}. - -@subsubheading Target Stop -@c Ummm... There is no "-stop" command. This assumes async, no? -Here's an example of stopping the inferior process: - -@example --> -stop -<- (@value{GDBP}) -@end example - -@noindent -and later: - -@example -<- *stop,reason="stop",address="0x123",source="a.c:123" -<- (@value{GDBP}) -@end example - -@subsubheading Simple CLI Command - -Here's an example of a simple CLI command being passed through -@sc{gdb/mi} and on to the CLI. - -@example --> print 1+2 -<- &"print 1+2\n" -<- ~"$1 = 3\n" -<- ^done -<- (@value{GDBP}) -@end example - -@subsubheading Command With Side Effects - -@example --> -symbol-file xyz.exe -<- *breakpoint,nr="3",address="0x123",source="a.c:123" -<- (@value{GDBP}) -@end example - -@subsubheading A Bad Command - -Here's what happens if you pass a non-existent command: - -@example --> -rubbish -<- ^error,msg="Undefined MI command: rubbish" -<- (@value{GDBP}) -@end example - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Compatibility with CLI -@section @sc{gdb/mi} Compatibility with CLI - -@cindex compatibility, @sc{gdb/mi} and CLI -@cindex @sc{gdb/mi}, compatibility with CLI -To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi} -accepts existing CLI commands. As specified by the syntax, such -commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will -respond. - -This mechanism is provided as an aid to developers of @sc{gdb/mi} -clients and not as a reliable interface into the CLI. Since the command -is being interpreteted in an environment that assumes @sc{gdb/mi} -behaviour, the exact output of such commands is likely to end up being -an un-supported hybrid of @sc{gdb/mi} and CLI output. - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Output Records -@section @sc{gdb/mi} Output Records - -@menu -* GDB/MI Result Records:: -* GDB/MI Stream Records:: -* GDB/MI Out-of-band Records:: -@end menu - -@node GDB/MI Result Records -@subsection @sc{gdb/mi} Result Records - -@cindex result records in @sc{gdb/mi} -@cindex @sc{gdb/mi}, result records -In addition to a number of out-of-band notifications, the response to a -@sc{gdb/mi} command includes one of the following result indications: - -@table @code -@findex ^done -@item "^done" [ "," @var{results} ] -The synchronous operation was successful, @code{@var{results}} are the return -values. - -@item "^running" -@findex ^running -@c Is this one correct? Should it be an out-of-band notification? -The asynchronous operation was successfully started. The target is -running. - -@item "^error" "," @var{c-string} -@findex ^error -The operation failed. The @code{@var{c-string}} contains the corresponding -error message. -@end table - -@node GDB/MI Stream Records -@subsection @sc{gdb/mi} Stream Records - -@cindex @sc{gdb/mi}, stream records -@cindex stream records in @sc{gdb/mi} -@value{GDBN} internally maintains a number of output streams: the console, the -target, and the log. The output intended for each of these streams is -funneled through the @sc{gdb/mi} interface using @dfn{stream records}. - -Each stream record begins with a unique @dfn{prefix character} which -identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output -Syntax}). In addition to the prefix, each stream record contains a -@code{@var{string-output}}. This is either raw text (with an implicit new -line) or a quoted C string (which does not contain an implicit newline). - -@table @code -@item "~" @var{string-output} -The console output stream contains text that should be displayed in the -CLI console window. It contains the textual responses to CLI commands. - -@item "@@" @var{string-output} -The target output stream contains any textual output from the running -target. - -@item "&" @var{string-output} -The log stream contains debugging messages being produced by @value{GDBN}'s -internals. -@end table - -@node GDB/MI Out-of-band Records -@subsection @sc{gdb/mi} Out-of-band Records - -@cindex out-of-band records in @sc{gdb/mi} -@cindex @sc{gdb/mi}, out-of-band records -@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of -additional changes that have occurred. Those changes can either be a -consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of -target activity (e.g., target stopped). - -The following is a preliminary list of possible out-of-band records. - -@table @code -@item "*" "stop" -@end table - - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Command Description Format -@section @sc{gdb/mi} Command Description Format - -The remaining sections describe blocks of commands. Each block of -commands is laid out in a fashion similar to this section. - -Note the the line breaks shown in the examples are here only for -readability. They don't appear in the real output. -Also note that the commands with a non-available example (N.A.@:) are -not yet implemented. - -@subheading Motivation - -The motivation for this collection of commands. - -@subheading Introduction - -A brief introduction to this collection of commands as a whole. - -@subheading Commands - -For each command in the block, the following is described: - -@subsubheading Synopsis - -@example - -command @var{args}@dots{} -@end example - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} CLI command. - -@subsubheading Result - -@subsubheading Out-of-band - -@subsubheading Notes - -@subsubheading Example - - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Breakpoint Table Commands -@section @sc{gdb/mi} Breakpoint table commands - -@cindex breakpoint commands for @sc{gdb/mi} -@cindex @sc{gdb/mi}, breakpoint commands -This section documents @sc{gdb/mi} commands for manipulating -breakpoints. - -@subheading The @code{-break-after} Command -@findex -break-after - -@subsubheading Synopsis - -@example - -break-after @var{number} @var{count} -@end example - -The breakpoint number @var{number} is not in effect until it has been -hit @var{count} times. To see how this is reflected in the output of -the @samp{-break-list} command, see the description of the -@samp{-break-list} command below. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{ignore}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-insert main -^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@} -(@value{GDBP}) --break-after 1 3 -~ -^done -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="1",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x000100d0",func="main",file="hello.c",line="5",times="0", -ignore="3"@}]@} -(@value{GDBP}) -@end smallexample - -@ignore -@subheading The @code{-break-catch} Command -@findex -break-catch - -@subheading The @code{-break-commands} Command -@findex -break-commands -@end ignore - - -@subheading The @code{-break-condition} Command -@findex -break-condition - -@subsubheading Synopsis - -@example - -break-condition @var{number} @var{expr} -@end example - -Breakpoint @var{number} will stop the program only if the condition in -@var{expr} is true. The condition becomes part of the -@samp{-break-list} output (see the description of the @samp{-break-list} -command below). - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{condition}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-condition 1 1 -^done -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="1",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x000100d0",func="main",file="hello.c",line="5",cond="1", -times="0",ignore="3"@}]@} -(@value{GDBP}) -@end smallexample - -@subheading The @code{-break-delete} Command -@findex -break-delete - -@subsubheading Synopsis - -@example - -break-delete ( @var{breakpoint} )+ -@end example - -Delete the breakpoint(s) whose number(s) are specified in the argument -list. This is obviously reflected in the breakpoint list. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{delete}. - -@subsubheading Example - -@example -(@value{GDBP}) --break-delete 1 -^done -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="0",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[]@} -(@value{GDBP}) -@end example - -@subheading The @code{-break-disable} Command -@findex -break-disable - -@subsubheading Synopsis - -@example - -break-disable ( @var{breakpoint} )+ -@end example - -Disable the named @var{breakpoint}(s). The field @samp{enabled} in the -break list is now set to @samp{n} for the named @var{breakpoint}(s). - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{disable}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-disable 2 -^done -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="1",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n", -addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@} -(@value{GDBP}) -@end smallexample - -@subheading The @code{-break-enable} Command -@findex -break-enable - -@subsubheading Synopsis - -@example - -break-enable ( @var{breakpoint} )+ -@end example - -Enable (previously disabled) @var{breakpoint}(s). - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{enable}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-enable 2 -^done -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="1",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y", -addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@} -(@value{GDBP}) -@end smallexample - -@subheading The @code{-break-info} Command -@findex -break-info - -@subsubheading Synopsis - -@example - -break-info @var{breakpoint} -@end example - -@c REDUNDANT??? -Get information about a single breakpoint. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}. - -@subsubheading Example -N.A. - -@subheading The @code{-break-insert} Command -@findex -break-insert - -@subsubheading Synopsis - -@example - -break-insert [ -t ] [ -h ] [ -r ] - [ -c @var{condition} ] [ -i @var{ignore-count} ] - [ -p @var{thread} ] [ @var{line} | @var{addr} ] -@end example - -@noindent -If specified, @var{line}, can be one of: - -@itemize @bullet -@item function -@c @item +offset -@c @item -offset -@c @item linenum -@item filename:linenum -@item filename:function -@item *address -@end itemize - -The possible optional parameters of this command are: - -@table @samp -@item -t -Insert a tempoary breakpoint. -@item -h -Insert a hardware breakpoint. -@item -c @var{condition} -Make the breakpoint conditional on @var{condition}. -@item -i @var{ignore-count} -Initialize the @var{ignore-count}. -@item -r -Insert a regular breakpoint in all the functions whose names match the -given regular expression. Other flags are not applicable to regular -expresson. -@end table - -@subsubheading Result - -The result is in the form: - -@example - ^done,bkptno="@var{number}",func="@var{funcname}", - file="@var{filename}",line="@var{lineno}" -@end example - -@noindent -where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname} -is the name of the function where the breakpoint was inserted, -@var{filename} is the name of the source file which contains this -function, and @var{lineno} is the source line number within that file. - -Note: this format is open to change. -@c An out-of-band breakpoint instead of part of the result? - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak}, -@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-insert main -^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@} -(@value{GDBP}) --break-insert -t foo -^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@} -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="2",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@}, -bkpt=@{number="2",type="breakpoint",disp="del",enabled="y", -addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@} -(@value{GDBP}) --break-insert -r foo.* -~int foo(int, int); -^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@} -(@value{GDBP}) -@end smallexample - -@subheading The @code{-break-list} Command -@findex -break-list - -@subsubheading Synopsis - -@example - -break-list -@end example - -Displays the list of inserted breakpoints, showing the following fields: - -@table @samp -@item Number -number of the breakpoint -@item Type -type of the breakpoint: @samp{breakpoint} or @samp{watchpoint} -@item Disposition -should the breakpoint be deleted or disabled when it is hit: @samp{keep} -or @samp{nokeep} -@item Enabled -is the breakpoint enabled or no: @samp{y} or @samp{n} -@item Address -memory location at which the breakpoint is set -@item What -logical location of the breakpoint, expressed by function name, file -name, line number -@item Times -number of times the breakpoint has been hit -@end table - -If there are no breakpoints or watchpoints, the @code{BreakpointTable} -@code{body} field is an empty list. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info break}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="2",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}, -bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y", -addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@} -(@value{GDBP}) -@end smallexample - -Here's an example of the result when there are no breakpoints: - -@smallexample -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="0",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[]@} -(@value{GDBP}) -@end smallexample - -@subheading The @code{-break-watch} Command -@findex -break-watch - -@subsubheading Synopsis - -@example - -break-watch [ -a | -r ] -@end example - -Create a watchpoint. With the @samp{-a} option it will create an -@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a -read from or on a write to the memory location. With the @samp{-r} -option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will -trigger only when the memory location is accessed for reading. Without -either of the options, the watchpoint created is a regular watchpoint, -i.e. it will trigger when the memory location is accessed for writing. -@xref{Set Watchpoints, , Setting watchpoints}. - -Note that @samp{-break-list} will report a single list of watchpoints and -breakpoints inserted. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and -@samp{rwatch}. - -@subsubheading Example - -Setting a watchpoint on a variable in the @code{main} function: - -@smallexample -(@value{GDBP}) --break-watch x -^done,wpt=@{number="2",exp="x"@} -(@value{GDBP}) --exec-continue -^running -^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@}, -value=@{old="-268439212",new="55"@}, -frame=@{func="main",args=[],file="recursive2.c",line="5"@} -(@value{GDBP}) -@end smallexample - -Setting a watchpoint on a variable local to a function. @value{GDBN} will stop -the program execution twice: first for the variable changing value, then -for the watchpoint going out of scope. - -@smallexample -(@value{GDBP}) --break-watch C -^done,wpt=@{number="5",exp="C"@} -(@value{GDBP}) --exec-continue -^running -^done,reason="watchpoint-trigger", -wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@}, -frame=@{func="callee4",args=[], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@} -(@value{GDBP}) --exec-continue -^running -^done,reason="watchpoint-scope",wpnum="5", -frame=@{func="callee3",args=[@{name="strarg", -value="0x11940 \"A string argument.\""@}], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} -(@value{GDBP}) -@end smallexample - -Listing breakpoints and watchpoints, at different points in the program -execution. Note that once the watchpoint goes out of scope, it is -deleted. - -@smallexample -(@value{GDBP}) --break-watch C -^done,wpt=@{number="2",exp="C"@} -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="2",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x00010734",func="callee4", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}, -bkpt=@{number="2",type="watchpoint",disp="keep", -enabled="y",addr="",what="C",times="0"@}]@} -(@value{GDBP}) --exec-continue -^running -^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@}, -value=@{old="-276895068",new="3"@}, -frame=@{func="callee4",args=[], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@} -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="2",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x00010734",func="callee4", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}, -bkpt=@{number="2",type="watchpoint",disp="keep", -enabled="y",addr="",what="C",times="-5"@}]@} -(@value{GDBP}) --exec-continue -^running -^done,reason="watchpoint-scope",wpnum="2", -frame=@{func="callee3",args=[@{name="strarg", -value="0x11940 \"A string argument.\""@}], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} -(@value{GDBP}) --break-list -^done,BreakpointTable=@{nr_rows="1",nr_cols="6", -hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@}, -@{width="14",alignment="-1",col_name="type",colhdr="Type"@}, -@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@}, -@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@}, -@{width="10",alignment="-1",col_name="addr",colhdr="Address"@}, -@{width="40",alignment="2",col_name="what",colhdr="What"@}], -body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y", -addr="0x00010734",func="callee4", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@} -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Data Manipulation -@section @sc{gdb/mi} Data Manipulation - -@cindex data manipulation, in @sc{gdb/mi} -@cindex @sc{gdb/mi}, data manipulation -This section describes the @sc{gdb/mi} commands that manipulate data: -examine memory and registers, evaluate expressions, etc. - -@c REMOVED FROM THE INTERFACE. -@c @subheading -data-assign -@c Change the value of a program variable. Plenty of side effects. -@c @subsubheading GDB command -@c set variable -@c @subsubheading Example -@c N.A. - -@subheading The @code{-data-disassemble} Command -@findex -data-disassemble - -@subsubheading Synopsis - -@example - -data-disassemble - [ -s @var{start-addr} -e @var{end-addr} ] - | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ] - -- @var{mode} -@end example - -@noindent -Where: - -@table @samp -@item @var{start-addr} -is the beginning address (or @code{$pc}) -@item @var{end-addr} -is the end address -@item @var{filename} -is the name of the file to disassemble -@item @var{linenum} -is the line number to disassemble around -@item @var{lines} -is the the number of disassembly lines to be produced. If it is -1, -the whole function will be disassembled, in case no @var{end-addr} is -specified. If @var{end-addr} is specified as a non-zero value, and -@var{lines} is lower than the number of disassembly lines between -@var{start-addr} and @var{end-addr}, only @var{lines} lines are -displayed; if @var{lines} is higher than the number of lines between -@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr} -are displayed. -@item @var{mode} -is either 0 (meaning only disassembly) or 1 (meaning mixed source and -disassembly). -@end table - -@subsubheading Result - -The output for each instruction is composed of four fields: - -@itemize @bullet -@item Address -@item Func-name -@item Offset -@item Instruction -@end itemize - -Note that whatever included in the instruction field, is not manipulated -directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format. - -@subsubheading @value{GDBN} Command - -There's no direct mapping from this command to the CLI. - -@subsubheading Example - -Disassemble from the current value of @code{$pc} to @code{$pc + 20}: - -@smallexample -(@value{GDBP}) --data-disassemble -s $pc -e "$pc + 20" -- 0 -^done, -asm_insns=[ -@{address="0x000107c0",func-name="main",offset="4", -inst="mov 2, %o0"@}, -@{address="0x000107c4",func-name="main",offset="8", -inst="sethi %hi(0x11800), %o2"@}, -@{address="0x000107c8",func-name="main",offset="12", -inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@}, -@{address="0x000107cc",func-name="main",offset="16", -inst="sethi %hi(0x11800), %o2"@}, -@{address="0x000107d0",func-name="main",offset="20", -inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}] -(@value{GDBP}) -@end smallexample - -Disassemble the whole @code{main} function. Line 32 is part of -@code{main}. - -@smallexample --data-disassemble -f basics.c -l 32 -- 0 -^done,asm_insns=[ -@{address="0x000107bc",func-name="main",offset="0", -inst="save %sp, -112, %sp"@}, -@{address="0x000107c0",func-name="main",offset="4", -inst="mov 2, %o0"@}, -@{address="0x000107c4",func-name="main",offset="8", -inst="sethi %hi(0x11800), %o2"@}, -[@dots{}] -@{address="0x0001081c",func-name="main",offset="96",inst="ret "@}, -@{address="0x00010820",func-name="main",offset="100",inst="restore "@}] -(@value{GDBP}) -@end smallexample - -Disassemble 3 instructions from the start of @code{main}: - -@smallexample -(@value{GDBP}) --data-disassemble -f basics.c -l 32 -n 3 -- 0 -^done,asm_insns=[ -@{address="0x000107bc",func-name="main",offset="0", -inst="save %sp, -112, %sp"@}, -@{address="0x000107c0",func-name="main",offset="4", -inst="mov 2, %o0"@}, -@{address="0x000107c4",func-name="main",offset="8", -inst="sethi %hi(0x11800), %o2"@}] -(@value{GDBP}) -@end smallexample - -Disassemble 3 instructions from the start of @code{main} in mixed mode: - -@smallexample -(@value{GDBP}) --data-disassemble -f basics.c -l 32 -n 3 -- 1 -^done,asm_insns=[ -src_and_asm_line=@{line="31", -file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ - testsuite/gdb.mi/basics.c",line_asm_insn=[ -@{address="0x000107bc",func-name="main",offset="0", -inst="save %sp, -112, %sp"@}]@}, -src_and_asm_line=@{line="32", -file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \ - testsuite/gdb.mi/basics.c",line_asm_insn=[ -@{address="0x000107c0",func-name="main",offset="4", -inst="mov 2, %o0"@}, -@{address="0x000107c4",func-name="main",offset="8", -inst="sethi %hi(0x11800), %o2"@}]@}] -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-data-evaluate-expression} Command -@findex -data-evaluate-expression - -@subsubheading Synopsis - -@example - -data-evaluate-expression @var{expr} -@end example - -Evaluate @var{expr} as an expression. The expression could contain an -inferior function call. The function call will execute synchronously. -If the expression contains spaces, it must be enclosed in double quotes. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and -@samp{call}. In @code{gdbtk} only, there's a corresponding -@samp{gdb_eval} command. - -@subsubheading Example - -In the following example, the numbers that precede the commands are the -@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi} -Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its -output. - -@smallexample -211-data-evaluate-expression A -211^done,value="1" -(@value{GDBP}) -311-data-evaluate-expression &A -311^done,value="0xefffeb7c" -(@value{GDBP}) -411-data-evaluate-expression A+3 -411^done,value="4" -(@value{GDBP}) -511-data-evaluate-expression "A + 3" -511^done,value="4" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-data-list-changed-registers} Command -@findex -data-list-changed-registers - -@subsubheading Synopsis - -@example - -data-list-changed-registers -@end example - -Display a list of the registers that have changed. - -@subsubheading @value{GDBN} Command - -@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk} -has the corresponding command @samp{gdb_changed_register_list}. - -@subsubheading Example - -On a PPC MBX board: - -@smallexample -(@value{GDBP}) --exec-continue -^running - -(@value{GDBP}) -*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main", -args=[],file="try.c",line="5"@} -(@value{GDBP}) --data-list-changed-registers -^done,changed-registers=["0","1","2","4","5","6","7","8","9", -"10","11","13","14","15","16","17","18","19","20","21","22","23", -"24","25","26","27","28","30","31","64","65","66","67","69"] -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-data-list-register-names} Command -@findex -data-list-register-names - -@subsubheading Synopsis - -@example - -data-list-register-names [ ( @var{regno} )+ ] -@end example - -Show a list of register names for the current target. If no arguments -are given, it shows a list of the names of all the registers. If -integer numbers are given as arguments, it will print a list of the -names of the registers corresponding to the arguments. To ensure -consistency between a register name and its number, the output list may -include empty register names. - -@subsubheading @value{GDBN} Command - -@value{GDBN} does not have a command which corresponds to -@samp{-data-list-register-names}. In @code{gdbtk} there is a -corresponding command @samp{gdb_regnames}. - -@subsubheading Example - -For the PPC MBX board: -@smallexample -(@value{GDBP}) --data-list-register-names -^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7", -"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18", -"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", -"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", -"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20", -"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31", -"", "pc","ps","cr","lr","ctr","xer"] -(@value{GDBP}) --data-list-register-names 1 2 3 -^done,register-names=["r1","r2","r3"] -(@value{GDBP}) -@end smallexample - -@subheading The @code{-data-list-register-values} Command -@findex -data-list-register-values - -@subsubheading Synopsis - -@example - -data-list-register-values @var{fmt} [ ( @var{regno} )*] -@end example - -Display the registers' contents. @var{fmt} is the format according to -which the registers' contents are to be returned, followed by an optional -list of numbers specifying the registers to display. A missing list of -numbers indicates that the contents of all the registers must be returned. - -Allowed formats for @var{fmt} are: - -@table @code -@item x -Hexadecimal -@item o -Octal -@item t -Binary -@item d -Decimal -@item r -Raw -@item N -Natural -@end table - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info -all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}. - -@subsubheading Example - -For a PPC MBX board (note: line breaks are for readability only, they -don't appear in the actual output): - -@smallexample -(@value{GDBP}) --data-list-register-values r 64 65 -^done,register-values=[@{number="64",value="0xfe00a300"@}, -@{number="65",value="0x00029002"@}] -(@value{GDBP}) --data-list-register-values x -^done,register-values=[@{number="0",value="0xfe0043c8"@}, -@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@}, -@{number="3",value="0x0"@},@{number="4",value="0xa"@}, -@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@}, -@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@}, -@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@}, -@{number="11",value="0x1"@},@{number="12",value="0x0"@}, -@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@}, -@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@}, -@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@}, -@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@}, -@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@}, -@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@}, -@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@}, -@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@}, -@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@}, -@{number="31",value="0x0"@},@{number="32",value="0x0"@}, -@{number="33",value="0x0"@},@{number="34",value="0x0"@}, -@{number="35",value="0x0"@},@{number="36",value="0x0"@}, -@{number="37",value="0x0"@},@{number="38",value="0x0"@}, -@{number="39",value="0x0"@},@{number="40",value="0x0"@}, -@{number="41",value="0x0"@},@{number="42",value="0x0"@}, -@{number="43",value="0x0"@},@{number="44",value="0x0"@}, -@{number="45",value="0x0"@},@{number="46",value="0x0"@}, -@{number="47",value="0x0"@},@{number="48",value="0x0"@}, -@{number="49",value="0x0"@},@{number="50",value="0x0"@}, -@{number="51",value="0x0"@},@{number="52",value="0x0"@}, -@{number="53",value="0x0"@},@{number="54",value="0x0"@}, -@{number="55",value="0x0"@},@{number="56",value="0x0"@}, -@{number="57",value="0x0"@},@{number="58",value="0x0"@}, -@{number="59",value="0x0"@},@{number="60",value="0x0"@}, -@{number="61",value="0x0"@},@{number="62",value="0x0"@}, -@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@}, -@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@}, -@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@}, -@{number="69",value="0x20002b03"@}] -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-data-read-memory} Command -@findex -data-read-memory - -@subsubheading Synopsis - -@example - -data-read-memory [ -o @var{byte-offset} ] - @var{address} @var{word-format} @var{word-size} - @var{nr-rows} @var{nr-cols} [ @var{aschar} ] -@end example - -@noindent -where: - -@table @samp -@item @var{address} -An expression specifying the address of the first memory word to be -read. Complex expressions containing embedded white space should be -quoted using the C convention. - -@item @var{word-format} -The format to be used to print the memory words. The notation is the -same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats, -,Output formats}). - -@item @var{word-size} -The size of each memory word in bytes. - -@item @var{nr-rows} -The number of rows in the output table. - -@item @var{nr-cols} -The number of columns in the output table. - -@item @var{aschar} -If present, indicates that each row should include an @sc{ascii} dump. The -value of @var{aschar} is used as a padding character when a byte is not a -member of the printable @sc{ascii} character set (printable @sc{ascii} -characters are those whose code is between 32 and 126, inclusively). - -@item @var{byte-offset} -An offset to add to the @var{address} before fetching memory. -@end table - -This command displays memory contents as a table of @var{nr-rows} by -@var{nr-cols} words, each word being @var{word-size} bytes. In total, -@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read -(returned as @samp{total-bytes}). Should less than the requested number -of bytes be returned by the target, the missing words are identified -using @samp{N/A}. The number of bytes read from the target is returned -in @samp{nr-bytes} and the starting address used to read memory in -@samp{addr}. - -The address of the next/previous row or page is available in -@samp{next-row} and @samp{prev-row}, @samp{next-page} and -@samp{prev-page}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has -@samp{gdb_get_mem} memory read command. - -@subsubheading Example - -Read six bytes of memory starting at @code{bytes+6} but then offset by -@code{-6} bytes. Format as three rows of two columns. One byte per -word. Display each word in hex. - -@smallexample -(@value{GDBP}) -9-data-read-memory -o -6 -- bytes+6 x 1 3 2 -9^done,addr="0x00001390",nr-bytes="6",total-bytes="6", -next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396", -prev-page="0x0000138a",memory=[ -@{addr="0x00001390",data=["0x00","0x01"]@}, -@{addr="0x00001392",data=["0x02","0x03"]@}, -@{addr="0x00001394",data=["0x04","0x05"]@}] -(@value{GDBP}) -@end smallexample - -Read two bytes of memory starting at address @code{shorts + 64} and -display as a single word formatted in decimal. - -@smallexample -(@value{GDBP}) -5-data-read-memory shorts+64 d 2 1 1 -5^done,addr="0x00001510",nr-bytes="2",total-bytes="2", -next-row="0x00001512",prev-row="0x0000150e", -next-page="0x00001512",prev-page="0x0000150e",memory=[ -@{addr="0x00001510",data=["128"]@}] -(@value{GDBP}) -@end smallexample - -Read thirty two bytes of memory starting at @code{bytes+16} and format -as eight rows of four columns. Include a string encoding with @samp{x} -used as the non-printable character. - -@smallexample -(@value{GDBP}) -4-data-read-memory bytes+16 x 1 8 4 x -4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32", -next-row="0x000013c0",prev-row="0x0000139c", -next-page="0x000013c0",prev-page="0x00001380",memory=[ -@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@}, -@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@}, -@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@}, -@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@}, -@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@}, -@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@}, -@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@}, -@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}] -(@value{GDBP}) -@end smallexample - -@subheading The @code{-display-delete} Command -@findex -display-delete - -@subsubheading Synopsis - -@example - -display-delete @var{number} -@end example - -Delete the display @var{number}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{delete display}. - -@subsubheading Example -N.A. - - -@subheading The @code{-display-disable} Command -@findex -display-disable - -@subsubheading Synopsis - -@example - -display-disable @var{number} -@end example - -Disable display @var{number}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{disable display}. - -@subsubheading Example -N.A. - - -@subheading The @code{-display-enable} Command -@findex -display-enable - -@subsubheading Synopsis - -@example - -display-enable @var{number} -@end example - -Enable display @var{number}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{enable display}. - -@subsubheading Example -N.A. - - -@subheading The @code{-display-insert} Command -@findex -display-insert - -@subsubheading Synopsis - -@example - -display-insert @var{expression} -@end example - -Display @var{expression} every time the program stops. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{display}. - -@subsubheading Example -N.A. - - -@subheading The @code{-display-list} Command -@findex -display-list - -@subsubheading Synopsis - -@example - -display-list -@end example - -List the displays. Do not show the current values. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info display}. - -@subsubheading Example -N.A. - - -@subheading The @code{-environment-cd} Command -@findex -environment-cd - -@subsubheading Synopsis - -@example - -environment-cd @var{pathdir} -@end example - -Set @value{GDBN}'s working directory. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{cd}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb -^done -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-environment-directory} Command -@findex -environment-directory - -@subsubheading Synopsis - -@example - -environment-directory [ -r ] [ @var{pathdir} ]+ -@end example - -Add directories @var{pathdir} to beginning of search path for source files. -If the @samp{-r} option is used, the search path is reset to the default -search path. If directories @var{pathdir} are supplied in addition to the -@samp{-r} option, the search path is first reset and then addition -occurs as normal. -Multiple directories may be specified, separated by blanks. Specifying -multiple directories in a single command -results in the directories added to the beginning of the -search path in the same order they were presented in the command. -If blanks are needed as -part of a directory name, double-quotes should be used around -the name. In the command output, the path will show up separated -by the system directory-separator character. The directory-seperator -character must not be used -in any directory name. -If no directories are specified, the current search path is displayed. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{dir}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb -^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" -(@value{GDBP}) --environment-directory "" -^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd" -(@value{GDBP}) --environment-directory -r /home/jjohnstn/src/gdb /usr/src -^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd" -(@value{GDBP}) --environment-directory -r -^done,source-path="$cdir:$cwd" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-environment-path} Command -@findex -environment-path - -@subsubheading Synopsis - -@example - -environment-path [ -r ] [ @var{pathdir} ]+ -@end example - -Add directories @var{pathdir} to beginning of search path for object files. -If the @samp{-r} option is used, the search path is reset to the original -search path that existed at gdb start-up. If directories @var{pathdir} are -supplied in addition to the -@samp{-r} option, the search path is first reset and then addition -occurs as normal. -Multiple directories may be specified, separated by blanks. Specifying -multiple directories in a single command -results in the directories added to the beginning of the -search path in the same order they were presented in the command. -If blanks are needed as -part of a directory name, double-quotes should be used around -the name. In the command output, the path will show up separated -by the system directory-separator character. The directory-seperator -character must not be used -in any directory name. -If no directories are specified, the current path is displayed. - - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{path}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --environment-path -^done,path="/usr/bin" -(@value{GDBP}) --environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin -^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin" -(@value{GDBP}) --environment-path -r /usr/local/bin -^done,path="/usr/local/bin:/usr/bin" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-environment-pwd} Command -@findex -environment-pwd - -@subsubheading Synopsis - -@example - -environment-pwd -@end example - -Show the current working directory. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{pwd}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --environment-pwd -^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb" -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Program Control -@section @sc{gdb/mi} Program control - -@subsubheading Program termination - -As a result of execution, the inferior program can run to completion, if -it doesn't encounter any breakpoints. In this case the output will -include an exit code, if the program has exited exceptionally. - -@subsubheading Examples - -@noindent -Program exited normally: - -@smallexample -(@value{GDBP}) --exec-run -^running -(@value{GDBP}) -x = 55 -*stopped,reason="exited-normally" -(@value{GDBP}) -@end smallexample - -@noindent -Program exited exceptionally: - -@smallexample -(@value{GDBP}) --exec-run -^running -(@value{GDBP}) -x = 55 -*stopped,reason="exited",exit-code="01" -(@value{GDBP}) -@end smallexample - -Another way the program can terminate is if it receives a signal such as -@code{SIGINT}. In this case, @sc{gdb/mi} displays this: - -@smallexample -(@value{GDBP}) -*stopped,reason="exited-signalled",signal-name="SIGINT", -signal-meaning="Interrupt" -@end smallexample - - -@subheading The @code{-exec-abort} Command -@findex -exec-abort - -@subsubheading Synopsis - -@example - -exec-abort -@end example - -Kill the inferior running program. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{kill}. - -@subsubheading Example -N.A. - - -@subheading The @code{-exec-arguments} Command -@findex -exec-arguments - -@subsubheading Synopsis - -@example - -exec-arguments @var{args} -@end example - -Set the inferior program arguments, to be used in the next -@samp{-exec-run}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{set args}. - -@subsubheading Example - -@c FIXME! -Don't have one around. - - -@subheading The @code{-exec-continue} Command -@findex -exec-continue - -@subsubheading Synopsis - -@example - -exec-continue -@end example - -Asynchronous command. Resumes the execution of the inferior program -until a breakpoint is encountered, or until the inferior exits. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} corresponding is @samp{continue}. - -@subsubheading Example - -@smallexample --exec-continue -^running -(@value{GDBP}) -@@Hello world -*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[], -file="hello.c",line="13"@} -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-finish} Command -@findex -exec-finish - -@subsubheading Synopsis - -@example - -exec-finish -@end example - -Asynchronous command. Resumes the execution of the inferior program -until the current function is exited. Displays the results returned by -the function. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{finish}. - -@subsubheading Example - -Function returning @code{void}. - -@smallexample --exec-finish -^running -(@value{GDBP}) -@@hello from foo -*stopped,reason="function-finished",frame=@{func="main",args=[], -file="hello.c",line="7"@} -(@value{GDBP}) -@end smallexample - -Function returning other than @code{void}. The name of the internal -@value{GDBN} variable storing the result is printed, together with the -value itself. - -@smallexample --exec-finish -^running -(@value{GDBP}) -*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo", -args=[@{name="a",value="1"],@{name="b",value="9"@}@}, -file="recursive2.c",line="14"@}, -gdb-result-var="$1",return-value="0" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-interrupt} Command -@findex -exec-interrupt - -@subsubheading Synopsis - -@example - -exec-interrupt -@end example - -Asynchronous command. Interrupts the background execution of the target. -Note how the token associated with the stop message is the one for the -execution command that has been interrupted. The token for the interrupt -itself only appears in the @samp{^done} output. If the user is trying to -interrupt a non-running program, an error message will be printed. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{interrupt}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) -111-exec-continue -111^running - -(@value{GDBP}) -222-exec-interrupt -222^done -(@value{GDBP}) -111*stopped,signal-name="SIGINT",signal-meaning="Interrupt", -frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@} -(@value{GDBP}) - -(@value{GDBP}) --exec-interrupt -^error,msg="mi_cmd_exec_interrupt: Inferior not executing." -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-next} Command -@findex -exec-next - -@subsubheading Synopsis - -@example - -exec-next -@end example - -Asynchronous command. Resumes execution of the inferior program, stopping -when the beginning of the next source line is reached. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{next}. - -@subsubheading Example - -@smallexample --exec-next -^running -(@value{GDBP}) -*stopped,reason="end-stepping-range",line="8",file="hello.c" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-next-instruction} Command -@findex -exec-next-instruction - -@subsubheading Synopsis - -@example - -exec-next-instruction -@end example - -Asynchronous command. Executes one machine instruction. If the -instruction is a function call continues until the function returns. If -the program stops at an instruction in the middle of a source line, the -address will be printed as well. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{nexti}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --exec-next-instruction -^running - -(@value{GDBP}) -*stopped,reason="end-stepping-range", -addr="0x000100d4",line="5",file="hello.c" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-return} Command -@findex -exec-return - -@subsubheading Synopsis - -@example - -exec-return -@end example - -Makes current function return immediately. Doesn't execute the inferior. -Displays the new current frame. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{return}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) -200-break-insert callee4 -200^done,bkpt=@{number="1",addr="0x00010734", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@} -(@value{GDBP}) -000-exec-run -000^running -(@value{GDBP}) -000*stopped,reason="breakpoint-hit",bkptno="1", -frame=@{func="callee4",args=[], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@} -(@value{GDBP}) -205-break-delete -205^done -(@value{GDBP}) -111-exec-return -111^done,frame=@{level="0",func="callee3", -args=[@{name="strarg", -value="0x11940 \"A string argument.\""@}], -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@} -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-run} Command -@findex -exec-run - -@subsubheading Synopsis - -@example - -exec-run -@end example - -Asynchronous command. Starts execution of the inferior from the -beginning. The inferior executes until either a breakpoint is -encountered or the program exits. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{run}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --break-insert main -^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@} -(@value{GDBP}) --exec-run -^running -(@value{GDBP}) -*stopped,reason="breakpoint-hit",bkptno="1", -frame=@{func="main",args=[],file="recursive2.c",line="4"@} -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-show-arguments} Command -@findex -exec-show-arguments - -@subsubheading Synopsis - -@example - -exec-show-arguments -@end example - -Print the arguments of the program. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{show args}. - -@subsubheading Example -N.A. - -@c @subheading -exec-signal - -@subheading The @code{-exec-step} Command -@findex -exec-step - -@subsubheading Synopsis - -@example - -exec-step -@end example - -Asynchronous command. Resumes execution of the inferior program, stopping -when the beginning of the next source line is reached, if the next -source line is not a function call. If it is, stop at the first -instruction of the called function. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{step}. - -@subsubheading Example - -Stepping into a function: - -@smallexample --exec-step -^running -(@value{GDBP}) -*stopped,reason="end-stepping-range", -frame=@{func="foo",args=[@{name="a",value="10"@}, -@{name="b",value="0"@}],file="recursive2.c",line="11"@} -(@value{GDBP}) -@end smallexample - -Regular stepping: - -@smallexample --exec-step -^running -(@value{GDBP}) -*stopped,reason="end-stepping-range",line="14",file="recursive2.c" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-step-instruction} Command -@findex -exec-step-instruction - -@subsubheading Synopsis - -@example - -exec-step-instruction -@end example - -Asynchronous command. Resumes the inferior which executes one machine -instruction. The output, once @value{GDBN} has stopped, will vary depending on -whether we have stopped in the middle of a source line or not. In the -former case, the address at which the program stopped will be printed as -well. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{stepi}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --exec-step-instruction -^running - -(@value{GDBP}) -*stopped,reason="end-stepping-range", -frame=@{func="foo",args=[],file="try.c",line="10"@} -(@value{GDBP}) --exec-step-instruction -^running - -(@value{GDBP}) -*stopped,reason="end-stepping-range", -frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@} -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-exec-until} Command -@findex -exec-until - -@subsubheading Synopsis - -@example - -exec-until [ @var{location} ] -@end example - -Asynchronous command. Executes the inferior until the @var{location} -specified in the argument is reached. If there is no argument, the inferior -executes until a source line greater than the current one is reached. -The reason for stopping in this case will be @samp{location-reached}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{until}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --exec-until recursive2.c:6 -^running -(@value{GDBP}) -x = 55 -*stopped,reason="location-reached",frame=@{func="main",args=[], -file="recursive2.c",line="6"@} -(@value{GDBP}) -@end smallexample - -@ignore -@subheading -file-clear -Is this going away???? -@end ignore - - -@subheading The @code{-file-exec-and-symbols} Command -@findex -file-exec-and-symbols - -@subsubheading Synopsis - -@example - -file-exec-and-symbols @var{file} -@end example - -Specify the executable file to be debugged. This file is the one from -which the symbol table is also read. If no file is specified, the -command clears the executable and symbol information. If breakpoints -are set when using this command with no arguments, @value{GDBN} will produce -error messages. Otherwise, no output is produced, except a completion -notification. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{file}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx -^done -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-file-exec-file} Command -@findex -file-exec-file - -@subsubheading Synopsis - -@example - -file-exec-file @var{file} -@end example - -Specify the executable file to be debugged. Unlike -@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read -from this file. If used without argument, @value{GDBN} clears the information -about the executable file. No output is produced, except a completion -notification. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{exec-file}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx -^done -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-file-list-exec-sections} Command -@findex -file-list-exec-sections - -@subsubheading Synopsis - -@example - -file-list-exec-sections -@end example - -List the sections of the current executable file. - -@subsubheading @value{GDBN} Command - -The @value{GDBN} command @samp{info file} shows, among the rest, the same -information as this command. @code{gdbtk} has a corresponding command -@samp{gdb_load_info}. - -@subsubheading Example -N.A. - - -@subheading The @code{-file-list-exec-source-files} Command -@findex -file-list-exec-source-files - -@subsubheading Synopsis - -@example - -file-list-exec-source-files -@end example - -List the source files for the current executable. - -@subsubheading @value{GDBN} Command - -There's no @value{GDBN} command which directly corresponds to this one. -@code{gdbtk} has an analogous command @samp{gdb_listfiles}. - -@subsubheading Example -N.A. - - -@subheading The @code{-file-list-shared-libraries} Command -@findex -file-list-shared-libraries - -@subsubheading Synopsis - -@example - -file-list-shared-libraries -@end example - -List the shared libraries in the program. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info shared}. - -@subsubheading Example -N.A. - - -@subheading The @code{-file-list-symbol-files} Command -@findex -file-list-symbol-files - -@subsubheading Synopsis - -@example - -file-list-symbol-files -@end example - -List symbol files. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info file} (part of it). - -@subsubheading Example -N.A. - - -@subheading The @code{-file-symbol-file} Command -@findex -file-symbol-file - -@subsubheading Synopsis - -@example - -file-symbol-file @var{file} -@end example - -Read symbol table info from the specified @var{file} argument. When -used without arguments, clears @value{GDBN}'s symbol table info. No output is -produced, except for a completion notification. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{symbol-file}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx -^done -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Miscellaneous Commands -@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi} - -@c @subheading -gdb-complete - -@subheading The @code{-gdb-exit} Command -@findex -gdb-exit - -@subsubheading Synopsis - -@example - -gdb-exit -@end example - -Exit @value{GDBN} immediately. - -@subsubheading @value{GDBN} Command - -Approximately corresponds to @samp{quit}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --gdb-exit -@end smallexample - -@subheading The @code{-gdb-set} Command -@findex -gdb-set - -@subsubheading Synopsis - -@example - -gdb-set -@end example - -Set an internal @value{GDBN} variable. -@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ????? - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{set}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --gdb-set $foo=3 -^done -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-gdb-show} Command -@findex -gdb-show - -@subsubheading Synopsis - -@example - -gdb-show -@end example - -Show the current value of a @value{GDBN} variable. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{show}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --gdb-show annotate -^done,value="0" -(@value{GDBP}) -@end smallexample - -@c @subheading -gdb-source - - -@subheading The @code{-gdb-version} Command -@findex -gdb-version - -@subsubheading Synopsis - -@example - -gdb-version -@end example - -Show version information for @value{GDBN}. Used mostly in testing. - -@subsubheading @value{GDBN} Command - -There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this -information when you start an interactive session. - -@subsubheading Example - -@c This example modifies the actual output from GDB to avoid overfull -@c box in TeX. -@smallexample -(@value{GDBP}) --gdb-version -~GNU gdb 5.2.1 -~Copyright 2000 Free Software Foundation, Inc. -~GDB is free software, covered by the GNU General Public License, and -~you are welcome to change it and/or distribute copies of it under -~ certain conditions. -~Type "show copying" to see the conditions. -~There is absolutely no warranty for GDB. Type "show warranty" for -~ details. -~This GDB was configured as - "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi". -^done -(@value{GDBP}) -@end smallexample - -@subheading The @code{-interpreter-exec} Command -@findex -interpreter-exec - -@subheading Synopsis - -@smallexample --interpreter-exec @var{interpreter} @var{command} -@end smallexample - -Execute the specified @var{command} in the given @var{interpreter}. - -@subheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{interpreter-exec}. - -@subheading Example - -@smallexample -(@value{GDBP}) --interpreter-exec console "break main" -&"During symbol reading, couldn't parse type; debugger out of date?.\n" -&"During symbol reading, bad structure-type format.\n" -~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n" -^done -(@value{GDBP}) -@end smallexample - -@ignore -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Kod Commands -@section @sc{gdb/mi} Kod Commands - -The Kod commands are not implemented. - -@c @subheading -kod-info - -@c @subheading -kod-list - -@c @subheading -kod-list-object-types - -@c @subheading -kod-show - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Memory Overlay Commands -@section @sc{gdb/mi} Memory Overlay Commands - -The memory overlay commands are not implemented. - -@c @subheading -overlay-auto - -@c @subheading -overlay-list-mapping-state - -@c @subheading -overlay-list-overlays - -@c @subheading -overlay-map - -@c @subheading -overlay-off - -@c @subheading -overlay-on - -@c @subheading -overlay-unmap - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Signal Handling Commands -@section @sc{gdb/mi} Signal Handling Commands - -Signal handling commands are not implemented. - -@c @subheading -signal-handle - -@c @subheading -signal-list-handle-actions - -@c @subheading -signal-list-signal-types -@end ignore - - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Stack Manipulation -@section @sc{gdb/mi} Stack Manipulation Commands - - -@subheading The @code{-stack-info-frame} Command -@findex -stack-info-frame - -@subsubheading Synopsis - -@example - -stack-info-frame -@end example - -Get info on the current frame. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame} -(without arguments). - -@subsubheading Example -N.A. - -@subheading The @code{-stack-info-depth} Command -@findex -stack-info-depth - -@subsubheading Synopsis - -@example - -stack-info-depth [ @var{max-depth} ] -@end example - -Return the depth of the stack. If the integer argument @var{max-depth} -is specified, do not count beyond @var{max-depth} frames. - -@subsubheading @value{GDBN} Command - -There's no equivalent @value{GDBN} command. - -@subsubheading Example - -For a stack with frame levels 0 through 11: - -@smallexample -(@value{GDBP}) --stack-info-depth -^done,depth="12" -(@value{GDBP}) --stack-info-depth 4 -^done,depth="4" -(@value{GDBP}) --stack-info-depth 12 -^done,depth="12" -(@value{GDBP}) --stack-info-depth 11 -^done,depth="11" -(@value{GDBP}) --stack-info-depth 13 -^done,depth="12" -(@value{GDBP}) -@end smallexample - -@subheading The @code{-stack-list-arguments} Command -@findex -stack-list-arguments - -@subsubheading Synopsis - -@example - -stack-list-arguments @var{show-values} - [ @var{low-frame} @var{high-frame} ] -@end example - -Display a list of the arguments for the frames between @var{low-frame} -and @var{high-frame} (inclusive). If @var{low-frame} and -@var{high-frame} are not provided, list the arguments for the whole call -stack. - -The @var{show-values} argument must have a value of 0 or 1. A value of -0 means that only the names of the arguments are listed, a value of 1 -means that both names and values of the arguments are printed. - -@subsubheading @value{GDBN} Command - -@value{GDBN} does not have an equivalent command. @code{gdbtk} has a -@samp{gdb_get_args} command which partially overlaps with the -functionality of @samp{-stack-list-arguments}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --stack-list-frames -^done, -stack=[ -frame=@{level="0",addr="0x00010734",func="callee4", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}, -frame=@{level="1",addr="0x0001076c",func="callee3", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}, -frame=@{level="2",addr="0x0001078c",func="callee2", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@}, -frame=@{level="3",addr="0x000107b4",func="callee1", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@}, -frame=@{level="4",addr="0x000107e0",func="main", -file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}] -(@value{GDBP}) --stack-list-arguments 0 -^done, -stack-args=[ -frame=@{level="0",args=[]@}, -frame=@{level="1",args=[name="strarg"]@}, -frame=@{level="2",args=[name="intarg",name="strarg"]@}, -frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@}, -frame=@{level="4",args=[]@}] -(@value{GDBP}) --stack-list-arguments 1 -^done, -stack-args=[ -frame=@{level="0",args=[]@}, -frame=@{level="1", - args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@}, -frame=@{level="2",args=[ -@{name="intarg",value="2"@}, -@{name="strarg",value="0x11940 \"A string argument.\""@}]@}, -@{frame=@{level="3",args=[ -@{name="intarg",value="2"@}, -@{name="strarg",value="0x11940 \"A string argument.\""@}, -@{name="fltarg",value="3.5"@}]@}, -frame=@{level="4",args=[]@}] -(@value{GDBP}) --stack-list-arguments 0 2 2 -^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}] -(@value{GDBP}) --stack-list-arguments 1 2 2 -^done,stack-args=[frame=@{level="2", -args=[@{name="intarg",value="2"@}, -@{name="strarg",value="0x11940 \"A string argument.\""@}]@}] -(@value{GDBP}) -@end smallexample - -@c @subheading -stack-list-exception-handlers - - -@subheading The @code{-stack-list-frames} Command -@findex -stack-list-frames - -@subsubheading Synopsis - -@example - -stack-list-frames [ @var{low-frame} @var{high-frame} ] -@end example - -List the frames currently on the stack. For each frame it displays the -following info: - -@table @samp -@item @var{level} -The frame number, 0 being the topmost frame, i.e. the innermost function. -@item @var{addr} -The @code{$pc} value for that frame. -@item @var{func} -Function name. -@item @var{file} -File name of the source file where the function lives. -@item @var{line} -Line number corresponding to the @code{$pc}. -@end table - -If invoked without arguments, this command prints a backtrace for the -whole stack. If given two integer arguments, it shows the frames whose -levels are between the two arguments (inclusive). If the two arguments -are equal, it shows the single frame at the corresponding level. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}. - -@subsubheading Example - -Full stack backtrace: - -@smallexample -(@value{GDBP}) --stack-list-frames -^done,stack= -[frame=@{level="0",addr="0x0001076c",func="foo", - file="recursive2.c",line="11"@}, -frame=@{level="1",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="2",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="3",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="4",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="5",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="6",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="7",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="8",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="9",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="10",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="11",addr="0x00010738",func="main", - file="recursive2.c",line="4"@}] -(@value{GDBP}) -@end smallexample - -Show frames between @var{low_frame} and @var{high_frame}: - -@smallexample -(@value{GDBP}) --stack-list-frames 3 5 -^done,stack= -[frame=@{level="3",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="4",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}, -frame=@{level="5",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}] -(@value{GDBP}) -@end smallexample - -Show a single frame: - -@smallexample -(@value{GDBP}) --stack-list-frames 3 3 -^done,stack= -[frame=@{level="3",addr="0x000107a4",func="foo", - file="recursive2.c",line="14"@}] -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-stack-list-locals} Command -@findex -stack-list-locals - -@subsubheading Synopsis - -@example - -stack-list-locals @var{print-values} -@end example - -Display the local variable names for the current frame. With an -argument of 0 prints only the names of the variables, with argument of 1 -prints also their values. - -@subsubheading @value{GDBN} Command - -@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --stack-list-locals 0 -^done,locals=[name="A",name="B",name="C"] -(@value{GDBP}) --stack-list-locals 1 -^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@}, - @{name="C",value="3"@}] -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-stack-select-frame} Command -@findex -stack-select-frame - -@subsubheading Synopsis - -@example - -stack-select-frame @var{framenum} -@end example - -Change the current frame. Select a different frame @var{framenum} on -the stack. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} commands are @samp{frame}, @samp{up}, -@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --stack-select-frame 2 -^done -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Symbol Query -@section @sc{gdb/mi} Symbol Query Commands - - -@subheading The @code{-symbol-info-address} Command -@findex -symbol-info-address - -@subsubheading Synopsis - -@example - -symbol-info-address @var{symbol} -@end example - -Describe where @var{symbol} is stored. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info address}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-info-file} Command -@findex -symbol-info-file - -@subsubheading Synopsis - -@example - -symbol-info-file -@end example - -Show the file for the symbol. - -@subsubheading @value{GDBN} Command - -There's no equivalent @value{GDBN} command. @code{gdbtk} has -@samp{gdb_find_file}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-info-function} Command -@findex -symbol-info-function - -@subsubheading Synopsis - -@example - -symbol-info-function -@end example - -Show which function the symbol lives in. - -@subsubheading @value{GDBN} Command - -@samp{gdb_get_function} in @code{gdbtk}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-info-line} Command -@findex -symbol-info-line - -@subsubheading Synopsis - -@example - -symbol-info-line -@end example - -Show the core addresses of the code for a source line. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} comamnd is @samp{info line}. -@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-info-symbol} Command -@findex -symbol-info-symbol - -@subsubheading Synopsis - -@example - -symbol-info-symbol @var{addr} -@end example - -Describe what symbol is at location @var{addr}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{info symbol}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-list-functions} Command -@findex -symbol-list-functions - -@subsubheading Synopsis - -@example - -symbol-list-functions -@end example - -List the functions in the executable. - -@subsubheading @value{GDBN} Command - -@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and -@samp{gdb_search} in @code{gdbtk}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-list-types} Command -@findex -symbol-list-types - -@subsubheading Synopsis - -@example - -symbol-list-types -@end example - -List all the type names. - -@subsubheading @value{GDBN} Command - -The corresponding commands are @samp{info types} in @value{GDBN}, -@samp{gdb_search} in @code{gdbtk}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-list-variables} Command -@findex -symbol-list-variables - -@subsubheading Synopsis - -@example - -symbol-list-variables -@end example - -List all the global and static variable names. - -@subsubheading @value{GDBN} Command - -@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-locate} Command -@findex -symbol-locate - -@subsubheading Synopsis - -@example - -symbol-locate -@end example - -@subsubheading @value{GDBN} Command - -@samp{gdb_loc} in @code{gdbtk}. - -@subsubheading Example -N.A. - - -@subheading The @code{-symbol-type} Command -@findex -symbol-type - -@subsubheading Synopsis - -@example - -symbol-type @var{variable} -@end example - -Show type of @var{variable}. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has -@samp{gdb_obj_variable}. - -@subsubheading Example -N.A. - - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Target Manipulation -@section @sc{gdb/mi} Target Manipulation Commands - - -@subheading The @code{-target-attach} Command -@findex -target-attach - -@subsubheading Synopsis - -@example - -target-attach @var{pid} | @var{file} -@end example - -Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{attach}. - -@subsubheading Example -N.A. - - -@subheading The @code{-target-compare-sections} Command -@findex -target-compare-sections - -@subsubheading Synopsis - -@example - -target-compare-sections [ @var{section} ] -@end example - -Compare data of section @var{section} on target to the exec file. -Without the argument, all sections are compared. - -@subsubheading @value{GDBN} Command - -The @value{GDBN} equivalent is @samp{compare-sections}. - -@subsubheading Example -N.A. - - -@subheading The @code{-target-detach} Command -@findex -target-detach - -@subsubheading Synopsis - -@example - -target-detach -@end example - -Disconnect from the remote target. There's no output. - -@subsubheading @value{GDBN} command - -The corresponding @value{GDBN} command is @samp{detach}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --target-detach -^done -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-target-download} Command -@findex -target-download - -@subsubheading Synopsis - -@example - -target-download -@end example - -Loads the executable onto the remote target. -It prints out an update message every half second, which includes the fields: - -@table @samp -@item section -The name of the section. -@item section-sent -The size of what has been sent so far for that section. -@item section-size -The size of the section. -@item total-sent -The total size of what was sent so far (the current and the previous sections). -@item total-size -The size of the overall executable to download. -@end table - -@noindent -Each message is sent as status record (@pxref{GDB/MI Output Syntax, , -@sc{gdb/mi} Output Syntax}). - -In addition, it prints the name and size of the sections, as they are -downloaded. These messages include the following fields: - -@table @samp -@item section -The name of the section. -@item section-size -The size of the section. -@item total-size -The size of the overall executable to download. -@end table - -@noindent -At the end, a summary is printed. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{load}. - -@subsubheading Example - -Note: each status message appears on a single line. Here the messages -have been broken down so that they can fit onto a page. - -@smallexample -(@value{GDBP}) --target-download -+download,@{section=".text",section-size="6668",total-size="9880"@} -+download,@{section=".text",section-sent="512",section-size="6668", -total-sent="512",total-size="9880"@} -+download,@{section=".text",section-sent="1024",section-size="6668", -total-sent="1024",total-size="9880"@} -+download,@{section=".text",section-sent="1536",section-size="6668", -total-sent="1536",total-size="9880"@} -+download,@{section=".text",section-sent="2048",section-size="6668", -total-sent="2048",total-size="9880"@} -+download,@{section=".text",section-sent="2560",section-size="6668", -total-sent="2560",total-size="9880"@} -+download,@{section=".text",section-sent="3072",section-size="6668", -total-sent="3072",total-size="9880"@} -+download,@{section=".text",section-sent="3584",section-size="6668", -total-sent="3584",total-size="9880"@} -+download,@{section=".text",section-sent="4096",section-size="6668", -total-sent="4096",total-size="9880"@} -+download,@{section=".text",section-sent="4608",section-size="6668", -total-sent="4608",total-size="9880"@} -+download,@{section=".text",section-sent="5120",section-size="6668", -total-sent="5120",total-size="9880"@} -+download,@{section=".text",section-sent="5632",section-size="6668", -total-sent="5632",total-size="9880"@} -+download,@{section=".text",section-sent="6144",section-size="6668", -total-sent="6144",total-size="9880"@} -+download,@{section=".text",section-sent="6656",section-size="6668", -total-sent="6656",total-size="9880"@} -+download,@{section=".init",section-size="28",total-size="9880"@} -+download,@{section=".fini",section-size="28",total-size="9880"@} -+download,@{section=".data",section-size="3156",total-size="9880"@} -+download,@{section=".data",section-sent="512",section-size="3156", -total-sent="7236",total-size="9880"@} -+download,@{section=".data",section-sent="1024",section-size="3156", -total-sent="7748",total-size="9880"@} -+download,@{section=".data",section-sent="1536",section-size="3156", -total-sent="8260",total-size="9880"@} -+download,@{section=".data",section-sent="2048",section-size="3156", -total-sent="8772",total-size="9880"@} -+download,@{section=".data",section-sent="2560",section-size="3156", -total-sent="9284",total-size="9880"@} -+download,@{section=".data",section-sent="3072",section-size="3156", -total-sent="9796",total-size="9880"@} -^done,address="0x10004",load-size="9880",transfer-rate="6586", -write-rate="429" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-target-exec-status} Command -@findex -target-exec-status - -@subsubheading Synopsis - -@example - -target-exec-status -@end example - -Provide information on the state of the target (whether it is running or -not, for instance). - -@subsubheading @value{GDBN} Command - -There's no equivalent @value{GDBN} command. - -@subsubheading Example -N.A. - - -@subheading The @code{-target-list-available-targets} Command -@findex -target-list-available-targets - -@subsubheading Synopsis - -@example - -target-list-available-targets -@end example - -List the possible targets to connect to. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{help target}. - -@subsubheading Example -N.A. - - -@subheading The @code{-target-list-current-targets} Command -@findex -target-list-current-targets - -@subsubheading Synopsis - -@example - -target-list-current-targets -@end example - -Describe the current target. - -@subsubheading @value{GDBN} Command - -The corresponding information is printed by @samp{info file} (among -other things). - -@subsubheading Example -N.A. - - -@subheading The @code{-target-list-parameters} Command -@findex -target-list-parameters - -@subsubheading Synopsis - -@example - -target-list-parameters -@end example - -@c ???? - -@subsubheading @value{GDBN} Command - -No equivalent. - -@subsubheading Example -N.A. - - -@subheading The @code{-target-select} Command -@findex -target-select - -@subsubheading Synopsis - -@example - -target-select @var{type} @var{parameters @dots{}} -@end example - -Connect @value{GDBN} to the remote target. This command takes two args: - -@table @samp -@item @var{type} -The type of target, for instance @samp{async}, @samp{remote}, etc. -@item @var{parameters} -Device names, host names and the like. @xref{Target Commands, , -Commands for managing targets}, for more details. -@end table - -The output is a connection notification, followed by the address at -which the target program is, in the following form: - -@smallexample -^connected,addr="@var{address}",func="@var{function name}", - args=[@var{arg list}] -@end smallexample - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{target}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --target-select async /dev/ttya -^connected,addr="0xfe00a300",func="??",args=[] -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Thread Commands -@section @sc{gdb/mi} Thread Commands - - -@subheading The @code{-thread-info} Command -@findex -thread-info - -@subsubheading Synopsis - -@example - -thread-info -@end example - -@subsubheading @value{GDBN} command - -No equivalent. - -@subsubheading Example -N.A. - - -@subheading The @code{-thread-list-all-threads} Command -@findex -thread-list-all-threads - -@subsubheading Synopsis - -@example - -thread-list-all-threads -@end example - -@subsubheading @value{GDBN} Command - -The equivalent @value{GDBN} command is @samp{info threads}. - -@subsubheading Example -N.A. - - -@subheading The @code{-thread-list-ids} Command -@findex -thread-list-ids - -@subsubheading Synopsis - -@example - -thread-list-ids -@end example - -Produces a list of the currently known @value{GDBN} thread ids. At the -end of the list it also prints the total number of such threads. - -@subsubheading @value{GDBN} Command - -Part of @samp{info threads} supplies the same information. - -@subsubheading Example - -No threads present, besides the main process: - -@smallexample -(@value{GDBP}) --thread-list-ids -^done,thread-ids=@{@},number-of-threads="0" -(@value{GDBP}) -@end smallexample - - -Several threads: - -@smallexample -(@value{GDBP}) --thread-list-ids -^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@}, -number-of-threads="3" -(@value{GDBP}) -@end smallexample - - -@subheading The @code{-thread-select} Command -@findex -thread-select - -@subsubheading Synopsis - -@example - -thread-select @var{threadnum} -@end example - -Make @var{threadnum} the current thread. It prints the number of the new -current thread, and the topmost frame for that thread. - -@subsubheading @value{GDBN} Command - -The corresponding @value{GDBN} command is @samp{thread}. - -@subsubheading Example - -@smallexample -(@value{GDBP}) --exec-next -^running -(@value{GDBP}) -*stopped,reason="end-stepping-range",thread-id="2",line="187", -file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c" -(@value{GDBP}) --thread-list-ids -^done, -thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@}, -number-of-threads="3" -(@value{GDBP}) --thread-select 3 -^done,new-thread-id="3", -frame=@{level="0",func="vprintf", -args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@}, -@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@} -(@value{GDBP}) -@end smallexample - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Tracepoint Commands -@section @sc{gdb/mi} Tracepoint Commands - -The tracepoint commands are not yet implemented. - -@c @subheading -trace-actions - -@c @subheading -trace-delete - -@c @subheading -trace-disable - -@c @subheading -trace-dump - -@c @subheading -trace-enable - -@c @subheading -trace-exists - -@c @subheading -trace-find - -@c @subheading -trace-frame-number - -@c @subheading -trace-info - -@c @subheading -trace-insert - -@c @subheading -trace-list - -@c @subheading -trace-pass-count - -@c @subheading -trace-save - -@c @subheading -trace-start - -@c @subheading -trace-stop - - -@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -@node GDB/MI Variable Objects -@section @sc{gdb/mi} Variable Objects - - -@subheading Motivation for Variable Objects in @sc{gdb/mi} - -For the implementation of a variable debugger window (locals, watched -expressions, etc.), we are proposing the adaptation of the existing code -used by @code{Insight}. - -The two main reasons for that are: - -@enumerate 1 -@item -It has been proven in practice (it is already on its second generation). - -@item -It will shorten development time (needless to say how important it is -now). -@end enumerate - -The original interface was designed to be used by Tcl code, so it was -slightly changed so it could be used through @sc{gdb/mi}. This section -describes the @sc{gdb/mi} operations that will be available and gives some -hints about their use. - -@emph{Note}: In addition to the set of operations described here, we -expect the @sc{gui} implementation of a variable window to require, at -least, the following operations: - -@itemize @bullet -@item @code{-gdb-show} @code{output-radix} -@item @code{-stack-list-arguments} -@item @code{-stack-list-locals} -@item @code{-stack-select-frame} -@end itemize - -@subheading Introduction to Variable Objects in @sc{gdb/mi} - -@cindex variable objects in @sc{gdb/mi} -The basic idea behind variable objects is the creation of a named object -to represent a variable, an expression, a memory location or even a CPU -register. For each object created, a set of operations is available for -examining or changing its properties. - -Furthermore, complex data types, such as C structures, are represented -in a tree format. For instance, the @code{struct} type variable is the -root and the children will represent the struct members. If a child -is itself of a complex type, it will also have children of its own. -Appropriate language differences are handled for C, C@t{++} and Java. - -When returning the actual values of the objects, this facility allows -for the individual selection of the display format used in the result -creation. It can be chosen among: binary, decimal, hexadecimal, octal -and natural. Natural refers to a default format automatically -chosen based on the variable type (like decimal for an @code{int}, hex -for pointers, etc.). - -The following is the complete set of @sc{gdb/mi} operations defined to -access this functionality: - -@multitable @columnfractions .4 .6 -@item @strong{Operation} -@tab @strong{Description} - -@item @code{-var-create} -@tab create a variable object -@item @code{-var-delete} -@tab delete the variable object and its children -@item @code{-var-set-format} -@tab set the display format of this variable -@item @code{-var-show-format} -@tab show the display format of this variable -@item @code{-var-info-num-children} -@tab tells how many children this object has -@item @code{-var-list-children} -@tab return a list of the object's children -@item @code{-var-info-type} -@tab show the type of this variable object -@item @code{-var-info-expression} -@tab print what this variable object represents -@item @code{-var-show-attributes} -@tab is this variable editable? does it exist here? -@item @code{-var-evaluate-expression} -@tab get the value of this variable -@item @code{-var-assign} -@tab set the value of this variable -@item @code{-var-update} -@tab update the variable and its children -@end multitable - -In the next subsection we describe each operation in detail and suggest -how it can be used. - -@subheading Description And Use of Operations on Variable Objects - -@subheading The @code{-var-create} Command -@findex -var-create - -@subsubheading Synopsis - -@example - -var-create @{@var{name} | "-"@} - @{@var{frame-addr} | "*"@} @var{expression} -@end example - -This operation creates a variable object, which allows the monitoring of -a variable, the result of an expression, a memory cell or a CPU -register. - -The @var{name} parameter is the string by which the object can be -referenced. It must be unique. If @samp{-} is specified, the varobj -system will generate a string ``varNNNNNN'' automatically. It will be -unique provided that one does not specify @var{name} on that format. -The command fails if a duplicate name is found. - -The frame under which the expression should be evaluated can be -specified by @var{frame-addr}. A @samp{*} indicates that the current -frame should be used. - -@var{expression} is any expression valid on the current language set (must not -begin with a @samp{*}), or one of the following: - -@itemize @bullet -@item -@samp{*@var{addr}}, where @var{addr} is the address of a memory cell - -@item -@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD) - -@item -@samp{$@var{regname}} --- a CPU register name -@end itemize - -@subsubheading Result - -This operation returns the name, number of children and the type of the -object created. Type is returned as a string as the ones generated by -the @value{GDBN} CLI: - -@example - name="@var{name}",numchild="N",type="@var{type}" -@end example - - -@subheading The @code{-var-delete} Command -@findex -var-delete - -@subsubheading Synopsis - -@example - -var-delete @var{name} -@end example - -Deletes a previously created variable object and all of its children. - -Returns an error if the object @var{name} is not found. - - -@subheading The @code{-var-set-format} Command -@findex -var-set-format - -@subsubheading Synopsis - -@example - -var-set-format @var{name} @var{format-spec} -@end example - -Sets the output format for the value of the object @var{name} to be -@var{format-spec}. - -The syntax for the @var{format-spec} is as follows: - -@example - @var{format-spec} @expansion{} - @{binary | decimal | hexadecimal | octal | natural@} -@end example - - -@subheading The @code{-var-show-format} Command -@findex -var-show-format - -@subsubheading Synopsis - -@example - -var-show-format @var{name} -@end example - -Returns the format used to display the value of the object @var{name}. - -@example - @var{format} @expansion{} - @var{format-spec} -@end example - - -@subheading The @code{-var-info-num-children} Command -@findex -var-info-num-children - -@subsubheading Synopsis - -@example - -var-info-num-children @var{name} -@end example - -Returns the number of children of a variable object @var{name}: - -@example - numchild=@var{n} -@end example - - -@subheading The @code{-var-list-children} Command -@findex -var-list-children - -@subsubheading Synopsis - -@example - -var-list-children @var{name} -@end example - -Returns a list of the children of the specified variable object: - -@example - numchild=@var{n},children=[@{name=@var{name}, - numchild=@var{n},type=@var{type}@},@r{(repeats N times)}] -@end example - - -@subheading The @code{-var-info-type} Command -@findex -var-info-type - -@subsubheading Synopsis - -@example - -var-info-type @var{name} -@end example - -Returns the type of the specified variable @var{name}. The type is -returned as a string in the same format as it is output by the -@value{GDBN} CLI: - -@example - type=@var{typename} -@end example - - -@subheading The @code{-var-info-expression} Command -@findex -var-info-expression - -@subsubheading Synopsis - -@example - -var-info-expression @var{name} -@end example - -Returns what is represented by the variable object @var{name}: - -@example - lang=@var{lang-spec},exp=@var{expression} -@end example - -@noindent -where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}. - -@subheading The @code{-var-show-attributes} Command -@findex -var-show-attributes - -@subsubheading Synopsis - -@example - -var-show-attributes @var{name} -@end example - -List attributes of the specified variable object @var{name}: - -@example - status=@var{attr} [ ( ,@var{attr} )* ] -@end example - -@noindent -where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}. - -@subheading The @code{-var-evaluate-expression} Command -@findex -var-evaluate-expression - -@subsubheading Synopsis - -@example - -var-evaluate-expression @var{name} -@end example - -Evaluates the expression that is represented by the specified variable -object and returns its value as a string in the current format specified -for the object: - -@example - value=@var{value} -@end example - -Note that one must invoke @code{-var-list-children} for a variable -before the value of a child variable can be evaluated. - -@subheading The @code{-var-assign} Command -@findex -var-assign - -@subsubheading Synopsis - -@example - -var-assign @var{name} @var{expression} -@end example - -Assigns the value of @var{expression} to the variable object specified -by @var{name}. The object must be @samp{editable}. If the variable's -value is altered by the assign, the variable will show up in any -subsequent @code{-var-update} list. - -@subsubheading Example - -@example -(@value{GDBP}) --var-assign var1 3 -^done,value="3" -(@value{GDBP}) --var-update * -^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}] -(@value{GDBP}) -@end example - -@subheading The @code{-var-update} Command -@findex -var-update - -@subsubheading Synopsis - -@example - -var-update @{@var{name} | "*"@} -@end example - -Update the value of the variable object @var{name} by evaluating its -expression after fetching all the new values from memory or registers. -A @samp{*} causes all existing variable objects to be updated. diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 5a0bf50..d677842 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -80,6 +80,7 @@ struct mi_cmd mi_cmds[] = {"file-exec-and-symbols", "file %s", 0}, {"file-exec-file", "exec-file %s", 0}, {"file-list-exec-sections", 0, 0}, + {"file-list-exec-source-file", 0, 0, mi_cmd_file_list_exec_source_file}, {"file-list-exec-source-files", 0, 0}, {"file-list-shared-libraries", 0, 0}, {"file-list-symbol-files", 0, 0}, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 3eb6153..47e1bbf 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -80,6 +80,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_step; extern mi_cmd_args_ftype mi_cmd_exec_step_instruction; extern mi_cmd_args_ftype mi_cmd_exec_until; extern mi_cmd_args_ftype mi_cmd_exec_interrupt; +extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file; extern mi_cmd_argv_ftype mi_cmd_gdb_exit; extern mi_cmd_argv_ftype mi_cmd_interpreter_exec; extern mi_cmd_argv_ftype mi_cmd_stack_info_depth; diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c index 59ccdf3..3f2a902 100644 --- a/gdb/mi/mi-getopt.c +++ b/gdb/mi/mi-getopt.c @@ -74,3 +74,19 @@ mi_getopt (const char *prefix, } error ("%s: Unknown option ``%s''", prefix, arg + 1); } + +int +mi_valid_noargs (const char *prefix, int argc, char **argv) +{ + int optind = 0; + char *optarg; + static struct mi_opt opts[] = + { + 0 + }; + + if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1) + return 1; + else + return 0; +} diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h index 6b31adf..17d66fb 100644 --- a/gdb/mi/mi-getopt.h +++ b/gdb/mi/mi-getopt.h @@ -57,4 +57,24 @@ struct mi_opt struct mi_opt; +/* mi_valid_noargs + + Determines if ARGC/ARGV are a valid set of parameters to satisfy + an MI function that is not supposed to recieve any arguments. + + An MI function that should not recieve arguments can still be + passed parameters after the special option '--' such as below. + + Example: The MI function -exec-run takes no args. + However, the client may pass '-exec-run -- -a ...' + See PR-783 + + PREFIX is passed to mi_getopt for an error message. + + This function Returns 1 if the parameter pair ARGC/ARGV are valid + for an MI function that takes no arguments. Otherwise, it returns 0 + and the appropriate error message is displayed by mi_getopt. */ + +extern int mi_valid_noargs (const char *prefix, int argc, char **argv); + #endif diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index f08bd3f..6ba0698 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -514,6 +514,9 @@ get_register (int regnum, int format) char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); int optim; + int realnum; + CORE_ADDR addr; + enum lval_type lval; static struct ui_stream *stb = NULL; stb = ui_out_stream_new (uiout); @@ -521,9 +524,9 @@ get_register (int regnum, int format) if (format == 'N') format = 0; - get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, - deprecated_selected_frame, - regnum, (enum lval_type *) NULL); + frame_register (deprecated_selected_frame, regnum, &optim, &lval, &addr, + &realnum, raw_buffer); + if (optim) { xasprintf (&mi_error_message, "Optimized out"); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index f7156ca..2aac528 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -1,6 +1,6 @@ /* MI Command Set - output generating routines. - Copyright 2000, 2002 Free Software Foundation, Inc. + Copyright 2000, 2002, 2003 Free Software Foundation, Inc. Contributed by Cygnus Solutions (a Red Hat company). @@ -32,6 +32,7 @@ struct ui_out_data int mi_version; struct ui_file *buffer; }; +typedef struct ui_out_data mi_out_data; /* These are the MI output functions */ @@ -107,7 +108,7 @@ mi_table_begin (struct ui_out *uiout, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); mi_open (uiout, tblid, ui_out_type_tuple); mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/, "nr_rows", nr_rows); @@ -121,7 +122,7 @@ mi_table_begin (struct ui_out *uiout, void mi_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* close the table header line if there were any headers */ @@ -134,7 +135,7 @@ mi_table_body (struct ui_out *uiout) void mi_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); data->suppress_output = 0; mi_close (uiout, ui_out_type_list); /* body */ mi_close (uiout, ui_out_type_tuple); @@ -147,7 +148,7 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_open (uiout, NULL, ui_out_type_tuple); @@ -166,7 +167,7 @@ mi_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_open (uiout, id, type); @@ -179,7 +180,7 @@ mi_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_close (uiout, type); @@ -192,7 +193,7 @@ mi_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname, int value) { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -206,7 +207,7 @@ void mi_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; mi_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -223,7 +224,7 @@ mi_field_string (struct ui_out *uiout, const char *fldname, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); @@ -244,7 +245,7 @@ mi_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; field_separator (uiout); @@ -282,7 +283,7 @@ mi_wrap_hint (struct ui_out *uiout, char *identstring) void mi_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); gdb_flush (data->buffer); } @@ -296,7 +297,7 @@ static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); va_list args; field_separator (uiout); @@ -318,7 +319,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, static void field_separator (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); if (data->suppress_field_separator) data->suppress_field_separator = 0; else @@ -330,7 +331,7 @@ mi_open (struct ui_out *uiout, const char *name, enum ui_out_type type) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); field_separator (uiout); data->suppress_field_separator = 1; if (name) @@ -352,7 +353,7 @@ static void mi_close (struct ui_out *uiout, enum ui_out_type type) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); switch (type) { case ui_out_type_tuple: @@ -372,7 +373,7 @@ mi_close (struct ui_out *uiout, void mi_out_buffered (struct ui_out *uiout, char *string) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); fprintf_unfiltered (data->buffer, "%s", string); } @@ -381,7 +382,7 @@ mi_out_buffered (struct ui_out *uiout, char *string) void mi_out_rewind (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); ui_file_rewind (data->buffer); } @@ -397,7 +398,7 @@ void mi_out_put (struct ui_out *uiout, struct ui_file *stream) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); ui_file_put (data->buffer, do_write, stream); ui_file_rewind (data->buffer); } @@ -407,7 +408,7 @@ mi_out_put (struct ui_out *uiout, int mi_version (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + mi_out_data *data = ui_out_data (uiout); return data->mi_version; } @@ -417,7 +418,7 @@ struct ui_out * mi_out_new (int mi_version) { int flags = 0; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + mi_out_data *data = XMALLOC (mi_out_data); data->suppress_field_separator = 0; data->suppress_output = 0; data->mi_version = mi_version; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 6f6deeb..7739381 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -986,8 +986,14 @@ install_minimal_symbols (struct objfile *objfile) for (i = 0; i < mcount; i++) { + /* If a symbol's name starts with _Z and was successfully + demangled, then we can assume we've found a GNU v3 symbol. + For now we set the C++ ABI globally; if the user is + mixing ABIs then the user will need to "set cp-abi" + manually. */ const char *name = SYMBOL_LINKAGE_NAME (&objfile->msymbols[i]); - if (name[0] == '_' && name[1] == 'Z') + if (name[0] == '_' && name[1] == 'Z' + && SYMBOL_DEMANGLED_NAME (&objfile->msymbols[i]) != NULL) { set_cp_abi_as_auto_default ("gnu-v3"); break; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7ade6a2..7956be49 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -25,6 +25,7 @@ #include "defs.h" #include "gdb_string.h" +#include "gdb_assert.h" #include "frame.h" #include "inferior.h" #include "symtab.h" @@ -361,23 +362,57 @@ static struct cmd_list_element *showmipscmdlist = NULL; /* A set of original names, to be used when restoring back to generic registers from a specific set. */ +static char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES; -char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES; -char **mips_processor_reg_names = mips_generic_reg_names; +/* Integer registers 0 thru 31 are handled explicitly by + mips_register_name(). Processor specific registers 32 and above + are listed in the sets of register names assigned to + mips_processor_reg_names. */ +static char **mips_processor_reg_names = mips_generic_reg_names; +/* Return the name of the register corresponding to REGNO. */ static const char * -mips_register_name (int i) -{ - return mips_processor_reg_names[i]; +mips_register_name (int regno) +{ + /* GPR names for all ABIs other than n32/n64. */ + static char *mips_gpr_names[] = { + "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", + "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", + "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", + "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", + }; + + /* GPR names for n32 and n64 ABIs. */ + static char *mips_n32_n64_gpr_names[] = { + "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", + "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", + "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", + "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" + }; + + enum mips_abi abi = mips_abi (current_gdbarch); + + /* The MIPS integer registers are always mapped from 0 to 31. The + names of the registers (which reflects the conventions regarding + register use) vary depending on the ABI. */ + if (0 <= regno && regno < 32) + { + if (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64) + return mips_n32_n64_gpr_names[regno]; + else + return mips_gpr_names[regno]; + } + else if (32 <= regno && regno < NUM_REGS) + return mips_processor_reg_names[regno - 32]; + else + internal_error (__FILE__, __LINE__, + "mips_register_name: bad register number %d", regno); } + /* *INDENT-OFF* */ /* Names of IDT R3041 registers. */ char *mips_r3041_reg_names[] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", "sr", "lo", "hi", "bad", "cause","pc", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", @@ -391,10 +426,6 @@ char *mips_r3041_reg_names[] = { /* Names of IDT R3051 registers. */ char *mips_r3051_reg_names[] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", "sr", "lo", "hi", "bad", "cause","pc", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", @@ -408,10 +439,6 @@ char *mips_r3051_reg_names[] = { /* Names of IDT R3081 registers. */ char *mips_r3081_reg_names[] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", "sr", "lo", "hi", "bad", "cause","pc", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", @@ -425,10 +452,6 @@ char *mips_r3081_reg_names[] = { /* Names of LSI 33k registers. */ char *mips_lsi33k_reg_names[] = { - "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", - "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", "epc", "hi", "lo", "sr", "cause","badvaddr", "dcic", "bpc", "bda", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -636,7 +659,7 @@ mips_register_virtual_type (int reg) static CORE_ADDR mips_read_sp (void) { - return ADDR_BITS_REMOVE (read_register (SP_REGNUM)); + return read_signed_register (SP_REGNUM); } /* Should the upper word of 64-bit addresses be zeroed? */ @@ -1692,9 +1715,9 @@ mips_init_frame_pc_first (int fromleaf, struct frame_info *prev) CORE_ADDR pc, tmp; pc = ((fromleaf) - ? SAVED_PC_AFTER_CALL (get_next_frame (prev)) + ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev)) : get_next_frame (prev) - ? FRAME_SAVED_PC (get_next_frame (prev)) + ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev)) : read_pc ()); tmp = SKIP_TRAMPOLINE_CODE (pc); return tmp ? tmp : pc; @@ -1795,10 +1818,10 @@ heuristic_proc_start (CORE_ADDR pc) if (start_pc < fence) { /* It's not clear to me why we reach this point when - stop_soon_quietly, but with this test, at least we + stop_soon, but with this test, at least we don't print out warnings for every child forked (eg, on decstation). 22apr93 rich@cygnus.com. */ - if (!stop_soon_quietly) + if (stop_soon == NO_STOP_QUIETLY) { static int blurb_printed = 0; @@ -2419,10 +2442,9 @@ static CORE_ADDR get_frame_pointer (struct frame_info *frame, mips_extra_func_info_t proc_desc) { - return ADDR_BITS_REMOVE (read_next_frame_reg (frame, - PROC_FRAME_REG (proc_desc)) + - PROC_FRAME_OFFSET (proc_desc) - - PROC_FRAME_ADJUST (proc_desc)); + return (read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc)) + + PROC_FRAME_OFFSET (proc_desc) + - PROC_FRAME_ADJUST (proc_desc)); } static mips_extra_func_info_t cached_proc_desc; @@ -2432,7 +2454,7 @@ mips_frame_chain (struct frame_info *frame) { mips_extra_func_info_t proc_desc; CORE_ADDR tmp; - CORE_ADDR saved_pc = FRAME_SAVED_PC (frame); + CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame); if (saved_pc == 0 || inside_entry_file (saved_pc)) return 0; @@ -3725,117 +3747,12 @@ mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp) } static void -mips_push_register (CORE_ADDR * sp, int regno) -{ - char *buffer = alloca (MAX_REGISTER_RAW_SIZE); - int regsize; - int offset; - if (MIPS_SAVED_REGSIZE < REGISTER_RAW_SIZE (regno)) - { - regsize = MIPS_SAVED_REGSIZE; - offset = (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - ? REGISTER_RAW_SIZE (regno) - MIPS_SAVED_REGSIZE - : 0); - } - else - { - regsize = REGISTER_RAW_SIZE (regno); - offset = 0; - } - *sp -= regsize; - deprecated_read_register_gen (regno, buffer); - write_memory (*sp, buffer + offset, regsize); -} - -/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<(MIPS_NUMREGS-1). */ -#define MASK(i,j) (((1 << ((j)+1))-1) ^ ((1 << (i))-1)) - -static void -mips_push_dummy_frame (void) -{ - int ireg; - struct linked_proc_info *link = (struct linked_proc_info *) - xmalloc (sizeof (struct linked_proc_info)); - mips_extra_func_info_t proc_desc = &link->info; - CORE_ADDR sp = ADDR_BITS_REMOVE (read_signed_register (SP_REGNUM)); - CORE_ADDR old_sp = sp; - link->next = linked_proc_desc_table; - linked_proc_desc_table = link; - -/* FIXME! are these correct ? */ -#define PUSH_FP_REGNUM 16 /* must be a register preserved across calls */ -#define GEN_REG_SAVE_MASK MASK(1,16)|MASK(24,28)|(1<<(MIPS_NUMREGS-1)) -#define FLOAT_REG_SAVE_MASK MASK(0,19) -#define FLOAT_SINGLE_REG_SAVE_MASK \ - ((1<<18)|(1<<16)|(1<<14)|(1<<12)|(1<<10)|(1<<8)|(1<<6)|(1<<4)|(1<<2)|(1<<0)) - /* - * The registers we must save are all those not preserved across - * procedure calls. Dest_Reg (see tm-mips.h) must also be saved. - * In addition, we must save the PC, PUSH_FP_REGNUM, MMLO/-HI - * and FP Control/Status registers. - * - * - * Dummy frame layout: - * (high memory) - * Saved PC - * Saved MMHI, MMLO, FPC_CSR - * Saved R31 - * Saved R28 - * ... - * Saved R1 - * Saved D18 (i.e. F19, F18) - * ... - * Saved D0 (i.e. F1, F0) - * Argument build area and stack arguments written via mips_push_arguments - * (low memory) - */ - - /* Save special registers (PC, MMHI, MMLO, FPC_CSR) */ - PROC_FRAME_REG (proc_desc) = PUSH_FP_REGNUM; - PROC_FRAME_OFFSET (proc_desc) = 0; - PROC_FRAME_ADJUST (proc_desc) = 0; - mips_push_register (&sp, PC_REGNUM); - mips_push_register (&sp, HI_REGNUM); - mips_push_register (&sp, LO_REGNUM); - mips_push_register (&sp, MIPS_FPU_TYPE == MIPS_FPU_NONE ? 0 : FCRCS_REGNUM); - - /* Save general CPU registers */ - PROC_REG_MASK (proc_desc) = GEN_REG_SAVE_MASK; - /* PROC_REG_OFFSET is the offset of the first saved register from FP. */ - PROC_REG_OFFSET (proc_desc) = sp - old_sp - MIPS_SAVED_REGSIZE; - for (ireg = 32; --ireg >= 0;) - if (PROC_REG_MASK (proc_desc) & (1 << ireg)) - mips_push_register (&sp, ireg); - - /* Save floating point registers starting with high order word */ - PROC_FREG_MASK (proc_desc) = - MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? FLOAT_REG_SAVE_MASK - : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? FLOAT_SINGLE_REG_SAVE_MASK : 0; - /* PROC_FREG_OFFSET is the offset of the first saved *double* register - from FP. */ - PROC_FREG_OFFSET (proc_desc) = sp - old_sp - 8; - for (ireg = 32; --ireg >= 0;) - if (PROC_FREG_MASK (proc_desc) & (1 << ireg)) - mips_push_register (&sp, ireg + FP0_REGNUM); - - /* Update the frame pointer for the call dummy and the stack pointer. - Set the procedure's starting and ending addresses to point to the - call dummy address at the entry point. */ - write_register (PUSH_FP_REGNUM, old_sp); - write_register (SP_REGNUM, sp); - PROC_LOW_ADDR (proc_desc) = CALL_DUMMY_ADDRESS (); - PROC_HIGH_ADDR (proc_desc) = CALL_DUMMY_ADDRESS () + 4; - SET_PROC_DESC_IS_DUMMY (proc_desc); - PROC_PC_REG (proc_desc) = RA_REGNUM; -} - -static void mips_pop_frame (void) { register int regnum; struct frame_info *frame = get_current_frame (); CORE_ADDR new_sp = get_frame_base (frame); - mips_extra_func_info_t proc_desc = get_frame_extra_info (frame)->proc_desc; + mips_extra_func_info_t proc_desc; if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0)) { @@ -3844,7 +3761,8 @@ mips_pop_frame (void) return; } - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + proc_desc = get_frame_extra_info (frame)->proc_desc; + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); if (get_frame_saved_regs (frame) == NULL) DEPRECATED_FRAME_INIT_SAVED_REGS (frame); for (regnum = 0; regnum < NUM_REGS; regnum++) @@ -4026,154 +3944,126 @@ mips_read_fp_register_double (int regno, char *rare_buffer) } static void -mips_print_register (int regnum, int all) -{ - char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - - /* Get the data in raw format. */ - if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) - { - printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum)); - return; - } - - /* If we have a actual 32-bit floating point register (or we are in - 32-bit compatibility mode), and the register is even-numbered, - also print it as a double (spanning two registers). */ - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT - && (REGISTER_RAW_SIZE (regnum) == 4 - || mips2_fp_compat ()) - && !((regnum - FP0_REGNUM) & 1)) - { - char *dbuffer = alloca (2 * MAX_REGISTER_RAW_SIZE); - - mips_read_fp_register_double (regnum, dbuffer); - - printf_filtered ("(d%d: ", regnum - FP0_REGNUM); - val_print (mips_double_register_type (), dbuffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); - printf_filtered ("); "); - } - fputs_filtered (REGISTER_NAME (regnum), gdb_stdout); - - /* The problem with printing numeric register names (r26, etc.) is that - the user can't use them on input. Probably the best solution is to - fix it so that either the numeric or the funky (a2, etc.) names - are accepted on input. */ - if (regnum < MIPS_NUMREGS) - printf_filtered ("(r%d): ", regnum); - else - printf_filtered (": "); - - /* If virtual format is floating, print it that way. */ - if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT) - if (REGISTER_RAW_SIZE (regnum) == 8 && !mips2_fp_compat ()) - { - /* We have a meaningful 64-bit value in this register. Show - it as a 32-bit float and a 64-bit double. */ - int offset = 4 * (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG); - - printf_filtered (" (float) "); - val_print (mips_float_register_type (), raw_buffer + offset, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); - printf_filtered (", (double) "); - val_print (mips_double_register_type (), raw_buffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); - } - else - val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); - /* Else print as integer in hex. */ - else - { - int offset; - - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); - else - offset = 0; - - print_scalar_formatted (raw_buffer + offset, - REGISTER_VIRTUAL_TYPE (regnum), - 'x', 0, gdb_stdout); - } -} - -/* Replacement for generic do_registers_info. - Print regs in pretty columns. */ - -static int -do_fp_register_row (int regnum) +mips_print_fp_register (int regnum) { /* do values for FP (float) regs */ char *raw_buffer; double doub, flt1, flt2; /* doubles extracted from raw hex data */ - int inv1, inv2, inv3; + int inv1, inv2, namelen; raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM)); + printf_filtered ("%s:", REGISTER_NAME (regnum)); + printf_filtered ("%*s", 4 - (int) strlen (REGISTER_NAME (regnum)), ""); + if (REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ()) { - /* 4-byte registers: we can fit two registers per row. */ - /* Also print every pair of 4-byte regs as an 8-byte double. */ + /* 4-byte registers: Print hex and floating. Also print even + numbered registers as doubles. */ mips_read_fp_register_single (regnum, raw_buffer); flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1); - mips_read_fp_register_single (regnum + 1, raw_buffer); - flt2 = unpack_double (mips_float_register_type (), raw_buffer, &inv2); - - mips_read_fp_register_double (regnum, raw_buffer); - doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3); + print_scalar_formatted (raw_buffer, builtin_type_uint32, 'x', 'w', + gdb_stdout); - printf_filtered (" %-5s", REGISTER_NAME (regnum)); + printf_filtered (" flt: "); if (inv1) - printf_filtered (": <invalid float>"); + printf_filtered (" <invalid float> "); else printf_filtered ("%-17.9g", flt1); - printf_filtered (" %-5s", REGISTER_NAME (regnum + 1)); - if (inv2) - printf_filtered (": <invalid float>"); - else - printf_filtered ("%-17.9g", flt2); - - printf_filtered (" dbl: "); - if (inv3) - printf_filtered ("<invalid double>"); - else - printf_filtered ("%-24.17g", doub); - printf_filtered ("\n"); + if (regnum % 2 == 0) + { + mips_read_fp_register_double (regnum, raw_buffer); + doub = unpack_double (mips_double_register_type (), raw_buffer, + &inv2); - /* may want to do hex display here (future enhancement) */ - regnum += 2; + printf_filtered (" dbl: "); + if (inv2) + printf_filtered ("<invalid double>"); + else + printf_filtered ("%-24.17g", doub); + } } else { - /* Eight byte registers: print each one as float AND as double. */ + /* Eight byte registers: print each one as hex, float and double. */ mips_read_fp_register_single (regnum, raw_buffer); - flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1); + flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1); mips_read_fp_register_double (regnum, raw_buffer); - doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3); + doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2); - printf_filtered (" %-5s: ", REGISTER_NAME (regnum)); + + print_scalar_formatted (raw_buffer, builtin_type_uint64, 'x', 'g', + gdb_stdout); + + printf_filtered (" flt: "); if (inv1) printf_filtered ("<invalid float>"); else - printf_filtered ("flt: %-17.9g", flt1); + printf_filtered ("%-17.9g", flt1); printf_filtered (" dbl: "); - if (inv3) + if (inv2) printf_filtered ("<invalid double>"); else printf_filtered ("%-24.17g", doub); + } +} - printf_filtered ("\n"); - /* may want to do hex display here (future enhancement) */ - regnum++; +static void +mips_print_register (int regnum, int all) +{ + char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); + int offset; + + if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT) + { + mips_print_fp_register (regnum); + return; } - return regnum; + + /* Get the data in raw format. */ + if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer)) + { + printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum)); + return; + } + + fputs_filtered (REGISTER_NAME (regnum), gdb_stdout); + + /* The problem with printing numeric register names (r26, etc.) is that + the user can't use them on input. Probably the best solution is to + fix it so that either the numeric or the funky (a2, etc.) names + are accepted on input. */ + if (regnum < MIPS_NUMREGS) + printf_filtered ("(r%d): ", regnum); + else + printf_filtered (": "); + + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum); + else + offset = 0; + + print_scalar_formatted (raw_buffer + offset, + REGISTER_VIRTUAL_TYPE (regnum), + 'x', 0, gdb_stdout); } +/* Replacement for generic do_registers_info. + Print regs in pretty columns. */ + +static int +do_fp_register_row (int regnum) +{ + printf_filtered (" "); + mips_print_fp_register (regnum); + printf_filtered ("\n"); + return regnum + 1; +} + + /* Print a row's worth of GP (int) registers, with name labels above */ static int @@ -5546,23 +5436,45 @@ mips_saved_pc_after_call (struct frame_info *frame) static int mips_stab_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 38 && num < 70) return num + FP0_REGNUM - 38; + else if (num == 70) + return HI_REGNUM; + else if (num == 71) + return LO_REGNUM; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } -/* Convert a ecoff register number to a gdb REGNUM */ + +/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */ static int -mips_ecoff_reg_to_regnum (int num) +mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 32 && num < 64) return num + FP0_REGNUM - 32; + else if (num == 64) + return HI_REGNUM; + else if (num == 65) + return LO_REGNUM; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } + /* Convert an integer into an address. By first converting the value into a pointer and then extracting it signed, the address is guarenteed to be correctly sign extended. */ @@ -5714,6 +5626,34 @@ 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 + 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) + { + /* 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"; + 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; + 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; + else + tm_print_insn_info.mach = bfd_mach_mips8000; + } + else + /* This string is not recognized explicitly by the disassembler, + but it tells the disassembler to not try to guess the ABI from + 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"; + if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, @@ -5769,7 +5709,7 @@ mips_gdbarch_init (struct gdbarch_info info, switch (mips_abi) { case MIPS_ABI_O32: - set_gdbarch_push_arguments (gdbarch, mips_o32_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_o32_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value); tdep->mips_default_saved_regsize = 4; @@ -5788,7 +5728,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_o32_use_struct_convention); break; case MIPS_ABI_O64: - set_gdbarch_push_arguments (gdbarch, mips_o64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_o64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_o64_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_o64_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5807,7 +5747,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_o32_use_struct_convention); break; case MIPS_ABI_EABI32: - set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value); tdep->mips_default_saved_regsize = 4; @@ -5826,7 +5766,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_eabi_use_struct_convention); break; case MIPS_ABI_EABI64: - set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value); set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5845,7 +5785,7 @@ mips_gdbarch_init (struct gdbarch_info info, mips_eabi_use_struct_convention); break; case MIPS_ABI_N32: - set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5858,25 +5798,13 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_long_long_bit (gdbarch, 64); - - /* Set up the disassembler info, so that we get the right - register names from libopcodes. */ - tm_print_insn_info.flavour = bfd_target_elf_flavour; - 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; - else - tm_print_insn_info.mach = bfd_mach_mips8000; - set_gdbarch_use_struct_convention (gdbarch, mips_n32n64_use_struct_convention); set_gdbarch_reg_struct_has_addr (gdbarch, mips_n32n64_reg_struct_has_addr); break; case MIPS_ABI_N64: - set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments); set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value); set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value); tdep->mips_default_saved_regsize = 8; @@ -5889,18 +5817,6 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); - - /* Set up the disassembler info, so that we get the right - register names from libopcodes. */ - tm_print_insn_info.flavour = bfd_target_elf_flavour; - 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; - else - tm_print_insn_info.mach = bfd_mach_mips8000; - set_gdbarch_use_struct_convention (gdbarch, mips_n32n64_use_struct_convention); set_gdbarch_reg_struct_has_addr (gdbarch, @@ -5966,7 +5882,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ set_gdbarch_read_sp (gdbarch, mips_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); /* Add/remove bits from an address. The MIPS needs be careful to ensure that all 32 bit addresses are sign extended to 64 bits. */ @@ -5979,7 +5895,9 @@ mips_gdbarch_init (struct gdbarch_info info, /* Map debug register numbers onto internal register numbers. */ set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); - set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum); + set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); /* Initialize a frame */ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs); @@ -5987,19 +5905,13 @@ mips_gdbarch_init (struct gdbarch_info info, /* MIPS version of CALL_DUMMY */ - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address); - set_gdbarch_push_return_address (gdbarch, mips_push_return_address); - set_gdbarch_pop_frame (gdbarch, mips_pop_frame); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_fix_call_dummy (gdbarch, mips_fix_call_dummy); set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words)); - set_gdbarch_push_return_address (gdbarch, mips_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address); set_gdbarch_frame_align (gdbarch, mips_frame_align); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_register_convertible (gdbarch, mips_register_convertible); @@ -6008,21 +5920,21 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_register_convert_to_raw (gdbarch, mips_register_convert_to_raw); - set_gdbarch_frame_chain (gdbarch, mips_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, mips_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_frame_saved_pc (gdbarch, mips_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mips_frame_saved_pc); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_frame_args_skip (gdbarch, 0); - set_gdbarch_get_saved_register (gdbarch, mips_get_saved_register); + set_gdbarch_deprecated_get_saved_register (gdbarch, mips_get_saved_register); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue); - set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mips_saved_pc_after_call); set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer); @@ -6041,7 +5953,7 @@ mips_gdbarch_init (struct gdbarch_info info, /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); - set_gdbarch_store_struct_return (gdbarch, mips_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, mips_store_struct_return); set_gdbarch_extract_struct_value_address (gdbarch, mips_extract_struct_value_address); @@ -6222,9 +6134,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: GDB_TARGET_IS_MIPS64 = %d\n", GDB_TARGET_IS_MIPS64); fprintf_unfiltered (file, - "mips_dump_tdep: GEN_REG_SAVE_MASK = %d\n", - GEN_REG_SAVE_MASK); - fprintf_unfiltered (file, "mips_dump_tdep: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n", XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT)); fprintf_unfiltered (file, @@ -6338,9 +6247,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) "mips_dump_tdep: PS_REGNUM = %d\n", PS_REGNUM); fprintf_unfiltered (file, - "mips_dump_tdep: PUSH_FP_REGNUM = %d\n", - PUSH_FP_REGNUM); - fprintf_unfiltered (file, "mips_dump_tdep: RA_REGNUM = %d\n", RA_REGNUM); fprintf_unfiltered (file, diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h index 92202e2..8e19bcd 100644 --- a/gdb/mips-tdep.h +++ b/gdb/mips-tdep.h @@ -22,6 +22,8 @@ #ifndef MIPS_TDEP_H #define MIPS_TDEP_H +struct gdbarch; + /* All the possible MIPS ABIs. */ enum mips_abi { diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c index 22f947f..f1fd859 100644 --- a/gdb/mipsm3-nat.c +++ b/gdb/mipsm3-nat.c @@ -1,386 +1,386 @@ -/* Definitions to make GDB run on a mips box under Mach 3.0 - Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Mach specific routines for little endian mips (e.g. pmax) - * running Mach 3.0 - * - * Author: Jukka Virtanen <jtv@hut.fi> - */ - -#include "defs.h" -#include "inferior.h" -#include "regcache.h" - -#include <stdio.h> - -#include <mach.h> -#include <mach/message.h> -#include <mach/exception.h> -#include <mach_error.h> - -/* Find offsets to thread states at compile time. - * If your compiler does not grok this, check the hand coded - * offsets and use them. - */ - -#if 1 - -#define REG_OFFSET(reg) (int)(&((struct mips_thread_state *)0)->reg) -#define CREG_OFFSET(reg) (int)(&((struct mips_float_state *)0)->reg) -#define EREG_OFFSET(reg) (int)(&((struct mips_exc_state *)0)->reg) - -/* at reg_offset[i] is the offset to the mips_thread_state - * location where the gdb registers[i] is stored. - * - * -1 means mach does not save it anywhere. - */ -static int reg_offset[] = -{ - /* zero at v0 v1 */ - -1, REG_OFFSET (r1), REG_OFFSET (r2), REG_OFFSET (r3), - - /* a0 a1 a2 a3 */ - REG_OFFSET (r4), REG_OFFSET (r5), REG_OFFSET (r6), REG_OFFSET (r7), - - /* t0 t1 t2 t3 */ - REG_OFFSET (r8), REG_OFFSET (r9), REG_OFFSET (r10), REG_OFFSET (r11), - - /* t4 t5 t6 t7 */ - REG_OFFSET (r12), REG_OFFSET (r13), REG_OFFSET (r14), REG_OFFSET (r15), - - /* s0 s1 s2 s3 */ - REG_OFFSET (r16), REG_OFFSET (r17), REG_OFFSET (r18), REG_OFFSET (r19), - - /* s4 s5 s6 s7 */ - REG_OFFSET (r20), REG_OFFSET (r21), REG_OFFSET (r22), REG_OFFSET (r23), - - /* t8 t9 k0 k1 */ - REG_OFFSET (r24), REG_OFFSET (r25), REG_OFFSET (r26), REG_OFFSET (r27), - - /* gp sp s8(30) == fp(72) ra */ - REG_OFFSET (r28), REG_OFFSET (r29), REG_OFFSET (r30), REG_OFFSET (r31), - - /* sr(32) PS_REGNUM */ - EREG_OFFSET (coproc_state), - - /* lo(33) hi(34) */ - REG_OFFSET (mdlo), REG_OFFSET (mdhi), - - /* bad(35) cause(36) pc(37) */ - EREG_OFFSET (address), EREG_OFFSET (cause), REG_OFFSET (pc), - - /* f0(38) f1(39) f2(40) f3(41) */ - CREG_OFFSET (r0), CREG_OFFSET (r1), CREG_OFFSET (r2), CREG_OFFSET (r3), - CREG_OFFSET (r4), CREG_OFFSET (r5), CREG_OFFSET (r6), CREG_OFFSET (r7), - CREG_OFFSET (r8), CREG_OFFSET (r9), CREG_OFFSET (r10), CREG_OFFSET (r11), - CREG_OFFSET (r12), CREG_OFFSET (r13), CREG_OFFSET (r14), CREG_OFFSET (r15), - CREG_OFFSET (r16), CREG_OFFSET (r17), CREG_OFFSET (r18), CREG_OFFSET (r19), - CREG_OFFSET (r20), CREG_OFFSET (r21), CREG_OFFSET (r22), CREG_OFFSET (r23), - CREG_OFFSET (r24), CREG_OFFSET (r25), CREG_OFFSET (r26), CREG_OFFSET (r27), - CREG_OFFSET (r28), CREG_OFFSET (r29), CREG_OFFSET (r30), CREG_OFFSET (r31), - - /* fsr(70) fir(71) fp(72) == s8(30) */ - CREG_OFFSET (csr), CREG_OFFSET (esr), REG_OFFSET (r30) -}; -#else -/* If the compiler does not grok the above defines */ -static int reg_offset[] = -{ -/* mach_thread_state offsets: */ - -1, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, - 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, -/*sr, lo, hi,addr,cause,pc */ - 8, 124, 128, 4, 0, 132, -/* mach_float_state offsets: */ - 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, - 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, -/*fsr,fir */ - 128, 132, -/* FP_REGNUM pseudo maps to s8==r30 in mach_thread_state */ - 116 -}; -#endif - -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM - * Caller knows that the regs handled in one transaction are of same size. - */ -#define FETCH_REGS(state, regnum, count) \ - memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \ - (char *)state+reg_offset[ regnum ], \ - count*REGISTER_SIZE) - -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -#define STORE_REGS(state, regnum, count) \ - memcpy ((char *)state+reg_offset[ regnum ], \ - &deprecated_registers[REGISTER_BYTE (regnum)], \ - count*REGISTER_SIZE) - -#define REGS_ALL -1 -#define REGS_NORMAL 1 -#define REGS_EXC 2 -#define REGS_COP1 4 - -/* Hardware regs that matches FP_REGNUM */ -#define MACH_FP_REGNUM 30 - -/* Fech thread's registers. if regno == -1, fetch all regs */ -void -fetch_inferior_registers (int regno) -{ - kern_return_t ret; - - thread_state_data_t state; - struct mips_exc_state exc_state; - - int stateCnt = MIPS_THREAD_STATE_COUNT; - - int which_regs = 0; /* A bit mask */ - - if (!MACH_PORT_VALID (current_thread)) - error ("fetch inferior registers: Invalid thread"); - - if (regno < -1 || regno >= NUM_REGS) - error ("invalid register %d supplied to fetch_inferior_registers", regno); - - if (regno == -1) - which_regs = REGS_ALL; - else if (regno == ZERO_REGNUM) - { - int zero = 0; - supply_register (ZERO_REGNUM, &zero); - return; - } - else if ((ZERO_REGNUM < regno && regno < PS_REGNUM) - || regno == FP_REGNUM - || regno == LO_REGNUM - || regno == HI_REGNUM - || regno == PC_REGNUM) - which_regs = REGS_NORMAL; - else if (FP0_REGNUM <= regno && regno <= FCRIR_REGNUM) - which_regs = REGS_COP1 | REGS_EXC; - else - which_regs = REGS_EXC; - - /* fetch regs saved to mips_thread_state */ - if (which_regs & REGS_NORMAL) - { - ret = thread_get_state (current_thread, - MIPS_THREAD_STATE, - state, - &stateCnt); - CHK ("fetch inferior registers: thread_get_state", ret); - - if (which_regs == REGS_NORMAL) - { - /* Fetch also FP_REGNUM if fetching MACH_FP_REGNUM and vice versa */ - if (regno == MACH_FP_REGNUM || regno == FP_REGNUM) - { - supply_register (FP_REGNUM, - (char *) state + reg_offset[MACH_FP_REGNUM]); - supply_register (MACH_FP_REGNUM, - (char *) state + reg_offset[MACH_FP_REGNUM]); - } - else - supply_register (regno, - (char *) state + reg_offset[regno]); - return; - } - - /* ZERO_REGNUM is always zero */ - *(int *) deprecated_registers = 0; - - /* Copy thread saved regs 1..31 to gdb's reg value array - * Luckily, they are contiquous - */ - FETCH_REGS (state, 1, 31); - - /* Copy mdlo and mdhi */ - FETCH_REGS (state, LO_REGNUM, 2); - - /* Copy PC */ - FETCH_REGS (state, PC_REGNUM, 1); - - /* Mach 3.0 saves FP to MACH_FP_REGNUM. - * For some reason gdb wants to assign a pseudo register for it. - */ - FETCH_REGS (state, FP_REGNUM, 1); - } - - /* Read exc state. Also read if need to fetch floats */ - if (which_regs & REGS_EXC) - { - stateCnt = MIPS_EXC_STATE_COUNT; - ret = thread_get_state (current_thread, - MIPS_EXC_STATE, - (thread_state_t) & exc_state, - &stateCnt); - CHK ("fetch inferior regs (exc): thread_get_state", ret); - - /* We need to fetch exc_state to see if the floating - * state is valid for the thread. - */ - - /* cproc_state: Which coprocessors the thread uses */ - supply_register (PS_REGNUM, - (char *) &exc_state + reg_offset[PS_REGNUM]); - - if (which_regs == REGS_EXC || which_regs == REGS_ALL) - { - supply_register (BADVADDR_REGNUM, - (char *) &exc_state + reg_offset[BADVADDR_REGNUM]); - - supply_register (CAUSE_REGNUM, - (char *) &exc_state + reg_offset[CAUSE_REGNUM]); - if (which_regs == REGS_EXC) - return; - } - } - - - if (which_regs & REGS_COP1) - { - /* If the thread does not have saved COPROC1, set regs to zero */ - - if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1)) - bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], - sizeof (struct mips_float_state)); - else - { - stateCnt = MIPS_FLOAT_STATE_COUNT; - ret = thread_get_state (current_thread, - MIPS_FLOAT_STATE, - state, - &stateCnt); - CHK ("fetch inferior regs (floats): thread_get_state", ret); - - if (regno != -1) - { - supply_register (regno, - (char *) state + reg_offset[regno]); - return; - } - - FETCH_REGS (state, FP0_REGNUM, 34); - } - } - - /* All registers are valid, if not returned yet */ - deprecated_registers_fetched (); -} - -/* Store gdb's view of registers to the thread. - * All registers are always valid when entering here. - * @@ ahem, maybe that is too strict, we could validate the necessary ones - * here. - * - * Hmm. It seems that gdb set $reg=value command first reads everything, - * then sets the reg and then stores everything. -> we must make sure - * that the immutable registers are not changed by reading them first. - */ - -void -store_inferior_registers (register int regno) -{ - thread_state_data_t state; - kern_return_t ret; - - if (!MACH_PORT_VALID (current_thread)) - error ("store inferior registers: Invalid thread"); - - /* Check for read only regs. - * @@ If some of these is can be changed, fix this - */ - if (regno == ZERO_REGNUM || - regno == PS_REGNUM || - regno == BADVADDR_REGNUM || - regno == CAUSE_REGNUM || - regno == FCRIR_REGNUM) - { - message ("You can not alter read-only register `%s'", - REGISTER_NAME (regno)); - fetch_inferior_registers (regno); - return; - } - - if (regno == -1) - { - /* Don't allow these to change */ - - /* ZERO_REGNUM */ - *(int *) deprecated_registers = 0; - - fetch_inferior_registers (PS_REGNUM); - fetch_inferior_registers (BADVADDR_REGNUM); - fetch_inferior_registers (CAUSE_REGNUM); - fetch_inferior_registers (FCRIR_REGNUM); - } - - if (regno == -1 || (ZERO_REGNUM < regno && regno <= PC_REGNUM)) - { -#if 1 - /* Mach 3.0 saves thread's FP to MACH_FP_REGNUM. - * GDB wants assigns a pseudo register FP_REGNUM for frame pointer. - * - * @@@ Here I assume (!) that gdb's FP has the value that - * should go to threads frame pointer. If not true, this - * fails badly!!!!! - */ - memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)], - &deprecated_registers[REGISTER_BYTE (FP_REGNUM)], - REGISTER_RAW_SIZE (FP_REGNUM)); -#endif - - /* Save gdb's regs 1..31 to thread saved regs 1..31 - * Luckily, they are contiquous - */ - STORE_REGS (state, 1, 31); - - /* Save mdlo, mdhi */ - STORE_REGS (state, LO_REGNUM, 2); - - /* Save PC */ - STORE_REGS (state, PC_REGNUM, 1); - - ret = thread_set_state (current_thread, - MIPS_THREAD_STATE, - state, - MIPS_FLOAT_STATE_COUNT); - CHK ("store inferior regs : thread_set_state", ret); - } - - if (regno == -1 || regno >= FP0_REGNUM) - { - /* If thread has floating state, save it */ - if (read_register (PS_REGNUM) & MIPS_STATUS_USE_COP1) - { - /* Do NOT save FCRIR_REGNUM */ - STORE_REGS (state, FP0_REGNUM, 33); - - ret = thread_set_state (current_thread, - MIPS_FLOAT_STATE, - state, - MIPS_FLOAT_STATE_COUNT); - CHK ("store inferior registers (floats): thread_set_state", ret); - } - else if (regno != -1) - message - ("Thread does not use floating point unit, floating regs not saved"); - } -} +// OBSOLETE /* Definitions to make GDB run on a mips box under Mach 3.0 +// OBSOLETE Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* Mach specific routines for little endian mips (e.g. pmax) +// OBSOLETE * running Mach 3.0 +// OBSOLETE * +// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi> +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #include <stdio.h> +// OBSOLETE +// OBSOLETE #include <mach.h> +// OBSOLETE #include <mach/message.h> +// OBSOLETE #include <mach/exception.h> +// OBSOLETE #include <mach_error.h> +// OBSOLETE +// OBSOLETE /* Find offsets to thread states at compile time. +// OBSOLETE * If your compiler does not grok this, check the hand coded +// OBSOLETE * offsets and use them. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE #if 1 +// OBSOLETE +// OBSOLETE #define REG_OFFSET(reg) (int)(&((struct mips_thread_state *)0)->reg) +// OBSOLETE #define CREG_OFFSET(reg) (int)(&((struct mips_float_state *)0)->reg) +// OBSOLETE #define EREG_OFFSET(reg) (int)(&((struct mips_exc_state *)0)->reg) +// OBSOLETE +// OBSOLETE /* at reg_offset[i] is the offset to the mips_thread_state +// OBSOLETE * location where the gdb registers[i] is stored. +// OBSOLETE * +// OBSOLETE * -1 means mach does not save it anywhere. +// OBSOLETE */ +// OBSOLETE static int reg_offset[] = +// OBSOLETE { +// OBSOLETE /* zero at v0 v1 */ +// OBSOLETE -1, REG_OFFSET (r1), REG_OFFSET (r2), REG_OFFSET (r3), +// OBSOLETE +// OBSOLETE /* a0 a1 a2 a3 */ +// OBSOLETE REG_OFFSET (r4), REG_OFFSET (r5), REG_OFFSET (r6), REG_OFFSET (r7), +// OBSOLETE +// OBSOLETE /* t0 t1 t2 t3 */ +// OBSOLETE REG_OFFSET (r8), REG_OFFSET (r9), REG_OFFSET (r10), REG_OFFSET (r11), +// OBSOLETE +// OBSOLETE /* t4 t5 t6 t7 */ +// OBSOLETE REG_OFFSET (r12), REG_OFFSET (r13), REG_OFFSET (r14), REG_OFFSET (r15), +// OBSOLETE +// OBSOLETE /* s0 s1 s2 s3 */ +// OBSOLETE REG_OFFSET (r16), REG_OFFSET (r17), REG_OFFSET (r18), REG_OFFSET (r19), +// OBSOLETE +// OBSOLETE /* s4 s5 s6 s7 */ +// OBSOLETE REG_OFFSET (r20), REG_OFFSET (r21), REG_OFFSET (r22), REG_OFFSET (r23), +// OBSOLETE +// OBSOLETE /* t8 t9 k0 k1 */ +// OBSOLETE REG_OFFSET (r24), REG_OFFSET (r25), REG_OFFSET (r26), REG_OFFSET (r27), +// OBSOLETE +// OBSOLETE /* gp sp s8(30) == fp(72) ra */ +// OBSOLETE REG_OFFSET (r28), REG_OFFSET (r29), REG_OFFSET (r30), REG_OFFSET (r31), +// OBSOLETE +// OBSOLETE /* sr(32) PS_REGNUM */ +// OBSOLETE EREG_OFFSET (coproc_state), +// OBSOLETE +// OBSOLETE /* lo(33) hi(34) */ +// OBSOLETE REG_OFFSET (mdlo), REG_OFFSET (mdhi), +// OBSOLETE +// OBSOLETE /* bad(35) cause(36) pc(37) */ +// OBSOLETE EREG_OFFSET (address), EREG_OFFSET (cause), REG_OFFSET (pc), +// OBSOLETE +// OBSOLETE /* f0(38) f1(39) f2(40) f3(41) */ +// OBSOLETE CREG_OFFSET (r0), CREG_OFFSET (r1), CREG_OFFSET (r2), CREG_OFFSET (r3), +// OBSOLETE CREG_OFFSET (r4), CREG_OFFSET (r5), CREG_OFFSET (r6), CREG_OFFSET (r7), +// OBSOLETE CREG_OFFSET (r8), CREG_OFFSET (r9), CREG_OFFSET (r10), CREG_OFFSET (r11), +// OBSOLETE CREG_OFFSET (r12), CREG_OFFSET (r13), CREG_OFFSET (r14), CREG_OFFSET (r15), +// OBSOLETE CREG_OFFSET (r16), CREG_OFFSET (r17), CREG_OFFSET (r18), CREG_OFFSET (r19), +// OBSOLETE CREG_OFFSET (r20), CREG_OFFSET (r21), CREG_OFFSET (r22), CREG_OFFSET (r23), +// OBSOLETE CREG_OFFSET (r24), CREG_OFFSET (r25), CREG_OFFSET (r26), CREG_OFFSET (r27), +// OBSOLETE CREG_OFFSET (r28), CREG_OFFSET (r29), CREG_OFFSET (r30), CREG_OFFSET (r31), +// OBSOLETE +// OBSOLETE /* fsr(70) fir(71) fp(72) == s8(30) */ +// OBSOLETE CREG_OFFSET (csr), CREG_OFFSET (esr), REG_OFFSET (r30) +// OBSOLETE }; +// OBSOLETE #else +// OBSOLETE /* If the compiler does not grok the above defines */ +// OBSOLETE static int reg_offset[] = +// OBSOLETE { +// OBSOLETE /* mach_thread_state offsets: */ +// OBSOLETE -1, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, +// OBSOLETE 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, +// OBSOLETE /*sr, lo, hi,addr,cause,pc */ +// OBSOLETE 8, 124, 128, 4, 0, 132, +// OBSOLETE /* mach_float_state offsets: */ +// OBSOLETE 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, +// OBSOLETE 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, +// OBSOLETE /*fsr,fir */ +// OBSOLETE 128, 132, +// OBSOLETE /* FP_REGNUM pseudo maps to s8==r30 in mach_thread_state */ +// OBSOLETE 116 +// OBSOLETE }; +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Fetch COUNT contiguous registers from thread STATE starting from REGNUM +// OBSOLETE * Caller knows that the regs handled in one transaction are of same size. +// OBSOLETE */ +// OBSOLETE #define FETCH_REGS(state, regnum, count) \ +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \ +// OBSOLETE (char *)state+reg_offset[ regnum ], \ +// OBSOLETE count*REGISTER_SIZE) +// OBSOLETE +// OBSOLETE /* Store COUNT contiguous registers to thread STATE starting from REGNUM */ +// OBSOLETE #define STORE_REGS(state, regnum, count) \ +// OBSOLETE memcpy ((char *)state+reg_offset[ regnum ], \ +// OBSOLETE &deprecated_registers[REGISTER_BYTE (regnum)], \ +// OBSOLETE count*REGISTER_SIZE) +// OBSOLETE +// OBSOLETE #define REGS_ALL -1 +// OBSOLETE #define REGS_NORMAL 1 +// OBSOLETE #define REGS_EXC 2 +// OBSOLETE #define REGS_COP1 4 +// OBSOLETE +// OBSOLETE /* Hardware regs that matches FP_REGNUM */ +// OBSOLETE #define MACH_FP_REGNUM 30 +// OBSOLETE +// OBSOLETE /* Fech thread's registers. if regno == -1, fetch all regs */ +// OBSOLETE void +// OBSOLETE fetch_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE thread_state_data_t state; +// OBSOLETE struct mips_exc_state exc_state; +// OBSOLETE +// OBSOLETE int stateCnt = MIPS_THREAD_STATE_COUNT; +// OBSOLETE +// OBSOLETE int which_regs = 0; /* A bit mask */ +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (current_thread)) +// OBSOLETE error ("fetch inferior registers: Invalid thread"); +// OBSOLETE +// OBSOLETE if (regno < -1 || regno >= NUM_REGS) +// OBSOLETE error ("invalid register %d supplied to fetch_inferior_registers", regno); +// OBSOLETE +// OBSOLETE if (regno == -1) +// OBSOLETE which_regs = REGS_ALL; +// OBSOLETE else if (regno == ZERO_REGNUM) +// OBSOLETE { +// OBSOLETE int zero = 0; +// OBSOLETE supply_register (ZERO_REGNUM, &zero); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE else if ((ZERO_REGNUM < regno && regno < PS_REGNUM) +// OBSOLETE || regno == FP_REGNUM +// OBSOLETE || regno == LO_REGNUM +// OBSOLETE || regno == HI_REGNUM +// OBSOLETE || regno == PC_REGNUM) +// OBSOLETE which_regs = REGS_NORMAL; +// OBSOLETE else if (FP0_REGNUM <= regno && regno <= FCRIR_REGNUM) +// OBSOLETE which_regs = REGS_COP1 | REGS_EXC; +// OBSOLETE else +// OBSOLETE which_regs = REGS_EXC; +// OBSOLETE +// OBSOLETE /* fetch regs saved to mips_thread_state */ +// OBSOLETE if (which_regs & REGS_NORMAL) +// OBSOLETE { +// OBSOLETE ret = thread_get_state (current_thread, +// OBSOLETE MIPS_THREAD_STATE, +// OBSOLETE state, +// OBSOLETE &stateCnt); +// OBSOLETE CHK ("fetch inferior registers: thread_get_state", ret); +// OBSOLETE +// OBSOLETE if (which_regs == REGS_NORMAL) +// OBSOLETE { +// OBSOLETE /* Fetch also FP_REGNUM if fetching MACH_FP_REGNUM and vice versa */ +// OBSOLETE if (regno == MACH_FP_REGNUM || regno == FP_REGNUM) +// OBSOLETE { +// OBSOLETE supply_register (FP_REGNUM, +// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]); +// OBSOLETE supply_register (MACH_FP_REGNUM, +// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE supply_register (regno, +// OBSOLETE (char *) state + reg_offset[regno]); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* ZERO_REGNUM is always zero */ +// OBSOLETE *(int *) deprecated_registers = 0; +// OBSOLETE +// OBSOLETE /* Copy thread saved regs 1..31 to gdb's reg value array +// OBSOLETE * Luckily, they are contiquous +// OBSOLETE */ +// OBSOLETE FETCH_REGS (state, 1, 31); +// OBSOLETE +// OBSOLETE /* Copy mdlo and mdhi */ +// OBSOLETE FETCH_REGS (state, LO_REGNUM, 2); +// OBSOLETE +// OBSOLETE /* Copy PC */ +// OBSOLETE FETCH_REGS (state, PC_REGNUM, 1); +// OBSOLETE +// OBSOLETE /* Mach 3.0 saves FP to MACH_FP_REGNUM. +// OBSOLETE * For some reason gdb wants to assign a pseudo register for it. +// OBSOLETE */ +// OBSOLETE FETCH_REGS (state, FP_REGNUM, 1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read exc state. Also read if need to fetch floats */ +// OBSOLETE if (which_regs & REGS_EXC) +// OBSOLETE { +// OBSOLETE stateCnt = MIPS_EXC_STATE_COUNT; +// OBSOLETE ret = thread_get_state (current_thread, +// OBSOLETE MIPS_EXC_STATE, +// OBSOLETE (thread_state_t) & exc_state, +// OBSOLETE &stateCnt); +// OBSOLETE CHK ("fetch inferior regs (exc): thread_get_state", ret); +// OBSOLETE +// OBSOLETE /* We need to fetch exc_state to see if the floating +// OBSOLETE * state is valid for the thread. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* cproc_state: Which coprocessors the thread uses */ +// OBSOLETE supply_register (PS_REGNUM, +// OBSOLETE (char *) &exc_state + reg_offset[PS_REGNUM]); +// OBSOLETE +// OBSOLETE if (which_regs == REGS_EXC || which_regs == REGS_ALL) +// OBSOLETE { +// OBSOLETE supply_register (BADVADDR_REGNUM, +// OBSOLETE (char *) &exc_state + reg_offset[BADVADDR_REGNUM]); +// OBSOLETE +// OBSOLETE supply_register (CAUSE_REGNUM, +// OBSOLETE (char *) &exc_state + reg_offset[CAUSE_REGNUM]); +// OBSOLETE if (which_regs == REGS_EXC) +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE if (which_regs & REGS_COP1) +// OBSOLETE { +// OBSOLETE /* If the thread does not have saved COPROC1, set regs to zero */ +// OBSOLETE +// OBSOLETE if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1)) +// OBSOLETE bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], +// OBSOLETE sizeof (struct mips_float_state)); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE stateCnt = MIPS_FLOAT_STATE_COUNT; +// OBSOLETE ret = thread_get_state (current_thread, +// OBSOLETE MIPS_FLOAT_STATE, +// OBSOLETE state, +// OBSOLETE &stateCnt); +// OBSOLETE CHK ("fetch inferior regs (floats): thread_get_state", ret); +// OBSOLETE +// OBSOLETE if (regno != -1) +// OBSOLETE { +// OBSOLETE supply_register (regno, +// OBSOLETE (char *) state + reg_offset[regno]); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE FETCH_REGS (state, FP0_REGNUM, 34); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* All registers are valid, if not returned yet */ +// OBSOLETE deprecated_registers_fetched (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store gdb's view of registers to the thread. +// OBSOLETE * All registers are always valid when entering here. +// OBSOLETE * @@ ahem, maybe that is too strict, we could validate the necessary ones +// OBSOLETE * here. +// OBSOLETE * +// OBSOLETE * Hmm. It seems that gdb set $reg=value command first reads everything, +// OBSOLETE * then sets the reg and then stores everything. -> we must make sure +// OBSOLETE * that the immutable registers are not changed by reading them first. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE store_inferior_registers (register int regno) +// OBSOLETE { +// OBSOLETE thread_state_data_t state; +// OBSOLETE kern_return_t ret; +// OBSOLETE +// OBSOLETE if (!MACH_PORT_VALID (current_thread)) +// OBSOLETE error ("store inferior registers: Invalid thread"); +// OBSOLETE +// OBSOLETE /* Check for read only regs. +// OBSOLETE * @@ If some of these is can be changed, fix this +// OBSOLETE */ +// OBSOLETE if (regno == ZERO_REGNUM || +// OBSOLETE regno == PS_REGNUM || +// OBSOLETE regno == BADVADDR_REGNUM || +// OBSOLETE regno == CAUSE_REGNUM || +// OBSOLETE regno == FCRIR_REGNUM) +// OBSOLETE { +// OBSOLETE message ("You can not alter read-only register `%s'", +// OBSOLETE REGISTER_NAME (regno)); +// OBSOLETE fetch_inferior_registers (regno); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (regno == -1) +// OBSOLETE { +// OBSOLETE /* Don't allow these to change */ +// OBSOLETE +// OBSOLETE /* ZERO_REGNUM */ +// OBSOLETE *(int *) deprecated_registers = 0; +// OBSOLETE +// OBSOLETE fetch_inferior_registers (PS_REGNUM); +// OBSOLETE fetch_inferior_registers (BADVADDR_REGNUM); +// OBSOLETE fetch_inferior_registers (CAUSE_REGNUM); +// OBSOLETE fetch_inferior_registers (FCRIR_REGNUM); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (regno == -1 || (ZERO_REGNUM < regno && regno <= PC_REGNUM)) +// OBSOLETE { +// OBSOLETE #if 1 +// OBSOLETE /* Mach 3.0 saves thread's FP to MACH_FP_REGNUM. +// OBSOLETE * GDB wants assigns a pseudo register FP_REGNUM for frame pointer. +// OBSOLETE * +// OBSOLETE * @@@ Here I assume (!) that gdb's FP has the value that +// OBSOLETE * should go to threads frame pointer. If not true, this +// OBSOLETE * fails badly!!!!! +// OBSOLETE */ +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)], +// OBSOLETE &deprecated_registers[REGISTER_BYTE (FP_REGNUM)], +// OBSOLETE REGISTER_RAW_SIZE (FP_REGNUM)); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Save gdb's regs 1..31 to thread saved regs 1..31 +// OBSOLETE * Luckily, they are contiquous +// OBSOLETE */ +// OBSOLETE STORE_REGS (state, 1, 31); +// OBSOLETE +// OBSOLETE /* Save mdlo, mdhi */ +// OBSOLETE STORE_REGS (state, LO_REGNUM, 2); +// OBSOLETE +// OBSOLETE /* Save PC */ +// OBSOLETE STORE_REGS (state, PC_REGNUM, 1); +// OBSOLETE +// OBSOLETE ret = thread_set_state (current_thread, +// OBSOLETE MIPS_THREAD_STATE, +// OBSOLETE state, +// OBSOLETE MIPS_FLOAT_STATE_COUNT); +// OBSOLETE CHK ("store inferior regs : thread_set_state", ret); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (regno == -1 || regno >= FP0_REGNUM) +// OBSOLETE { +// OBSOLETE /* If thread has floating state, save it */ +// OBSOLETE if (read_register (PS_REGNUM) & MIPS_STATUS_USE_COP1) +// OBSOLETE { +// OBSOLETE /* Do NOT save FCRIR_REGNUM */ +// OBSOLETE STORE_REGS (state, FP0_REGNUM, 33); +// OBSOLETE +// OBSOLETE ret = thread_set_state (current_thread, +// OBSOLETE MIPS_FLOAT_STATE, +// OBSOLETE state, +// OBSOLETE MIPS_FLOAT_STATE_COUNT); +// OBSOLETE CHK ("store inferior registers (floats): thread_set_state", ret); +// OBSOLETE } +// OBSOLETE else if (regno != -1) +// OBSOLETE message +// OBSOLETE ("Thread does not use floating point unit, floating regs not saved"); +// OBSOLETE } +// OBSOLETE } diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index bcd96ad..22f3b67 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -688,7 +688,7 @@ mn10300_frame_chain (struct frame_info *fi) /* The easiest way to get that info is to analyze our caller's frame. So we set up a dummy frame and call mn10300_analyze_prologue to find stuff for us. */ - dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi)); + dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi)); if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP) { @@ -728,7 +728,7 @@ mn10300_pop_frame_regular (struct frame_info *frame) { int regnum; - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ for (regnum = 0; regnum < NUM_REGS; regnum++) @@ -900,7 +900,7 @@ static void mn10300_init_extra_frame_info (int fromleaf, struct frame_info *fi) { if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); frame_saved_regs_zalloc (fi); frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); @@ -1166,18 +1166,18 @@ mn10300_gdbarch_init (struct gdbarch_info info, /* Stack unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mn10300_init_extra_frame_info); set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs); - set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, mn10300_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, mn10300_extract_struct_value_address); set_gdbarch_deprecated_store_return_value (gdbarch, mn10300_store_return_value); - set_gdbarch_store_struct_return (gdbarch, mn10300_store_struct_return); - set_gdbarch_pop_frame (gdbarch, mn10300_pop_frame); + set_gdbarch_deprecated_store_struct_return (gdbarch, mn10300_store_struct_return); + set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); @@ -1185,26 +1185,21 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_read_fp (gdbarch, generic_target_read_sp); /* Calling functions in the inferior from GDB. */ - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); set_gdbarch_call_dummy_words (gdbarch, mn10300_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mn10300_call_dummy_words)); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments); set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr); - set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, mn10300_push_return_address); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); set_gdbarch_use_struct_convention (gdbarch, mn10300_use_struct_convention); tdep->am33_mode = am33_mode; + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/gdb/monitor.h b/gdb/monitor.h index 7b87f95..9141450 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -24,6 +24,7 @@ #ifndef MONITOR_H #define MONITOR_H +struct target_waitstatus; struct serial; /* This structure describes the strings necessary to give small command diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 36ccadc..3a31ddb 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -190,8 +190,8 @@ umax_frame_num_args (struct frame_info *fi) if (enter_addr > 0) { pc = ((enter_addr == 1) - ? SAVED_PC_AFTER_CALL (fi) - : FRAME_SAVED_PC (fi)); + ? DEPRECATED_SAVED_PC_AFTER_CALL (fi) + : DEPRECATED_FRAME_SAVED_PC (fi)); insn = read_memory_integer (pc, 2); addr_mode = (insn >> 11) & 0x1f; insn = insn & 0x7ff; @@ -566,14 +566,14 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Frame and stack info */ set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue); - set_gdbarch_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, ns32k_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address); @@ -585,7 +585,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Return value info */ - set_gdbarch_store_struct_return (gdbarch, ns32k_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, ns32k_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, ns32k_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, @@ -593,17 +593,15 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call dummy info */ set_gdbarch_deprecated_push_dummy_frame (gdbarch, ns32k_push_dummy_frame); - set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, ns32k_pop_frame); set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words); set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy); set_gdbarch_call_dummy_start_offset (gdbarch, 3); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 15); set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); /* Breakpoint info */ set_gdbarch_decr_pc_after_break (gdbarch, 0); @@ -612,6 +610,9 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Misc info */ set_gdbarch_function_start_offset (gdbarch, 0); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c index bf5250f..24e422d 100644 --- a/gdb/ns32knbsd-nat.c +++ b/gdb/ns32knbsd-nat.c @@ -295,7 +295,9 @@ frame_num_args (struct frame_info *fi) enter_addr = ns32k_get_enter_addr (fi->pc); if (enter_addr = 0) return (-1); - argp = enter_addr == 1 ? SAVED_PC_AFTER_CALL (fi) : FRAME_SAVED_PC (fi); + argp = (enter_addr == 1 + ? DEPRECATED_SAVED_PC_AFTER_CALL (fi) + : DEPRECATED_FRAME_SAVED_PC (fi)); for (i = 0; i < 16; i++) { /* diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index e6155ba..329ddde 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -247,9 +247,11 @@ exp1 : exp /* Expressions, not including the comma operator. */ exp : '*' exp %prec UNARY { write_exp_elt_opcode (UNOP_IND); } + ; exp : '&' exp %prec UNARY { write_exp_elt_opcode (UNOP_ADDR); } + ; exp : '-' exp %prec UNARY { write_exp_elt_opcode (UNOP_NEG); } @@ -570,6 +572,7 @@ exp : SELECTOR write_exp_elt_opcode (OP_OBJC_SELECTOR); write_exp_string ($1); write_exp_elt_opcode (OP_OBJC_SELECTOR); } + ; exp : SIZEOF '(' type ')' %prec UNARY { write_exp_elt_opcode (OP_LONG); @@ -666,7 +669,7 @@ qualified_name: typebase COLONCOLON name write_exp_elt_opcode (OP_SCOPE); write_exp_elt_type (type); - write_exp_block (NULL); + write_exp_elt_block (NULL); write_exp_string ($3); write_exp_elt_opcode (OP_SCOPE); } diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 2292685..bbb1422 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -199,8 +199,10 @@ value_nsstring (char *ptr, int len) if (!target_has_execution) return 0; /* Can't call into inferior to create NSString. */ - if (!(sym = lookup_struct_typedef("NSString", 0, 1)) && - !(sym = lookup_struct_typedef("NXString", 0, 1))) + sym = lookup_struct_typedef("NSString", 0, 1); + if (sym == NULL) + sym = lookup_struct_typedef("NXString", 0, 1); + if (sym == NULL) type = lookup_pointer_type(builtin_type_void); else type = lookup_pointer_type(SYMBOL_TYPE (sym)); @@ -237,7 +239,7 @@ value_nsstring (char *ptr, int len) /* Objective-C name demangling. */ char * -objc_demangle (const char *mangled) +objc_demangle (const char *mangled, int options) { char *demangled, *cp; @@ -369,8 +371,6 @@ objc_printstr (struct ui_file *stream, char *string, int in_quotes = 0; int need_comma = 0; extern int inspect_it; - extern int repeat_count_threshold; - extern int print_max; /* If the string was not truncated due to `set print elements', and the last byte of it is a null, we don't print that, in @@ -593,6 +593,35 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid) return (type); } +/* Determine if we are currently in the Objective-C dispatch function. + If so, get the address of the method function that the dispatcher + would call and use that as the function to step into instead. Also + skip over the trampoline for the function (if any). This is better + for the user since they are only interested in stepping into the + method function anyway. */ +static CORE_ADDR +objc_skip_trampoline (CORE_ADDR stop_pc) +{ + CORE_ADDR real_stop_pc; + CORE_ADDR method_stop_pc; + + real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc); + + if (real_stop_pc != 0) + find_objc_msgcall (real_stop_pc, &method_stop_pc); + else + find_objc_msgcall (stop_pc, &method_stop_pc); + + if (method_stop_pc) + { + real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc); + if (real_stop_pc == 0) + real_stop_pc = method_stop_pc; + } + + return real_stop_pc; +} + /* Table mapping opcodes into strings for printing operators and precedences of the operators. */ @@ -670,6 +699,8 @@ const struct language_defn objc_language_defn = { c_print_type, /* Print a type using appropriate syntax */ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ + objc_skip_trampoline, /* Language specific skip_trampoline */ + objc_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -859,16 +890,17 @@ selectors_info (char *regexp, int from_tty) } if (regexp != NULL) - if (0 != (val = re_comp (myregexp))) - error ("Invalid regexp (%s): %s", val, regexp); + { + val = re_comp (myregexp); + if (val != 0) + error ("Invalid regexp (%s): %s", val, regexp); + } /* First time thru is JUST to get max length and count. */ ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -899,9 +931,7 @@ selectors_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -925,9 +955,7 @@ selectors_info (char *regexp, int from_tty) char *p = asel; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name = strchr (name, ' ') + 1; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1002,16 +1030,17 @@ classes_info (char *regexp, int from_tty) } if (regexp != NULL) - if (0 != (val = re_comp (myregexp))) - error ("Invalid regexp (%s): %s", val, regexp); + { + val = re_comp (myregexp); + if (val != 0) + error ("Invalid regexp (%s): %s", val, regexp); + } /* First time thru is JUST to get max length and count. */ ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1035,9 +1064,7 @@ classes_info (char *regexp, int from_tty) ALL_MSYMBOLS (objfile, msymbol) { QUIT; - name = SYMBOL_DEMANGLED_NAME (msymbol); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (msymbol); + name = SYMBOL_NATURAL_NAME (msymbol); if (name && (name[0] == '-' || name[0] == '+') && name[1] == '[') /* Got a method name. */ @@ -1054,9 +1081,7 @@ classes_info (char *regexp, int from_tty) char *p = aclass; QUIT; - name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]); - if (name == NULL) - name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]); + name = SYMBOL_NATURAL_NAME (sym_arr[ix]); name += 2; if (p[0] && specialcmp(name, p) == 0) continue; /* Seen this one already (not unique). */ @@ -1317,9 +1342,7 @@ find_methods (struct symtab *symtab, char type, /* Not in the specified symtab. */ continue; - symname = SYMBOL_DEMANGLED_NAME (msymbol); - if (symname == NULL) - symname = DEPRECATED_SYMBOL_NAME (msymbol); + symname = SYMBOL_NATURAL_NAME (msymbol); if (symname == NULL) continue; @@ -1355,10 +1378,8 @@ find_methods (struct symtab *symtab, char type, sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol)); if (sym != NULL) { - const char *newsymname = SYMBOL_DEMANGLED_NAME (sym); + const char *newsymname = SYMBOL_NATURAL_NAME (sym); - if (newsymname == NULL) - newsymname = DEPRECATED_SYMBOL_NAME (sym); if (strcmp (symname, newsymname) == 0) { /* Found a high-level method sym: swap it into the @@ -1701,7 +1722,10 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc) unsigned int i; find_objc_msgsend (); - if (new_pc != NULL) { *new_pc = 0; } + if (new_pc != NULL) + { + *new_pc = 0; + } for (i = 0; i < nmethcalls; i++) if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end)) diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h index 8506818..0c49bac 100644 --- a/gdb/objc-lang.h +++ b/gdb/objc-lang.h @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#if !defined(OBJC_LANG_H) +#define OBJC_LANG_H + +struct stoken; + struct value; struct block; @@ -36,7 +41,7 @@ extern int c_value_print (struct value *, struct ui_file *, extern CORE_ADDR lookup_objc_class (char *classname); extern int lookup_child_selector (char *methodname); -extern char *objc_demangle (const char *mangled); +extern char *objc_demangle (const char *mangled, int options); extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc); @@ -51,3 +56,10 @@ extern char *find_imps (struct symtab *symtab, struct block *block, unsigned int *nsym, unsigned int *ndebug); extern struct value *value_nsstring (char *ptr, int len); + +/* for parsing Objective C */ +extern void start_msglist (void); +extern void add_msglist (struct stoken *str, int addcolon); +extern int end_msglist (void); + +#endif diff --git a/gdb/objfiles.h b/gdb/objfiles.h index e710263..f747a68 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -65,14 +65,15 @@ struct htab; confused. However, we almost always have debugging information available for main(). - These variables are used to save the range of PC values which are valid - within the main() function and within the function containing the process - entry point. If we always consider the frame for main() as the outermost - frame when debugging user code, and the frame for the process entry - point function as the outermost frame when debugging startup code, then - all we have to do is have FRAME_CHAIN_VALID return false whenever a - frame's current PC is within the range specified by these variables. - In essence, we set "ceilings" in the frame chain beyond which we will + These variables are used to save the range of PC values which are + valid within the main() function and within the function containing + the process entry point. If we always consider the frame for + main() as the outermost frame when debugging user code, and the + frame for the process entry point function as the outermost frame + when debugging startup code, then all we have to do is have + DEPRECATED_FRAME_CHAIN_VALID return false whenever a frame's + current PC is within the range specified by these variables. In + essence, we set "ceilings" in the frame chain beyond which we will not proceed when following the frame chain back up the stack. A nice side effect is that we can still debug startup code without @@ -83,9 +84,10 @@ struct htab; information but we do have usable information for main(), backtraces from user code don't go wandering off into the startup code. - To use this method, define your FRAME_CHAIN_VALID macro like: + To use this method, define your DEPRECATED_FRAME_CHAIN_VALID macro + like: - #define FRAME_CHAIN_VALID(chain, thisframe) \ + #define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) \ (chain != 0 \ && !(inside_main_func ((thisframe)->pc)) \ && !(inside_entry_func ((thisframe)->pc))) diff --git a/gdb/observer.c b/gdb/observer.c index 92ec48e..6815d0f 100644 --- a/gdb/observer.c +++ b/gdb/observer.c @@ -190,3 +190,33 @@ observer_notify_normal_stop (void) { generic_observer_notify (normal_stop_subject, NULL); } + +/* The following code is only used to unit-test the observers from + our testsuite. DO NOT USE IT within observer.c! */ + +/* Since this code will not be used within GDB, it will trigger + a warning if we decide to compile with -Wunused-function. + This is ok for now. (brobecker 2003-03-18) */ + +static int observer_test_first_observer = 0; +static int observer_test_second_observer = 0; +static int observer_test_third_observer = 0; + +static void +observer_test_first_notification_function (void) +{ + observer_test_first_observer++; +} + +static void +observer_test_second_notification_function (void) +{ + observer_test_second_observer++; +} + +static void +observer_test_third_notification_function (void) +{ + observer_test_third_observer++; +} + @@ -21,6 +21,9 @@ #ifndef OCD_H #define OCD_H +struct mem_attrib; +struct target_ops; + /* Wiggler serial protocol definitions */ #define DLE 020 /* Quote char */ diff --git a/gdb/osabi.c b/gdb/osabi.c index ab49f9a..2241406 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -74,6 +74,8 @@ static const char * const gdb_osabi_names[] = "ARM APCS", "QNX Neutrino", + "Cygwin", + "<invalid>" }; diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 88c8cc0..827fa0e 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -461,6 +461,8 @@ const struct language_defn pascal_language_defn = pascal_print_type, /* Print a type using appropriate syntax */ pascal_val_print, /* Print a value using appropriate syntax */ pascal_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "%", "b", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index f02581b..9284751 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -347,14 +347,17 @@ ppc_linux_frame_saved_pc (struct frame_info *fi) if ((get_frame_type (fi) == SIGTRAMP_FRAME)) { CORE_ADDR regs_addr = - read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4); + read_memory_integer (get_frame_base (fi) + + PPC_LINUX_REGS_PTR_OFFSET, 4); /* return the NIP in the regs array */ return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_NIP, 4); } - else if (fi->next && (get_frame_type (fi->next) == SIGTRAMP_FRAME)) + else if (get_next_frame (fi) + && (get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) { CORE_ADDR regs_addr = - read_memory_integer (fi->next->frame + PPC_LINUX_REGS_PTR_OFFSET, 4); + read_memory_integer (get_frame_base (get_next_frame (fi)) + + PPC_LINUX_REGS_PTR_OFFSET, 4); /* return LNK in the regs array */ return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_LNK, 4); } @@ -367,12 +370,12 @@ ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *fi) { rs6000_init_extra_frame_info (fromleaf, fi); - if (fi->next != 0) + if (get_next_frame (fi) != 0) { /* We're called from get_prev_frame_info; check to see if this is a signal frame by looking to see if the pc points at trampoline code */ - if (ppc_linux_at_sigtramp_return_path (fi->pc)) + if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi))) deprecated_set_frame_type (fi, SIGTRAMP_FRAME); else /* FIXME: cagney/2002-11-10: Is this double bogus? What @@ -386,7 +389,7 @@ ppc_linux_frameless_function_invocation (struct frame_info *fi) { /* We'll find the wrong thing if we let rs6000_frameless_function_invocation () search for a signal trampoline */ - if (ppc_linux_at_sigtramp_return_path (fi->pc)) + if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi))) return 0; else return rs6000_frameless_function_invocation (fi); @@ -399,31 +402,32 @@ ppc_linux_frame_init_saved_regs (struct frame_info *fi) { CORE_ADDR regs_addr; int i; - if (fi->saved_regs) + if (get_frame_saved_regs (fi)) return; frame_saved_regs_zalloc (fi); regs_addr = - read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4); - fi->saved_regs[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] = + read_memory_integer (get_frame_base (fi) + + PPC_LINUX_REGS_PTR_OFFSET, 4); + get_frame_saved_regs (fi)[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP; + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] = regs_addr + 4 * PPC_LINUX_PT_MSR; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] = regs_addr + 4 * PPC_LINUX_PT_CCR; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] = regs_addr + 4 * PPC_LINUX_PT_LNK; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] = regs_addr + 4 * PPC_LINUX_PT_CTR; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] = regs_addr + 4 * PPC_LINUX_PT_XER; - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] = regs_addr + 4 * PPC_LINUX_PT_MQ; for (i = 0; i < 32; i++) - fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] = + get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] = regs_addr + 4 * PPC_LINUX_PT_R0 + 4 * i; for (i = 0; i < 32; i++) - fi->saved_regs[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i; + get_frame_saved_regs (fi)[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i; } else rs6000_frame_init_saved_regs (fi); @@ -434,7 +438,7 @@ ppc_linux_frame_chain (struct frame_info *thisframe) { /* Kernel properly constructs the frame chain for the handler */ if ((get_frame_type (thisframe) == SIGTRAMP_FRAME)) - return read_memory_integer ((thisframe)->frame, 4); + return read_memory_integer (get_frame_base (thisframe), 4); else return rs6000_frame_chain (thisframe); } @@ -729,8 +733,8 @@ ppc_linux_init_abi (struct gdbarch_info info, *_push_arguments(). The same remarks hold for the methods below. */ set_gdbarch_frameless_function_invocation (gdbarch, ppc_linux_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, ppc_linux_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ppc_linux_frame_init_saved_regs); diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 1f01706..9894a58 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -61,11 +61,11 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int structstkspace; int argoffset; int structoffset; - struct value *arg; struct type *type; int len; char old_sp_buf[4]; CORE_ADDR saved_sp; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); greg = struct_return ? 4 : 3; freg = 1; @@ -79,11 +79,12 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, are put in registers. */ for (argno = 0; argno < nargs; argno++) { - arg = args[argno]; + struct value *arg = args[argno]; type = check_typedef (VALUE_TYPE (arg)); len = TYPE_LENGTH (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (TYPE_CODE (type) == TYPE_CODE_FLT + && ppc_floating_point_unit_p (current_gdbarch)) { if (freg <= 8) freg++; @@ -96,7 +97,10 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, argstkspace += 8; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ + else if (len == 8 + && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */ + || (!ppc_floating_point_unit_p (current_gdbarch) + && TYPE_CODE (type) == TYPE_CODE_FLT))) /* double */ { if (greg > 9) { @@ -144,6 +148,20 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, argstkspace += 16; } } + else if (len == 8 + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (type)) + { + if (greg <= 10) + greg++; + else + { + /* Vector arguments must be aligned to 8 bytes on + the stack. */ + argstkspace += round2 (argstkspace, 8); + argstkspace += 8; + } + } } } @@ -170,30 +188,33 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, freg = 1; greg = 3; vreg = 2; + /* Fill in r3 with the return structure, if any */ if (struct_return) { - char val_buf[4]; - store_address (val_buf, 4, struct_addr); - memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4); + write_register (tdep->ppc_gp0_regnum + greg, struct_addr); greg++; } + /* Now fill in the registers and stack... */ for (argno = 0; argno < nargs; argno++) { - arg = args[argno]; + struct value *arg = args[argno]; + char *val = VALUE_CONTENTS (arg); type = check_typedef (VALUE_TYPE (arg)); len = TYPE_LENGTH (type); - if (TYPE_CODE (type) == TYPE_CODE_FLT) + if (TYPE_CODE (type) == TYPE_CODE_FLT + && ppc_floating_point_unit_p (current_gdbarch)) { if (freg <= 8) { + ULONGEST regval; if (len > 8) printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + freg)], - VALUE_CONTENTS (arg), len); + regval = extract_unsigned_integer (val, len); + write_register (FP0_REGNUM + freg, regval); freg++; } else @@ -203,29 +224,32 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* FIXME: Convert floats to doubles */ if (argoffset & 0x4) argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); + write_memory (sp + argoffset, val, len); argoffset += 8; } } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ + else if (len == 8 + && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */ + || (!ppc_floating_point_unit_p (current_gdbarch) + && TYPE_CODE (type) == TYPE_CODE_FLT))) /* double */ { if (greg > 9) { greg = 11; if (argoffset & 0x4) argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); + write_memory (sp + argoffset, val, len); argoffset += 8; } else { + ULONGEST regval; if ((greg & 1) == 0) greg++; - - memcpy (&deprecated_registers[REGISTER_BYTE (greg)], - VALUE_CONTENTS (arg), 4); - memcpy (&deprecated_registers[REGISTER_BYTE (greg + 1)], - VALUE_CONTENTS (arg) + 4, 4); + regval = extract_unsigned_integer (val, 4); + write_register (tdep->ppc_gp0_regnum + greg, regval); + regval = extract_unsigned_integer (val + 4, 4); + write_register (tdep->ppc_gp0_regnum + greg + 1, regval); greg += 2; } } @@ -236,18 +260,19 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, || TYPE_CODE (type) == TYPE_CODE_STRUCT || TYPE_CODE (type) == TYPE_CODE_UNION) { - write_memory (sp + structoffset, VALUE_CONTENTS (arg), len); + write_memory (sp + structoffset, val, len); store_address (val_buf, 4, sp + structoffset); structoffset += round2 (len, 8); } else { memset (val_buf, 0, 4); - memcpy (val_buf, VALUE_CONTENTS (arg), len); + memcpy (val_buf, val, len); } if (greg <= 10) { - memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4); + ULONGEST regval = extract_unsigned_integer (val_buf, 4); + write_register (tdep->ppc_gp0_regnum + greg, regval); greg++; } else @@ -262,15 +287,14 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, && TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); char *v_val_buf = alloca (16); memset (v_val_buf, 0, 16); - memcpy (v_val_buf, VALUE_CONTENTS (arg), len); + memcpy (v_val_buf, val, len); if (vreg <= 13) { - memcpy (&deprecated_registers[REGISTER_BYTE (tdep->ppc_vr0_regnum - + vreg)], - v_val_buf, 16); + regcache_cooked_write (current_regcache, + tdep->ppc_vr0_regnum + vreg, + v_val_buf); vreg++; } else @@ -279,6 +303,26 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, argoffset += 16; } } + else if (len == 8 + && TYPE_CODE (type) == TYPE_CODE_ARRAY + && TYPE_VECTOR (type)) + { + char *v_val_buf = alloca (8); + memset (v_val_buf, 0, 8); + memcpy (v_val_buf, val, len); + if (greg <= 10) + { + regcache_cooked_write (current_regcache, + tdep->ppc_ev0_regnum + greg, + v_val_buf); + greg++; + } + else + { + write_memory (sp + argoffset, v_val_buf, 8); + argoffset += 8; + } + } } } @@ -293,7 +337,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type) { - if (TYPE_LENGTH (value_type) == 16 + if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) && TYPE_VECTOR (value_type)) return 0; @@ -305,7 +349,7 @@ ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type) int ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type) { - if (TYPE_LENGTH (value_type) == 16 + if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8) && TYPE_VECTOR (value_type)) return 0; diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index cf81eb9..066cd99 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -22,6 +22,7 @@ #ifndef PPC_TDEP_H #define PPC_TDEP_H +struct gdbarch; struct frame_info; struct value; @@ -49,6 +50,11 @@ void rs6000_frame_init_saved_regs (struct frame_info *); CORE_ADDR rs6000_frame_chain (struct frame_info *); int altivec_register_p (int regno); + +/* Return non-zero when the architecture has an FPU (or at least when + the ABI is using the FPU). */ +int ppc_floating_point_unit_p (struct gdbarch *gdbarch); + /* Private data that this module attaches to struct gdbarch. */ struct gdbarch_tdep diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 167abba..8eea0db 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -345,7 +345,7 @@ print_formatted (struct value *val, register int format, int size, with a format. */ void -print_scalar_formatted (char *valaddr, struct type *type, int format, int size, +print_scalar_formatted (void *valaddr, struct type *type, int format, int size, struct ui_file *stream) { LONGEST val_long; @@ -1955,28 +1955,13 @@ print_frame_nameless_args (struct frame_info *fi, long start, int num, for (i = 0; i < num; i++) { QUIT; -#ifdef NAMELESS_ARG_VALUE - NAMELESS_ARG_VALUE (fi, start, &arg_value); -#else - argsaddr = FRAME_ARGS_ADDRESS (fi); + argsaddr = get_frame_args_address (fi); if (!argsaddr) return; - arg_value = read_memory_integer (argsaddr + start, sizeof (int)); -#endif - if (!first) fprintf_filtered (stream, ", "); - -#ifdef PRINT_NAMELESS_INTEGER - PRINT_NAMELESS_INTEGER (stream, arg_value); -#else -#ifdef PRINT_TYPELESS_INTEGER - PRINT_TYPELESS_INTEGER (stream, builtin_type_int, (LONGEST) arg_value); -#else fprintf_filtered (stream, "%ld", arg_value); -#endif /* PRINT_TYPELESS_INTEGER */ -#endif /* PRINT_NAMELESS_INTEGER */ first = 0; start += sizeof (int); } diff --git a/gdb/regcache.c b/gdb/regcache.c index 3f2be7b..70af06f 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -389,59 +389,79 @@ register_buffer (struct regcache *regcache, int regnum) } void -regcache_save (struct regcache *dst, struct regcache *src) +regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read, + void *src) { struct gdbarch *gdbarch = dst->descr->gdbarch; + void *buf = alloca (max_register_size (gdbarch)); int regnum; - /* The SRC and DST register caches had better belong to the same - architecture. */ - gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); /* The DST should be `read-only', if it wasn't then the save would - end up trying to write the register values out through to the + end up trying to write the register values back out to the target. */ - gdb_assert (!src->readonly_p); gdb_assert (dst->readonly_p); /* Clear the dest. */ memset (dst->registers, 0, dst->descr->sizeof_cooked_registers); memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p); /* Copy over any registers (identified by their membership in the - save_reggroup) and mark them as valid. The full [0 - .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some - architectures need to save/restore `cooked' registers that live - in memory. */ + save_reggroup) and mark them as valid. The full [0 .. NUM_REGS + + NUM_PSEUDO_REGS) range is checked since some architectures need + to save/restore `cooked' registers that live in memory. */ for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++) { if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) { - regcache_cooked_read (src, regnum, register_buffer (dst, regnum)); - dst->register_valid_p[regnum] = 1; + int valid = cooked_read (src, regnum, buf); + if (valid) + { + memcpy (register_buffer (dst, regnum), buf, + register_size (gdbarch, regnum)); + dst->register_valid_p[regnum] = 1; + } } } } void -regcache_restore (struct regcache *dst, struct regcache *src) +regcache_restore (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src) { struct gdbarch *gdbarch = dst->descr->gdbarch; + void *buf = alloca (max_register_size (gdbarch)); int regnum; - gdb_assert (src->descr->gdbarch == dst->descr->gdbarch); + /* The dst had better not be read-only. If it is, the `restore' + doesn't make much sense. */ gdb_assert (!dst->readonly_p); - gdb_assert (src->readonly_p); /* Copy over any registers, being careful to only restore those that - were both saved and need to be restored. The full [0 - .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some - architectures need to save/restore `cooked' registers that live - in memory. */ - for (regnum = 0; regnum < src->descr->nr_cooked_registers; regnum++) + were both saved and need to be restored. The full [0 .. NUM_REGS + + NUM_PSEUDO_REGS) range is checked since some architectures need + to save/restore `cooked' registers that live in memory. */ + for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++) { - if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup) - && src->register_valid_p[regnum]) + if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup)) { - regcache_cooked_write (dst, regnum, register_buffer (src, regnum)); + int valid = cooked_read (src, regnum, buf); + if (valid) + regcache_cooked_write (dst, regnum, buf); } } } +static int +do_cooked_read (void *src, int regnum, void *buf) +{ + struct regcache *regcache = src; + if (!regcache_valid_p (regcache, regnum) + && regcache->readonly_p) + /* Don't even think about fetching a register from a read-only + cache when the register isn't yet valid. There isn't a target + from which the register value can be fetched. */ + return 0; + regcache_cooked_read (regcache, regnum, buf); + return 1; +} + + void regcache_cpy (struct regcache *dst, struct regcache *src) { @@ -452,9 +472,9 @@ regcache_cpy (struct regcache *dst, struct regcache *src) gdb_assert (src != dst); gdb_assert (src->readonly_p || dst->readonly_p); if (!src->readonly_p) - regcache_save (dst, src); + regcache_save (dst, do_cooked_read, src); else if (!dst->readonly_p) - regcache_restore (dst, src); + regcache_restore (dst, do_cooked_read, src); else regcache_cpy_no_passthrough (dst, src); } @@ -864,7 +884,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_signed_integer (buf, @@ -877,13 +897,37 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_unsigned_integer (buf, regcache->descr->sizeof_register[regnum]); } +void +regcache_cooked_write_signed (struct regcache *regcache, int regnum, + LONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + +void +regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, + ULONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + /* Write register REGNUM at MYADDR to the target. MYADDR points at REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */ @@ -1284,16 +1328,16 @@ regcache_collect (int regnum, void *buf) } -/* read_pc, write_pc, read_sp, write_sp, read_fp, etc. Special - handling for registers PC, SP, and FP. */ +/* read_pc, write_pc, read_sp, read_fp, etc. Special handling for + registers PC, SP, and FP. */ /* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(), read_pc_pid(), read_pc(), generic_target_write_pc(), write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(), - generic_target_write_sp(), write_sp(), generic_target_read_fp() and - read_fp(), will eventually be moved out of the reg-cache into - either frame.[hc] or to the multi-arch framework. The are not part - of the raw register cache. */ + generic_target_write_sp(), generic_target_read_fp() and read_fp(), + will eventually be moved out of the reg-cache into either + frame.[hc] or to the multi-arch framework. The are not part of the + raw register cache. */ /* This routine is getting awfully cluttered with #if's. It's probably time to turn this into READ_PC and define it in the tm.h file. @@ -1412,12 +1456,6 @@ generic_target_write_sp (CORE_ADDR val) "generic_target_write_sp"); } -void -write_sp (CORE_ADDR val) -{ - TARGET_WRITE_SP (val); -} - CORE_ADDR generic_target_read_fp (void) { diff --git a/gdb/regcache.h b/gdb/regcache.h index ee10505..3fb43c4 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -75,6 +75,10 @@ extern void regcache_cooked_read_signed (struct regcache *regcache, int regnum, LONGEST *val); extern void regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, ULONGEST *val); +extern void regcache_cooked_write_signed (struct regcache *regcache, + int regnum, LONGEST val); +extern void regcache_cooked_write_unsigned (struct regcache *regcache, + int regnum, ULONGEST val); /* Partial transfer of a cooked register. These perform read, modify, write style operations. */ @@ -94,7 +98,7 @@ extern void regcache_collect (int regnum, void *buf); /* The register's ``offset''. - FIXME: cagney/2002-11-07: The get_saved_register() function, when + FIXME: cagney/2002-11-07: The frame_register() function, when specifying the real location of a register, does so using that registers offset in the register cache. That offset is then used by valops.c to determine the location of the register. The code @@ -155,15 +159,19 @@ extern int max_register_size (struct gdbarch *gdbarch); extern int register_size (struct gdbarch *gdbarch, int regnum); -/* Save/restore a register cache. The registers saved/restored is - determined by the save_reggroup and restore_reggroup (although you - can't restore a register that wasn't saved as well :-). You can - only save to a read-only cache (default from regcache_xmalloc()) - from a live cache and you can only restore from a read-only cache - to a live cache. */ +/* Save/restore a register cache. The set of registers saved / + restored into the DST regcache determined by the save_reggroup / + restore_reggroup respectively. COOKED_READ returns zero iff the + register's value can't be returned. */ -extern void regcache_save (struct regcache *dst, struct regcache *src); -extern void regcache_restore (struct regcache *dst, struct regcache *src); +typedef int (regcache_cooked_read_ftype) (void *src, int regnum, void *buf); + +extern void regcache_save (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src); +extern void regcache_restore (struct regcache *dst, + regcache_cooked_read_ftype *cooked_read, + void *src); /* Copy/duplicate the contents of a register cache. By default, the operation is pass-through. Writes to DST and reads from SRC will diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 8c3cbb7..b72140e 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -149,7 +149,9 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, return 1; vector_p = TYPE_VECTOR (register_type (gdbarch, regnum)); float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT; - raw_p = regnum < gdbarch_num_regs (gdbarch); + /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs + (gdbarch), as not all architectures are multi-arch. */ + raw_p = regnum < NUM_REGS; if (group == float_reggroup) return float_p; if (group == vector_reggroup) diff --git a/gdb/remote-utils.h b/gdb/remote-utils.h index 3ca3bb4..cae5d5e 100644 --- a/gdb/remote-utils.h +++ b/gdb/remote-utils.h @@ -22,6 +22,8 @@ #ifndef REMOTE_UTILS_H #define REMOTE_UTILS_H +struct target_ops; + #include "target.h" struct serial; diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 19153cf..d9650e3 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -67,7 +67,7 @@ extern void vx_read_register (); extern void vx_write_register (); extern void symbol_file_command (); -extern int stop_soon_quietly; /* for wait_for_inferior */ +extern enum stop_kind stop_soon; /* for wait_for_inferior */ static int net_step (); static int net_ptrace_clnt_call (); /* Forward decl */ @@ -243,9 +243,9 @@ vx_create_inferior (char *exec_file, char *args, char **env) /* Install inferior's terminal modes. */ target_terminal_inferior (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; wait_for_inferior (); /* Get the task spawn event */ - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; /* insert_step_breakpoint (); FIXME, do we need this? */ proceed (-1, TARGET_SIGNAL_DEFAULT, 0); diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c index eb59b9f..a97c18e 100644 --- a/gdb/remote-vxsparc.c +++ b/gdb/remote-vxsparc.c @@ -97,10 +97,9 @@ vx_read_register (int regno) bcopy (&sparc_greg_packet[SPARC_R_Y], &deprecated_registers[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE); - /* Now write the local and in registers to the register window - spill area in the frame. VxWorks does not do this for the - active frame automatically; it greatly simplifies debugging - (FRAME_FIND_SAVED_REGS, in particular, depends on this). */ + /* Now write the local and in registers to the register window spill + area in the frame. VxWorks does not do this for the active frame + automatically; it greatly simplifies debugging. */ sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)], REGISTER_RAW_SIZE (SP_REGNUM)); diff --git a/gdb/remote.h b/gdb/remote.h index e2171b2..4477148 100644 --- a/gdb/remote.h +++ b/gdb/remote.h @@ -54,4 +54,7 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off, extern void async_remote_interrupt_twice (void *arg); +extern void (*target_resume_hook) (void); +extern void (*target_wait_loop_hook) (void); + #endif diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ac33578..b70917e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -137,6 +137,18 @@ altivec_register_p (int regno) return (regno >= tdep->ppc_vr0_regnum && regno <= tdep->ppc_vrsave_regnum); } +/* Use the architectures FP registers? */ +int +ppc_floating_point_unit_p (struct gdbarch *gdbarch) +{ + const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch); + if (info->arch == bfd_arch_powerpc) + return (info->mach != bfd_mach_ppc_e500); + if (info->arch == bfd_arch_rs6000) + return 1; + return 0; +} + /* Read a LEN-byte address from debugged memory address MEMADDR. */ static CORE_ADDR @@ -978,7 +990,7 @@ rs6000_pop_frame (void) still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ - addr = get_pc_function_start (get_frame_pc (frame)); + addr = get_frame_func (frame); (void) skip_prologue (addr, get_frame_pc (frame), &fdata); wordsize = gdbarch_tdep (current_gdbarch)->wordsize; @@ -1487,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi) && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) return 0; - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1528,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi) return deprecated_read_register_dummy (get_frame_pc (fi), get_frame_base (fi), PC_REGNUM); - func_start = get_pc_function_start (get_frame_pc (fi)); + func_start = get_frame_func (fi); /* If we failed to find the start of the function, it is a mistake to inspect the instructions. */ @@ -1554,14 +1566,16 @@ rs6000_frame_saved_pc (struct frame_info *fi) return lr; } else - return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset, + return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi) + + tdep->lr_frame_offset, wordsize); } if (fdata.lr_offset == 0) return read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum); - return read_memory_addr (FRAME_CHAIN (fi) + fdata.lr_offset, wordsize); + return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi) + fdata.lr_offset, + wordsize); } /* If saved registers of frame FI are not known yet, read and cache them. @@ -1582,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) if (fdatap == NULL) { fdatap = &work_fdata; - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), fdatap); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap); } frame_saved_regs_zalloc (fi); @@ -1608,7 +1621,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) ->frame pointed to the outer-most address of the frame. In the mean time, the address of the prev frame is used as the base address of this frame. */ - frame_addr = FRAME_CHAIN (fi); + frame_addr = DEPRECATED_FRAME_CHAIN (fi); /* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr. All fpr's from saved_fpr to fp31 are saved. */ @@ -1633,7 +1646,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap) CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset; for (i = fdatap->saved_gpr; i < 32; i++) { - get_frame_saved_regs (fi)[i] = gpr_addr; + get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = gpr_addr; gpr_addr += wordsize; } } @@ -1706,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi) /* Find out if this function is using an alloca register. */ - (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)), - get_frame_pc (fi), &fdata); + (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata); /* If saved registers of this frame are not known yet, read and cache them. */ @@ -1746,8 +1758,8 @@ frame_initial_stack_address (struct frame_info *fi) /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. */ +/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces + the frame's chain-pointer. */ /* In the case of the RS/6000, the frame's nominal address is the address of a 4-byte word containing the calling frame's address. */ @@ -1880,8 +1892,8 @@ rs6000_register_convert_to_virtual (int n, struct type *type, { if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n)) { - double val = extract_floating (from, REGISTER_RAW_SIZE (n)); - store_floating (to, TYPE_LENGTH (type), val); + double val = deprecated_extract_floating (from, REGISTER_RAW_SIZE (n)); + deprecated_store_floating (to, TYPE_LENGTH (type), val); } else memcpy (to, from, REGISTER_RAW_SIZE (n)); @@ -1896,8 +1908,8 @@ rs6000_register_convert_to_raw (struct type *type, int n, { if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n)) { - double val = extract_floating (from, TYPE_LENGTH (type)); - store_floating (to, REGISTER_RAW_SIZE (n), val); + double val = deprecated_extract_floating (from, TYPE_LENGTH (type)); + deprecated_store_floating (to, REGISTER_RAW_SIZE (n), val); } else memcpy (to, from, REGISTER_RAW_SIZE (n)); @@ -2062,10 +2074,10 @@ rs6000_extract_struct_value_address (struct regcache *regcache) /* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior function call GDB knows the address of the struct return value and hence, should not need to call this function. Unfortunately, - the current hand_function_call() code only saves the most recent - struct address leading to occasional calls. The code should - instead maintain a stack of such addresses (in the dummy frame - object). */ + the current call_function_by_hand() code only saves the most + recent struct address leading to occasional calls. The code + should instead maintain a stack of such addresses (in the dummy + frame object). */ /* NOTE: cagney/2002-09-26: Return 0 which indicates that we've really got no idea where the return value is being stored. While r3, on function entry, contained the address it will have since @@ -2727,9 +2739,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else { arch = bfd_arch_powerpc; - mach = 0; - bfd_default_set_arch_mach (&abfd, arch, mach); + bfd_default_set_arch_mach (&abfd, arch, 0); info.bfd_arch_info = bfd_get_arch_info (&abfd); + mach = info.bfd_arch_info->mach; } tdep = xmalloc (sizeof (struct gdbarch_tdep)); tdep->wordsize = wordsize; @@ -2862,7 +2874,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_num_regs (gdbarch, v->nregs); set_gdbarch_num_pseudo_regs (gdbarch, v->npregs); @@ -2886,17 +2898,10 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_char_signed (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy); set_gdbarch_frame_align (gdbarch, rs6000_frame_align); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_push_return_address (gdbarch, ppc_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address); set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible); @@ -2911,13 +2916,13 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 64-bit code. At some point in the future, this matter needs to be revisited. */ if (sysv_abi && wordsize == 4) - set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, ppc_sysv_abi_push_arguments); else - set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, rs6000_push_arguments); - set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return); set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); - set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame); set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); @@ -2937,8 +2942,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, rs6000_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, rs6000_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info); @@ -2952,7 +2957,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } set_gdbarch_frame_args_address (gdbarch, rs6000_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, rs6000_frame_args_address); - set_gdbarch_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call); /* We can't tell how many args there are now that the C compiler delays popping them. */ diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c index b7f5918..63e779b 100644 --- a/gdb/s390-nat.c +++ b/gdb/s390-nat.c @@ -25,6 +25,7 @@ #include <asm/ptrace.h> #include <sys/ptrace.h> #include <asm/processor.h> +#include <asm/types.h> #include <sys/procfs.h> #include <sys/user.h> #include <value.h> diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 9ad34c8..e50a46d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi) if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised) function_start = get_frame_extra_info (fi)->function_start; else if (get_frame_pc (fi)) - function_start = get_pc_function_start (get_frame_pc (fi)); + function_start = get_frame_func (fi); return function_start; } @@ -1221,7 +1221,7 @@ s390_pop_frame_regular (struct frame_info *frame) { int regnum; - write_register (S390_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (S390_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); /* Restore any saved registers. */ if (get_frame_saved_regs (frame)) @@ -1808,19 +1808,19 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address); - set_gdbarch_frame_chain (gdbarch, s390_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs); set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address); /* We can't do this */ set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - set_gdbarch_store_struct_return (gdbarch, s390_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value); /* Amount PC must be decremented by after a breakpoint. This is often the number of bytes in BREAKPOINT but not always. */ set_gdbarch_decr_pc_after_break (gdbarch, 2); - set_gdbarch_pop_frame (gdbarch, s390_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, s390_pop_frame); /* Stack grows downward. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Offset from address of function to start of its code. @@ -1839,11 +1839,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, s390_frameless_function_invocation); /* Return saved PC from a frame */ - set_gdbarch_frame_saved_pc (gdbarch, s390_frame_saved_pc); - /* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. */ - set_gdbarch_frame_chain (gdbarch, s390_frame_chain); - set_gdbarch_saved_pc_after_call (gdbarch, s390_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, s390_frame_saved_pc); + /* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and + produces the frame's chain-pointer. */ + set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, s390_saved_pc_after_call); set_gdbarch_register_byte (gdbarch, s390_register_byte); set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM); @@ -1861,18 +1861,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) (gdbarch, generic_cannot_extract_struct_value_address); /* Parameters for inferior function calls. */ - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_push_arguments (gdbarch, s390_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments); set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_push_return_address (gdbarch, s390_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, + s390_push_return_address); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (s390_call_dummy_words)); set_gdbarch_call_dummy_words (gdbarch, s390_call_dummy_words); @@ -1908,6 +1901,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 4bbcd8e..99a1fd5 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -250,6 +250,8 @@ const struct language_defn scm_language_defn = c_print_type, /* Print a type using appropriate syntax */ scm_val_print, /* Print a value using appropriate syntax */ scm_value_print, /* Print a top-level value */ + NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"#o%lo", "#o", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c index fe11d8a..dab1647 100644 --- a/gdb/sentinel-frame.c +++ b/gdb/sentinel-frame.c @@ -45,13 +45,13 @@ sentinel_frame_cache (struct regcache *regcache) /* Here the register value is taken direct from the register cache. */ void -sentinel_frame_register_unwind (struct frame_info *frame, - void **unwind_cache, - int regnum, int *optimized, - enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnum, void *bufferp) +sentinel_frame_prev_register (struct frame_info *next_frame, + void **this_prologue_cache, + int regnum, int *optimized, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnum, void *bufferp) { - struct frame_unwind_cache *cache = *unwind_cache; + struct frame_unwind_cache *cache = *this_prologue_cache; /* Describe the register's location. A reg-frame maps all registers onto the corresponding hardware register. */ *optimized = 0; @@ -70,44 +70,23 @@ sentinel_frame_register_unwind (struct frame_info *frame, } } -CORE_ADDR -sentinel_frame_pc_unwind (struct frame_info *frame, - void **cache) -{ - /* FIXME: cagney/2003-01-08: This should be using a per-architecture - method that doesn't suffer from DECR_PC_AFTER_BREAK problems. - Such a method would take unwind_cache, regcache and stop reason - parameters. */ - return read_pc (); -} - void -sentinel_frame_id_unwind (struct frame_info *frame, - void **cache, - struct frame_id *id) -{ - /* FIXME: cagney/2003-01-08: This should be using a per-architecture - method that doesn't suffer from DECR_PC_AFTER_BREAK problems. - Such a method would take unwind_cache, regcache and stop reason - parameters. */ - id->base = read_fp (); - id->pc = read_pc (); -} - -static void -sentinel_frame_pop (struct frame_info *frame, - void **cache, - struct regcache *regcache) +sentinel_frame_this_id (struct frame_info *next_frame, + void **this_prologue_cache, + struct frame_id *this_id) { - internal_error (__FILE__, __LINE__, "Function sentinal_frame_pop called"); + /* The sentinel frame is used as a starting point for creating the + previous (inner most) frame. That frame's THIS_ID method will be + called to determine the inner most frame's ID. Not this one. */ + internal_error (__FILE__, __LINE__, "sentinel_frame_this_id called"); } const struct frame_unwind sentinel_frame_unwinder = { - sentinel_frame_pop, - sentinel_frame_pc_unwind, - sentinel_frame_id_unwind, - sentinel_frame_register_unwind + /* Should the sentinel frame be given a special type? */ + NORMAL_FRAME, + sentinel_frame_this_id, + sentinel_frame_prev_register }; const struct frame_unwind *const sentinel_frame_unwind = &sentinel_frame_unwinder; diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h index f7be059..3bdf0bc 100644 --- a/gdb/ser-unix.h +++ b/gdb/ser-unix.h @@ -22,6 +22,9 @@ #ifndef SER_UNIX_H #define SER_UNIX_H +struct serial; +struct ui_file; + /* Generic UNIX/FD functions */ extern int ser_unix_nop_flush_output (struct serial *scb); diff --git a/gdb/serial.h b/gdb/serial.h index 97d68f3..7495b70 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -22,6 +22,8 @@ #ifndef SERIAL_H #define SERIAL_H +struct ui_file; + /* For most routines, if a failure is indicated, then errno should be examined. */ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 91f3f62..0390e95 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) that does not appear to be part of the prologue. But give up after 20 of them, since we're getting silly then. */ - pc = get_pc_function_start (get_frame_pc (fi)); + pc = get_frame_func (fi); if (!pc) { deprecated_update_frame_pc_hack (fi, 0); @@ -1758,7 +1758,7 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) @@ -1790,7 +1790,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info)); if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), get_frame_base (fi))) @@ -2414,7 +2414,7 @@ sh3e_sh4_extract_return_value (struct type *type, char *regbuf, char *valbuf) floatformat_to_doublest (&floatformat_ieee_double_big, (char *) regbuf + REGISTER_BYTE (return_register), &val); - store_floating (valbuf, len, val); + deprecated_store_floating (valbuf, len, val); } else if (len <= 4) { @@ -2467,7 +2467,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf) else floatformat_to_doublest (&floatformat_ieee_double_big, (char *) regbuf + offset, &val); - store_floating (valbuf, len, val); + deprecated_store_floating (valbuf, len, val); } } else @@ -3403,7 +3403,7 @@ sh_sh4_register_convert_to_virtual (int regnum, struct type *type, { DOUBLEST val; floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val); - store_floating (to, TYPE_LENGTH (type), val); + deprecated_store_floating (to, TYPE_LENGTH (type), val); } else error ("sh_register_convert_to_virtual called with non DR register number"); @@ -3429,7 +3429,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type, { DOUBLEST val; floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val); - store_floating(to, TYPE_LENGTH(type), val); + deprecated_store_floating(to, TYPE_LENGTH(type), val); } else error("sh_register_convert_to_virtual called with non DR register number"); @@ -3444,7 +3444,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum, if (regnum >= tdep->DR0_REGNUM && regnum <= tdep->DR_LAST_REGNUM) { - DOUBLEST val = extract_floating (from, TYPE_LENGTH(type)); + DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type)); floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); } else @@ -3469,7 +3469,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum, || (regnum >= tdep->DR0_C_REGNUM && regnum <= tdep->DR_LAST_C_REGNUM)) { - DOUBLEST val = extract_floating (from, TYPE_LENGTH(type)); + DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type)); floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to); } else @@ -4371,15 +4371,15 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4); set_gdbarch_deprecated_do_registers_info (gdbarch, sh_do_registers_info); set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc); - set_gdbarch_frame_chain (gdbarch, sh_frame_chain); - set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register); + set_gdbarch_deprecated_frame_chain (gdbarch, sh_frame_chain); + set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info); set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value); - set_gdbarch_push_arguments (gdbarch, sh_push_arguments); - set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, sh_push_arguments); + set_gdbarch_deprecated_store_struct_return (gdbarch, sh_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); - set_gdbarch_pop_frame (gdbarch, sh_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, sh_pop_frame); set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh); set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno); skip_prologue_hard_way = sh_skip_prologue_hard_way; @@ -4614,14 +4614,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs); set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info); - set_gdbarch_frame_chain (gdbarch, sh64_frame_chain); - set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register); + set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain); + set_gdbarch_deprecated_get_saved_register (gdbarch, sh64_get_saved_register); set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value); - set_gdbarch_push_arguments (gdbarch, sh64_push_arguments); - /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/ + set_gdbarch_deprecated_push_arguments (gdbarch, sh64_push_arguments); + /*set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);*/ set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); - set_gdbarch_pop_frame (gdbarch, sh64_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame); set_gdbarch_elf_make_msymbol_special (gdbarch, sh64_elf_make_msymbol_special); break; @@ -4641,7 +4641,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, generic_target_write_pc); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_register_name (gdbarch, sh_register_name); set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type); @@ -4653,18 +4653,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/ - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words)); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_push_return_address (gdbarch, sh_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, sh_push_return_address); set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value); set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue); @@ -4674,8 +4666,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc); - set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sh_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_believe_pcc_promotion (gdbarch, 1); diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index 82c63d8..ca46a9e 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -30,6 +30,20 @@ #include <signal.h> +/* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest + _available_ realtime signal, not the lowest supported; glibc takes + several for its own use. */ + +#ifndef REALTIME_LO +# if defined(__SIGRTMIN) +# define REALTIME_LO __SIGRTMIN +# define REALTIME_HI __SIGRTMAX +# elif defined(SIGRTMIN) +# define REALTIME_LO SIGRTMIN +# define REALTIME_HI SIGRTMAX +# endif +#endif + /* This table must match in order and size the signals in enum target_signal in target.h. */ /* *INDENT-OFF* */ @@ -492,22 +506,6 @@ target_signal_from_host (int hostsig) } #endif -#if defined (SIGRTMIN) - if (hostsig >= SIGRTMIN && hostsig <= SIGRTMAX) - { - /* This block of TARGET_SIGNAL_REALTIME value is in order. */ - if (33 <= hostsig && hostsig <= 63) - return (enum target_signal) - (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33); - else if (hostsig == 32) - return TARGET_SIGNAL_REALTIME_32; - else if (64 <= hostsig && hostsig <= 127) - return (enum target_signal) - (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64); - else - error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal"); - } -#endif return TARGET_SIGNAL_UNKNOWN; } @@ -520,6 +518,8 @@ static int do_target_signal_to_host (enum target_signal oursig, int *oursig_ok) { + int retsig; + *oursig_ok = 1; switch (oursig) { @@ -744,66 +744,33 @@ do_target_signal_to_host (enum target_signal oursig, default: #if defined (REALTIME_LO) - if (oursig >= TARGET_SIGNAL_REALTIME_33 - && oursig <= TARGET_SIGNAL_REALTIME_63) - { - /* This block of signals is continuous, and - TARGET_SIGNAL_REALTIME_33 is 33 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33; - if (retsig >= REALTIME_LO && retsig < REALTIME_HI) - return retsig; - } -#if (REALTIME_LO < 33) - else if (oursig == TARGET_SIGNAL_REALTIME_32) - { - /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with - TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */ - return 32; - } -#endif -#if (REALTIME_HI > 64) - if (oursig >= TARGET_SIGNAL_REALTIME_64 - && oursig <= TARGET_SIGNAL_REALTIME_127) - { - /* This block of signals is continuous, and - TARGET_SIGNAL_REALTIME_64 is 64 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64; - if (retsig >= REALTIME_LO && retsig < REALTIME_HI) - return retsig; - } - -#endif -#endif + retsig = 0; -#if defined (SIGRTMIN) if (oursig >= TARGET_SIGNAL_REALTIME_33 && oursig <= TARGET_SIGNAL_REALTIME_63) { /* This block of signals is continuous, and TARGET_SIGNAL_REALTIME_33 is 33 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33; - if (retsig >= SIGRTMIN && retsig <= SIGRTMAX) - return retsig; + retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33; } else if (oursig == TARGET_SIGNAL_REALTIME_32) { /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */ - return 32; + retsig = 32; } else if (oursig >= TARGET_SIGNAL_REALTIME_64 && oursig <= TARGET_SIGNAL_REALTIME_127) { /* This block of signals is continuous, and TARGET_SIGNAL_REALTIME_64 is 64 by definition. */ - int retsig = - (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64; - return retsig; + retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64; } + + if (retsig >= REALTIME_LO && retsig < REALTIME_HI) + return retsig; #endif + *oursig_ok = 0; return 0; } diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index 1cfa452..26a776f 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -436,7 +436,7 @@ irix_solib_create_inferior_hook (void) out what we need to know about them. */ clear_proceed_status (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; stop_signal = TARGET_SIGNAL_0; do { @@ -459,10 +459,10 @@ irix_solib_create_inferior_hook (void) But we are stopped in the startup code and we might not have symbols for the startup code, so heuristic_proc_start could be called and will put out an annoying warning. - Delaying the resetting of stop_soon_quietly until after symbol loading + Delaying the resetting of stop_soon until after symbol loading suppresses the warning. */ solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; re_enable_breakpoints_in_shlibs (); } diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c index 6f43a8f..b5dca60 100644 --- a/gdb/solib-osf.c +++ b/gdb/solib-osf.c @@ -321,7 +321,7 @@ osf_solib_create_inferior_hook (void) out what we need to know about them. */ clear_proceed_status (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; stop_signal = TARGET_SIGNAL_0; do { @@ -334,10 +334,10 @@ osf_solib_create_inferior_hook (void) But we are stopped in the runtime loader and we do not have symbols for the runtime loader. So heuristic_proc_start will be called and will put out an annoying warning. - Delaying the resetting of stop_soon_quietly until after symbol loading + Delaying the resetting of stop_soon until after symbol loading suppresses the warning. */ solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; /* Enable breakpoints disabled (unnecessarily) by clear_solib(). */ re_enable_breakpoints_in_shlibs (); diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index 25682e0..4072fab 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -829,7 +829,7 @@ sunos_solib_create_inferior_hook (void) out what we need to know about them. */ clear_proceed_status (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; stop_signal = TARGET_SIGNAL_0; do { @@ -837,7 +837,7 @@ sunos_solib_create_inferior_hook (void) wait_for_inferior (); } while (stop_signal != TARGET_SIGNAL_TRAP); - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; /* We are now either at the "mapping complete" breakpoint (or somewhere else, a condition we aren't prepared to deal with anyway), so adjust diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 7831108..6c4c10a 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -43,6 +43,7 @@ static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static struct link_map_offsets *legacy_fetch_link_map_offsets (void); +static int svr4_have_link_map_offsets (void); /* fetch_link_map_offsets_gdbarch_data is a handle used to obtain the architecture specific link map offsets fetching function. */ @@ -542,9 +543,10 @@ locate_base (void) /* Check to see if we have a currently valid address, and if so, avoid doing all this work again and just return the cached address. If we have no cached address, try to locate it in the dynamic info - section for ELF executables. */ + section for ELF executables. There's no point in doing any of this + though if we don't have some link map offsets to work with. */ - if (debug_base == 0) + if (debug_base == 0 && svr4_have_link_map_offsets ()) { if (exec_bfd != NULL && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour) @@ -1273,6 +1275,13 @@ svr4_solib_create_inferior_hook (void) /* Relocate the main executable if necessary. */ svr4_relocate_main_executable (); + if (!svr4_have_link_map_offsets ()) + { + warning ("no shared library support for this OS / ABI"); + return; + + } + if (!enable_break ()) { warning ("shared library handler failed to enable breakpoint"); @@ -1290,7 +1299,7 @@ svr4_solib_create_inferior_hook (void) out what we need to know about them. */ clear_proceed_status (); - stop_soon_quietly = 1; + stop_soon = STOP_QUIETLY; stop_signal = TARGET_SIGNAL_0; do { @@ -1298,7 +1307,7 @@ svr4_solib_create_inferior_hook (void) wait_for_inferior (); } while (stop_signal != TARGET_SIGNAL_TRAP); - stop_soon_quietly = 0; + stop_soon = NO_STOP_QUIETLY; #endif /* defined(_SCO_DS) */ } @@ -1392,6 +1401,20 @@ svr4_fetch_link_map_offsets (void) return (flmo ()); } +/* Return 1 if a link map offset fetcher has been defined, 0 otherwise. */ +static int +svr4_have_link_map_offsets (void) +{ + struct link_map_offsets *(*flmo)(void) = + gdbarch_data (current_gdbarch, fetch_link_map_offsets_gdbarch_data); + if (flmo == NULL + || (flmo == legacy_fetch_link_map_offsets + && legacy_svr4_fetch_link_map_offsets_hook == NULL)) + return 0; + else + return 1; +} + /* set_solib_svr4_fetch_link_map_offsets() is intended to be called by a <arch>_gdbarch_init() function. It is used to establish an architecture specific link_map_offsets fetcher for the architecture diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index e41c240..d9d3217 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct objfile; + /* Critical offsets and sizes which describe struct r_debug and struct link_map on SVR4-like targets. All offsets and sizes are in bytes unless otherwise specified. */ diff --git a/gdb/somread.c b/gdb/somread.c index 85d4f0a..654ae06 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -37,6 +37,8 @@ /* Various things we might complain about... */ +static int init_import_symbols (struct objfile *objfile); + static void som_symfile_init (struct objfile *); static void som_new_init (struct objfile *); @@ -466,7 +468,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) not defined there. (Variables that are imported are dealt with as "loc_indirect" vars.) Return value = number of import symbols read in. */ -int +static int init_import_symbols (struct objfile *objfile) { unsigned int import_list; diff --git a/gdb/somsolib.c b/gdb/somsolib.c index 08d3e1c..c496752 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -41,6 +41,7 @@ #include "gdbcmd.h" #include "language.h" #include "regcache.h" +#include "gdb_assert.h" #include <fcntl.h> diff --git a/gdb/somsolib.h b/gdb/somsolib.h index 0840067..c241411 100644 --- a/gdb/somsolib.h +++ b/gdb/somsolib.h @@ -23,6 +23,9 @@ Written by the Center for Software Science at the Univerity of Utah and by Cygnus Support. */ +#ifndef SOMSOLIB_H +#define SOMSOLIB_H + /* Forward decl's for prototypes */ struct target_ops; struct objfile; @@ -164,3 +167,12 @@ extern char *som_solib_address (CORE_ADDR); /* somsolib.c */ /* If ADDR lies in a shared library, return its name. */ #define PC_SOLIB(addr) som_solib_address (addr) + +extern CORE_ADDR som_solib_get_solib_by_pc (CORE_ADDR addr); + +struct so_list; +extern CORE_ADDR so_lib_thread_start_addr (struct so_list *so); + +extern void no_shared_libraries (char *ignored, int from_tty); + +#endif diff --git a/gdb/source.h b/gdb/source.h index ba7d45f..7cfed1a 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -21,6 +21,8 @@ #ifndef SOURCE_H #define SOURCE_H +struct symtab; + /* Open a source file given a symtab S. Returns a file descriptor or negative number for error. */ extern int open_source_file (struct symtab *s); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index b22474a..e1a0089 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -41,6 +41,7 @@ #endif #include "gdbcore.h" +#include "gdb_assert.h" #include "symfile.h" /* for 'entry_point_address' */ @@ -65,11 +66,14 @@ /* Does the target have Floating Point registers? */ -#if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE) -#define SPARC_HAS_FPU 0 -#else -#define SPARC_HAS_FPU 1 +#if 0 +// OBSOLETE #if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE) +// OBSOLETE #define SPARC_HAS_FPU 0 +// OBSOLETE #else +// OBSOLETE #define SPARC_HAS_FPU 1 +// OBSOLETE #endif #endif +#define SPARC_HAS_FPU 1 /* Number of bytes devoted to Floating Point registers: */ #if (GDB_TARGET_IS_SPARC64) @@ -103,7 +107,9 @@ struct gdbarch_tdep { - int has_fpu; +#if 0 + // OBSOLETE int has_fpu; +#endif int fp_register_bytes; int y_regnum; int fp_max_regnum; @@ -133,11 +139,13 @@ extern int stop_after_trap; int deferred_stores = 0; /* Accumulated stores we want to do eventually. */ -/* Some machines, such as Fujitsu SPARClite 86x, have a bi-endian mode - where instructions are big-endian and data are little-endian. - This flag is set when we detect that the target is of this type. */ - -int bi_endian = 0; +#if 0 +// OBSOLETE /* Some machines, such as Fujitsu SPARClite 86x, have a bi-endian mode +// OBSOLETE where instructions are big-endian and data are little-endian. +// OBSOLETE This flag is set when we detect that the target is of this type. */ +// OBSOLETE +// OBSOLETE int bi_endian = 0; +#endif /* Fetch a single instruction. Even on bi-endian machines @@ -326,9 +334,9 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) else { /* Should we adjust for stack bias here? */ - get_saved_register (buf, 0, 0, fi, FP_REGNUM, 0); - deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM))); - + ULONGEST tmp; + frame_read_unsigned_register (fi, 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); } @@ -367,8 +375,11 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) get_frame_extra_info (fi)->sp_offset = offset; /* Overwrite the frame's address with the value in %i7. */ - get_saved_register (buf, 0, 0, fi, I7_REGNUM, 0); - deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (I7_REGNUM))); + { + ULONGEST tmp; + frame_read_unsigned_register (fi, I7_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); @@ -429,20 +440,21 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) CORE_ADDR sparc_frame_chain (struct frame_info *frame) { - /* Value that will cause FRAME_CHAIN_VALID to not worry about the chain - value. If it really is zero, we detect it later in - sparc_init_prev_frame. + /* Value that will cause DEPRECATED_FRAME_CHAIN_VALID to not worry + about the chain value. If it really is zero, we detect it later + in sparc_init_prev_frame. - Note: kevinb/2003-02-18: The constant 1 used to be returned - here, but, after some recent changes to frame_chain_valid(), - this value is no longer suitable for causing frame_chain_valid() - to "not worry about the chain value." The constant ~0 (i.e, - 0xfff...) causes the failing test in frame_chain_valid() to - succeed thus preserving the "not worry" property. I had considered - using something like ``get_frame_base (frame) + 1''. However, I think - a constant value is better, because when debugging this problem, - I knew that something funny was going on as soon as I saw the - constant 1 being used as the frame chain elsewhere in GDB. */ + Note: kevinb/2003-02-18: The constant 1 used to be returned here, + but, after some recent changes to legacy_frame_chain_valid(), + this value is no longer suitable for causing + legacy_frame_chain_valid() to "not worry about the chain value." + The constant ~0 (i.e, 0xfff...) causes the failing test in + legacy_frame_chain_valid() to succeed thus preserving the "not + worry" property. I had considered using something like + ``get_frame_base (frame) + 1''. However, I think a constant + value is better, because when debugging this problem, I knew that + something funny was going on as soon as I saw the constant 1 + being used as the frame chain elsewhere in GDB. */ return ~ (CORE_ADDR) 0; } @@ -487,9 +499,11 @@ sparc_frame_saved_pc (struct frame_info *frame) saved_pc_offset = 12; /* The sigcontext address is contained in register O2. */ - get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL, - frame, O0_REGNUM + 2, (enum lval_type *) NULL); - sigcontext_addr = extract_address (buf, REGISTER_RAW_SIZE (O0_REGNUM + 2)); + { + ULONGEST tmp; + frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp); + sigcontext_addr = tmp; + } /* Don't cause a memory_error when accessing sigcontext in case the stack layout has changed or the stack is corrupt. */ @@ -505,9 +519,9 @@ sparc_frame_saved_pc (struct frame_info *frame) { /* A frameless function interrupted by a signal did not save the PC, it is still in %o7. */ - get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL, - frame, O7_REGNUM, (enum lval_type *) NULL); - return PC_ADJUST (extract_address (buf, SPARC_INTREG_SIZE)); + ULONGEST tmp; + frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + return PC_ADJUST (tmp); } if (get_frame_extra_info (frame)->flat) addr = get_frame_extra_info (frame)->pc_addr; @@ -547,7 +561,7 @@ setup_arbitrary_frame (int argc, CORE_ADDR *argv) "create_new_frame returned invalid frame"); get_frame_extra_info (frame)->bottom = argv[1]; - deprecated_update_frame_pc_hack (frame, FRAME_SAVED_PC (frame)); + deprecated_update_frame_pc_hack (frame, DEPRECATED_FRAME_SAVED_PC (frame)); return frame; } @@ -936,8 +950,9 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8) { /* Outs become ins. */ - get_saved_register (raw_buffer, optimized, addrp, frame1, - (regnum - O0_REGNUM + I0_REGNUM), lval); + int realnum; + frame_register (frame1, (regnum - O0_REGNUM + I0_REGNUM), + optimized, lval, addrp, &realnum, raw_buffer); return; } } @@ -1034,7 +1049,7 @@ sparc_push_dummy_frame (void) sp -= DUMMY_STACK_SIZE; - write_sp (sp); + DEPRECATED_DUMMY_WRITE_SP (sp); write_memory (sp + DUMMY_REG_SAVE_OFFSET, ®ister_temp[0], DUMMY_STACK_REG_BUF_SIZE); @@ -1090,10 +1105,10 @@ sparc_push_dummy_frame (void) I think few ports of GDB get right--if you are popping a frame which does not save some register that *is* saved by a more inner frame (such a frame will never be a dummy frame because dummy - frames save all registers). Rewriting pop_frame to use - get_saved_register would solve this problem and also get rid of the - ugly duplication between sparc_frame_find_saved_regs and - get_saved_register. + frames save all registers). + + NOTE: cagney/2003-03-12: Since pop_frame has been rewritten to use + frame_unwind_register() the need for this function is questionable. Stores, into an array of CORE_ADDR, the addresses of the saved registers of frame described by FRAME_INFO. @@ -1127,9 +1142,7 @@ sparc_frame_find_saved_regs (struct frame_info *fi, CORE_ADDR *saved_regs_addr) register int regnum; CORE_ADDR frame_addr = get_frame_base (fi); - if (!fi) - internal_error (__FILE__, __LINE__, - "Bad frame info struct in FRAME_FIND_SAVED_REGS"); + gdb_assert (fi != NULL); memset (saved_regs_addr, 0, NUM_REGS * sizeof (CORE_ADDR)); @@ -1304,7 +1317,7 @@ sparc_pop_frame (void) read_memory_integer (fsr[O0_REGNUM + 7], SPARC_INTREG_SIZE)); - write_sp (get_frame_base (frame)); + DEPRECATED_DUMMY_WRITE_SP (get_frame_base (frame)); } else if (fsr[I0_REGNUM]) { @@ -1369,12 +1382,9 @@ sparc_pop_frame (void) /* I think this happens only in the innermost frame, if so then it is a complicated way of saying "pc = read_register (O7_REGNUM);". */ - char *buf; - - buf = alloca (MAX_REGISTER_RAW_SIZE); - get_saved_register (buf, 0, 0, frame, O7_REGNUM, 0); - pc = PC_ADJUST (extract_address - (buf, REGISTER_RAW_SIZE (O7_REGNUM))); + ULONGEST tmp; + frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + pc = PC_ADJUST (tmp); } write_register (PC_REGNUM, pc); @@ -2171,21 +2181,23 @@ sparc_do_registers_info (int regnum, int all) regnum, all); } -static void -sparclet_print_registers_info (struct gdbarch *gdbarch, - struct ui_file *file, - struct frame_info *frame, - int regnum, int print_all) -{ - sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL); -} - -void -sparclet_do_registers_info (int regnum, int all) -{ - sparclet_print_registers_info (current_gdbarch, gdb_stdout, - deprecated_selected_frame, regnum, all); -} +#if 0 +// OBSOLETE static void +// OBSOLETE sparclet_print_registers_info (struct gdbarch *gdbarch, +// OBSOLETE struct ui_file *file, +// OBSOLETE struct frame_info *frame, +// OBSOLETE int regnum, int print_all) +// OBSOLETE { +// OBSOLETE sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE sparclet_do_registers_info (int regnum, int all) +// OBSOLETE { +// OBSOLETE sparclet_print_registers_info (current_gdbarch, gdb_stdout, +// OBSOLETE deprecated_selected_frame, regnum, all); +// OBSOLETE } +#endif int @@ -2246,8 +2258,8 @@ sparc32_push_arguments (int nargs, struct value **args, CORE_ADDR sp, } /* Make room for the arguments on the stack. */ - accumulate_size += CALL_DUMMY_STACK_ADJUST; - sp = ((sp - accumulate_size) & ~7) + CALL_DUMMY_STACK_ADJUST; + accumulate_size += DEPRECATED_CALL_DUMMY_STACK_ADJUST; + sp = ((sp - accumulate_size) & ~7) + DEPRECATED_CALL_DUMMY_STACK_ADJUST; /* `Push' arguments on the stack. */ for (i = 0, oregnum = 0, m_arg = sparc_args; @@ -2321,13 +2333,15 @@ sparc_store_return_value (struct type *type, char *valbuf) TYPE_LENGTH (type)); } -extern void -sparclet_store_return_value (struct type *type, char *valbuf) -{ - /* Other values are returned in register %o0. */ - deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf, - TYPE_LENGTH (type)); -} +#if 0 +// OBSOLETE extern void +// OBSOLETE sparclet_store_return_value (struct type *type, char *valbuf) +// OBSOLETE { +// OBSOLETE /* Other values are returned in register %o0. */ +// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf, +// OBSOLETE TYPE_LENGTH (type)); +// OBSOLETE } +#endif #ifndef CALL_DUMMY_CALL_OFFSET @@ -2393,40 +2407,43 @@ sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, } } - /* If this is a bi-endian target, GDB has written the call dummy - in little-endian order. We must byte-swap it back to big-endian. */ - if (bi_endian) - { - for (i = 0; i < CALL_DUMMY_LENGTH; i += 4) - { - char tmp = dummy[i]; - dummy[i] = dummy[i + 3]; - dummy[i + 3] = tmp; - tmp = dummy[i + 1]; - dummy[i + 1] = dummy[i + 2]; - dummy[i + 2] = tmp; - } - } +#if 0 +// OBSOLETE /* If this is a bi-endian target, GDB has written the call dummy +// OBSOLETE in little-endian order. We must byte-swap it back to big-endian. */ +// OBSOLETE if (bi_endian) +// OBSOLETE { +// OBSOLETE for (i = 0; i < CALL_DUMMY_LENGTH; i += 4) +// OBSOLETE { +// OBSOLETE char tmp = dummy[i]; +// OBSOLETE dummy[i] = dummy[i + 3]; +// OBSOLETE dummy[i + 3] = tmp; +// OBSOLETE tmp = dummy[i + 1]; +// OBSOLETE dummy[i + 1] = dummy[i + 2]; +// OBSOLETE dummy[i + 2] = tmp; +// OBSOLETE } +// OBSOLETE } +#endif } -/* Set target byte order based on machine type. */ - -static int -sparc_target_architecture_hook (const bfd_arch_info_type *ap) -{ - int i, j; - - if (ap->mach == bfd_mach_sparc_sparclite_le) - { - target_byte_order = BFD_ENDIAN_LITTLE; - bi_endian = 1; - } - else - bi_endian = 0; - return 1; -} - +#if 0 +// OBSOLETE /* Set target byte order based on machine type. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE sparc_target_architecture_hook (const bfd_arch_info_type *ap) +// OBSOLETE { +// OBSOLETE int i, j; +// OBSOLETE +// OBSOLETE if (ap->mach == bfd_mach_sparc_sparclite_le) +// OBSOLETE { +// OBSOLETE target_byte_order = BFD_ENDIAN_LITTLE; +// OBSOLETE bi_endian = 1; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE bi_endian = 0; +// OBSOLETE return 1; +// OBSOLETE } +#endif /* * Module "constructor" function. @@ -2444,7 +2461,7 @@ _initialize_sparc_tdep (void) tm_print_insn = gdb_print_insn_sparc; tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */ - target_architecture_hook = sparc_target_architecture_hook; + /* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */ } /* Compensate for stack bias. Note that we currently don't handle @@ -2674,18 +2691,19 @@ sparc64_extract_return_value (struct type *type, char *regbuf, char *valbuf) sp64_extract_return_value (type, regbuf, valbuf, 0); } -extern void -sparclet_extract_return_value (struct type *type, - char *regbuf, - char *valbuf) -{ - regbuf += REGISTER_RAW_SIZE (O0_REGNUM) * 8; - if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (O0_REGNUM)) - regbuf += REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH (type); - - memcpy ((void *) valbuf, regbuf, TYPE_LENGTH (type)); -} - +#if 0 +// OBSOLETE extern void +// OBSOLETE sparclet_extract_return_value (struct type *type, +// OBSOLETE char *regbuf, +// OBSOLETE char *valbuf) +// OBSOLETE { +// OBSOLETE regbuf += REGISTER_RAW_SIZE (O0_REGNUM) * 8; +// OBSOLETE if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (O0_REGNUM)) +// OBSOLETE regbuf += REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH (type); +// OBSOLETE +// OBSOLETE memcpy ((void *) valbuf, regbuf, TYPE_LENGTH (type)); +// OBSOLETE } +#endif extern CORE_ADDR sparc32_stack_align (CORE_ADDR addr) @@ -2766,66 +2784,70 @@ sparc64_register_name (int regno) return register_names[regno]; } -static const char * -sparclite_register_name (int regno) -{ - static char *register_names[] = - { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", - "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", - "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", - - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", - - "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", - "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" - }; - - if (regno < 0 || - regno >= (sizeof (register_names) / sizeof (register_names[0]))) - return NULL; - else - return register_names[regno]; -} - -static const char * -sparclet_register_name (int regno) -{ - static char *register_names[] = - { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", - "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", - "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", - - "", "", "", "", "", "", "", "", /* no floating point registers */ - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - - "y", "psr", "wim", "tbr", "pc", "npc", "", "", /* no FPSR or CPSR */ - "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", - - /* ASR15 ASR19 (don't display them) */ - "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22" - /* None of the rest get displayed */ #if 0 - "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", - "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", - "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", - "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", - "apsr" -#endif /* 0 */ - }; +// OBSOLETE static const char * +// OBSOLETE sparclite_register_name (int regno) +// OBSOLETE { +// OBSOLETE static char *register_names[] = +// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", +// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", +// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", +// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", +// OBSOLETE +// OBSOLETE "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", +// OBSOLETE "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", +// OBSOLETE "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", +// OBSOLETE "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", +// OBSOLETE +// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", +// OBSOLETE "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" +// OBSOLETE }; +// OBSOLETE +// OBSOLETE if (regno < 0 || +// OBSOLETE regno >= (sizeof (register_names) / sizeof (register_names[0]))) +// OBSOLETE return NULL; +// OBSOLETE else +// OBSOLETE return register_names[regno]; +// OBSOLETE } +#endif - if (regno < 0 || - regno >= (sizeof (register_names) / sizeof (register_names[0]))) - return NULL; - else - return register_names[regno]; -} +#if 0 +// OBSOLETE static const char * +// OBSOLETE sparclet_register_name (int regno) +// OBSOLETE { +// OBSOLETE static char *register_names[] = +// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", +// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", +// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", +// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", +// OBSOLETE +// OBSOLETE "", "", "", "", "", "", "", "", /* no floating point registers */ +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE +// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", /* no FPSR or CPSR */ +// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", +// OBSOLETE +// OBSOLETE /* ASR15 ASR19 (don't display them) */ +// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22" +// OBSOLETE /* None of the rest get displayed */ +// OBSOLETE #if 0 +// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", +// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", +// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", +// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", +// OBSOLETE "apsr" +// OBSOLETE #endif /* 0 */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE if (regno < 0 || +// OBSOLETE regno >= (sizeof (register_names) / sizeof (register_names[0]))) +// OBSOLETE return NULL; +// OBSOLETE else +// OBSOLETE return register_names[regno]; +// OBSOLETE } +#endif CORE_ADDR sparc_push_return_address (CORE_ADDR pc_unused, CORE_ADDR sp) @@ -3134,9 +3156,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* First set settings that are common for all sparc architectures. */ set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_p (gdbarch, 1); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 1); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address); @@ -3144,13 +3163,13 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM); set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM); - set_gdbarch_frame_chain (gdbarch, sparc_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, sparc_frame_chain); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); - set_gdbarch_frame_saved_pc (gdbarch, sparc_frame_saved_pc); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, sparc_frame_saved_pc); set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register); + set_gdbarch_deprecated_get_saved_register (gdbarch, sparc_get_saved_register); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -3158,8 +3177,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); - set_gdbarch_pop_frame (gdbarch, sparc_pop_frame); - set_gdbarch_push_return_address (gdbarch, sparc_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, sparc_pop_frame); + set_gdbarch_deprecated_push_return_address (gdbarch, sparc_push_return_address); set_gdbarch_deprecated_push_dummy_frame (gdbarch, sparc_push_dummy_frame); set_gdbarch_read_pc (gdbarch, generic_target_read_pc); set_gdbarch_register_convert_to_raw (gdbarch, sparc_convert_to_raw); @@ -3169,7 +3188,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) generic_register_convertible_not); set_gdbarch_reg_struct_has_addr (gdbarch, sparc_reg_struct_has_addr); set_gdbarch_return_value_on_stack (gdbarch, sparc_return_value_on_stack); - set_gdbarch_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call); set_gdbarch_prologue_frameless_p (gdbarch, sparc_prologue_frameless_p); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_skip_prologue (gdbarch, sparc_skip_prologue); @@ -3184,11 +3203,15 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) switch (info.bfd_arch_info->mach) { case bfd_mach_sparc: - case bfd_mach_sparc_sparclet: - case bfd_mach_sparc_sparclite: +#if 0 + // OBSOLETE case bfd_mach_sparc_sparclet: + // OBSOLETE case bfd_mach_sparc_sparclite: +#endif case bfd_mach_sparc_v8plus: case bfd_mach_sparc_v8plusa: - case bfd_mach_sparc_sparclite_le: +#if 0 + // OBSOLETE case bfd_mach_sparc_sparclite_le: +#endif /* 32-bit machine types: */ #ifdef SPARC32_CALL_DUMMY_ON_STACK @@ -3244,20 +3267,16 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_words (gdbarch, call_dummy_32); #else set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil); #endif - set_gdbarch_call_dummy_stack_adjust (gdbarch, 68); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 68); set_gdbarch_frame_args_skip (gdbarch, 68); set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_npc_regnum (gdbarch, SPARC32_NPC_REGNUM); set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); - set_gdbarch_push_arguments (gdbarch, sparc32_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments); set_gdbarch_read_fp (gdbarch, generic_target_read_fp); set_gdbarch_read_sp (gdbarch, generic_target_read_sp); @@ -3273,10 +3292,11 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); #endif set_gdbarch_stack_align (gdbarch, sparc32_stack_align); - set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); + set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention); - set_gdbarch_write_sp (gdbarch, generic_target_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); tdep->y_regnum = SPARC32_Y_REGNUM; tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32; tdep->intreg_size = 4; @@ -3299,20 +3319,16 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_words (gdbarch, call_dummy_64); #else set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil); #endif - set_gdbarch_call_dummy_stack_adjust (gdbarch, 128); + set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 128); set_gdbarch_frame_args_skip (gdbarch, 136); set_gdbarch_function_start_offset (gdbarch, 0); set_gdbarch_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_npc_regnum (gdbarch, SPARC64_NPC_REGNUM); set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_push_arguments (gdbarch, sparc64_push_arguments); + set_gdbarch_deprecated_push_arguments (gdbarch, sparc64_push_arguments); /* NOTE different for at_entry */ set_gdbarch_read_fp (gdbarch, sparc64_read_fp); set_gdbarch_read_sp (gdbarch, sparc64_read_sp); @@ -3330,10 +3346,11 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); #endif set_gdbarch_stack_align (gdbarch, sparc64_stack_align); - set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return); + set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1); + set_gdbarch_deprecated_store_struct_return (gdbarch, sparc64_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, sparc64_use_struct_convention); - set_gdbarch_write_sp (gdbarch, sparc64_write_sp); + set_gdbarch_deprecated_dummy_write_sp (gdbarch, sparc64_write_sp); tdep->y_regnum = SPARC64_Y_REGNUM; tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48; tdep->intreg_size = 8; @@ -3354,30 +3371,36 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); set_gdbarch_register_name (gdbarch, sparc32_register_name); set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#if 0 + // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#endif tdep->fp_register_bytes = 32 * 4; tdep->print_insn_mach = bfd_mach_sparc; break; - case bfd_mach_sparc_sparclet: - set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value); - set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8); - set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4); - set_gdbarch_register_name (gdbarch, sparclet_register_name); - set_gdbarch_deprecated_store_return_value (gdbarch, sparclet_store_return_value); - tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ - tdep->fp_register_bytes = 0; - tdep->print_insn_mach = bfd_mach_sparc_sparclet; - break; - case bfd_mach_sparc_sparclite: - set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); - set_gdbarch_num_regs (gdbarch, 80); - set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); - set_gdbarch_register_name (gdbarch, sparclite_register_name); - set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ - tdep->fp_register_bytes = 0; - tdep->print_insn_mach = bfd_mach_sparc_sparclite; - break; +#if 0 + // OBSOLETE case bfd_mach_sparc_sparclet: + // OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value); + // OBSOLETE set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8); + // OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4); + // OBSOLETE set_gdbarch_register_name (gdbarch, sparclet_register_name); + // OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparclet_store_return_value); + // OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ + // OBSOLETE tdep->fp_register_bytes = 0; + // OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclet; + // OBSOLETE break; +#endif +#if 0 + // OBSOLETE case bfd_mach_sparc_sparclite: + // OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); + // OBSOLETE set_gdbarch_num_regs (gdbarch, 80); + // OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); + // OBSOLETE set_gdbarch_register_name (gdbarch, sparclite_register_name); + // OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); + // OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ + // OBSOLETE tdep->fp_register_bytes = 0; + // OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclite; + // OBSOLETE break; +#endif case bfd_mach_sparc_v8plus: set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_num_regs (gdbarch, 72); @@ -3386,7 +3409,9 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); tdep->print_insn_mach = bfd_mach_sparc; tdep->fp_register_bytes = 32 * 4; - tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#if 0 + // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#endif break; case bfd_mach_sparc_v8plusa: set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); @@ -3394,27 +3419,33 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); set_gdbarch_register_name (gdbarch, sparc32_register_name); set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#if 0 + // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#endif tdep->fp_register_bytes = 32 * 4; tdep->print_insn_mach = bfd_mach_sparc; break; - case bfd_mach_sparc_sparclite_le: - set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); - set_gdbarch_num_regs (gdbarch, 80); - set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); - set_gdbarch_register_name (gdbarch, sparclite_register_name); - set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ - tdep->fp_register_bytes = 0; - tdep->print_insn_mach = bfd_mach_sparc_sparclite; - break; +#if 0 +// OBSOLETE case bfd_mach_sparc_sparclite_le: +// OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); +// OBSOLETE set_gdbarch_num_regs (gdbarch, 80); +// OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); +// OBSOLETE set_gdbarch_register_name (gdbarch, sparclite_register_name); +// OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); +// OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */ +// OBSOLETE tdep->fp_register_bytes = 0; +// OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclite; +// OBSOLETE break; +#endif case bfd_mach_sparc_v9: set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value); set_gdbarch_num_regs (gdbarch, 125); set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8); set_gdbarch_register_name (gdbarch, sparc64_register_name); set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#if 0 + // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#endif tdep->fp_register_bytes = 64 * 4; tdep->print_insn_mach = bfd_mach_sparc_v9a; break; @@ -3424,7 +3455,9 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8); set_gdbarch_register_name (gdbarch, sparc64_register_name); set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value); - tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#if 0 + // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ +#endif tdep->fp_register_bytes = 64 * 4; tdep->print_insn_mach = bfd_mach_sparc_v9a; break; @@ -3444,8 +3477,10 @@ sparc_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) if (tdep == NULL) return; - fprintf_unfiltered (file, "sparc_dump_tdep: has_fpu = %d\n", - tdep->has_fpu); +#if 0 + // OBSOLETE fprintf_unfiltered (file, "sparc_dump_tdep: has_fpu = %d\n", + // OBSOLETE tdep->has_fpu); +#endif fprintf_unfiltered (file, "sparc_dump_tdep: fp_register_bytes = %d\n", tdep->fp_register_bytes); fprintf_unfiltered (file, "sparc_dump_tdep: y_regnum = %d\n", diff --git a/gdb/sparcl-stub.c b/gdb/sparcl-stub.c index 3fcdc0a..6ba55a0 100644 --- a/gdb/sparcl-stub.c +++ b/gdb/sparcl-stub.c @@ -1,946 +1,946 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware - * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. - * - * This code has been extensively tested on the Fujitsu SPARClite demo board. - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * P set the value of a single CPU register OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $<packet info>#<checksum>. - * - * where - * <packet info> :: <characters representing the command or response> - * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include <string.h> -#include <signal.h> -#include <sparclite.h> - -/************************************************************************ - * - * external low-level support routines - */ - -extern void putDebugChar (int c); /* write a single character */ -extern int getDebugChar (void); /* read and return a single char */ - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 2048 - -static int initialized = 0; /* !0 means we've been initialized */ - -extern void breakinst (); -static void set_mem_fault_trap (int enable); -static void get_in_break_mode (void); - -static const char hexchars[]="0123456789abcdef"; - -#define NUMREGS 80 - -/* Number of bytes of registers. */ -#define NUMREGBYTES (NUMREGS * 4) -enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, - O0, O1, O2, O3, O4, O5, SP, O7, - L0, L1, L2, L3, L4, L5, L6, L7, - I0, I1, I2, I3, I4, I5, FP, I7, - - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, - Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, - DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR }; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void trap_low(); - -/* Create private copies of common functions used by the stub. This prevents - nasty interactions between app code and the stub (for instance if user steps - into strlen, etc..) */ - -static char * -strcpy (char *dst, const char *src) -{ - char *retval = dst; - - while ((*dst++ = *src++) != '\000'); - - return retval; -} - -static void * -memcpy (void *vdst, const void *vsrc, int n) -{ - char *dst = vdst; - const char *src = vsrc; - char *retval = dst; - - while (n-- > 0) - *dst++ = *src++; - - return retval; -} - -asm(" - .reserve trapstack, 1000 * 4, \"bss\", 8 - - .data - .align 4 - -in_trap_handler: - .word 0 - - .text - .align 4 - -! This function is called when any SPARC trap (except window overflow or -! underflow) occurs. It makes sure that the invalid register window is still -! available before jumping into C code. It will also restore the world if you -! return from handle_exception. -! -! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. -! Register usage throughout the routine is as follows: -! -! l0 - psr -! l1 - pc -! l2 - npc -! l3 - wim -! l4 - scratch and y reg -! l5 - scratch and tbr -! l6 - unused -! l7 - unused - - .globl _trap_low -_trap_low: - mov %psr, %l0 - mov %wim, %l3 - - srl %l3, %l0, %l4 ! wim >> cwp - cmp %l4, 1 - bne window_fine ! Branch if not in the invalid window - nop - -! Handle window overflow - - mov %g1, %l4 ! Save g1, we use it to hold the wim - srl %l3, 1, %g1 ! Rotate wim right - tst %g1 - bg good_wim ! Branch if new wim is non-zero - nop - -! At this point, we need to bring a 1 into the high order bit of the wim. -! Since we don't want to make any assumptions about the number of register -! windows, we figure it out dynamically so as to setup the wim correctly. - - not %g1 ! Fill g1 with ones - mov %g1, %wim ! Fill the wim with ones - nop - nop - nop - mov %wim, %g1 ! Read back the wim - inc %g1 ! Now g1 has 1 just to left of wim - srl %g1, 1, %g1 ! Now put 1 at top of wim - mov %g0, %wim ! Clear wim so that subsequent save - nop ! won't trap - nop - nop - -good_wim: - save %g0, %g0, %g0 ! Slip into next window - mov %g1, %wim ! Install the new wim - - std %l0, [%sp + 0 * 4] ! save L & I registers - std %l2, [%sp + 2 * 4] - std %l4, [%sp + 4 * 4] - std %l6, [%sp + 6 * 4] - - std %i0, [%sp + 8 * 4] - std %i2, [%sp + 10 * 4] - std %i4, [%sp + 12 * 4] - std %i6, [%sp + 14 * 4] - - restore ! Go back to trap window. - mov %l4, %g1 ! Restore %g1 - -window_fine: - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - tst %l5 - bg recursive_trap - inc %l5 - - set trapstack+1000*4, %sp ! Switch to trap stack - -recursive_trap: - st %l5, [%lo(in_trap_handler) + %l4] - sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[72] local var - - std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] - std %g2, [%sp + (24 + 2) * 4] - std %g4, [%sp + (24 + 4) * 4] - std %g6, [%sp + (24 + 6) * 4] - - std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] - std %i2, [%sp + (24 + 10) * 4] - std %i4, [%sp + (24 + 12) * 4] - std %i6, [%sp + (24 + 14) * 4] - - mov %y, %l4 - mov %tbr, %l5 - st %l4, [%sp + (24 + 64) * 4] ! Y - st %l0, [%sp + (24 + 65) * 4] ! PSR - st %l3, [%sp + (24 + 66) * 4] ! WIM - st %l5, [%sp + (24 + 67) * 4] ! TBR - st %l1, [%sp + (24 + 68) * 4] ! PC - st %l2, [%sp + (24 + 69) * 4] ! NPC - - or %l0, 0xf20, %l4 - mov %l4, %psr ! Turn on traps, disable interrupts - - set 0x1000, %l1 - btst %l1, %l0 ! FP enabled? - be no_fpstore - nop - -! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so -! traps must be enabled to allow the trap handler to clean things up. - - st %fsr, [%sp + (24 + 70) * 4] - - std %f0, [%sp + (24 + 32) * 4] - std %f2, [%sp + (24 + 34) * 4] - std %f4, [%sp + (24 + 36) * 4] - std %f6, [%sp + (24 + 38) * 4] - std %f8, [%sp + (24 + 40) * 4] - std %f10, [%sp + (24 + 42) * 4] - std %f12, [%sp + (24 + 44) * 4] - std %f14, [%sp + (24 + 46) * 4] - std %f16, [%sp + (24 + 48) * 4] - std %f18, [%sp + (24 + 50) * 4] - std %f20, [%sp + (24 + 52) * 4] - std %f22, [%sp + (24 + 54) * 4] - std %f24, [%sp + (24 + 56) * 4] - std %f26, [%sp + (24 + 58) * 4] - std %f28, [%sp + (24 + 60) * 4] - std %f30, [%sp + (24 + 62) * 4] -no_fpstore: - - call _handle_exception - add %sp, 24 * 4, %o0 ! Pass address of registers - -! Reload all of the registers that aren't on the stack - - ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] - ldd [%sp + (24 + 2) * 4], %g2 - ldd [%sp + (24 + 4) * 4], %g4 - ldd [%sp + (24 + 6) * 4], %g6 - - ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] - ldd [%sp + (24 + 10) * 4], %i2 - ldd [%sp + (24 + 12) * 4], %i4 - ldd [%sp + (24 + 14) * 4], %i6 - - - ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR - ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC - - set 0x1000, %l5 - btst %l5, %l1 ! FP enabled? - be no_fpreload - nop - - ldd [%sp + (24 + 32) * 4], %f0 - ldd [%sp + (24 + 34) * 4], %f2 - ldd [%sp + (24 + 36) * 4], %f4 - ldd [%sp + (24 + 38) * 4], %f6 - ldd [%sp + (24 + 40) * 4], %f8 - ldd [%sp + (24 + 42) * 4], %f10 - ldd [%sp + (24 + 44) * 4], %f12 - ldd [%sp + (24 + 46) * 4], %f14 - ldd [%sp + (24 + 48) * 4], %f16 - ldd [%sp + (24 + 50) * 4], %f18 - ldd [%sp + (24 + 52) * 4], %f20 - ldd [%sp + (24 + 54) * 4], %f22 - ldd [%sp + (24 + 56) * 4], %f24 - ldd [%sp + (24 + 58) * 4], %f26 - ldd [%sp + (24 + 60) * 4], %f28 - ldd [%sp + (24 + 62) * 4], %f30 - - ld [%sp + (24 + 70) * 4], %fsr -no_fpreload: - - restore ! Ensure that previous window is valid - save %g0, %g0, %g0 ! by causing a window_underflow trap - - mov %l0, %y - mov %l1, %psr ! Make sure that traps are disabled - ! for rett - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - dec %l5 - st %l5, [%lo(in_trap_handler) + %l4] - - jmpl %l2, %g0 ! Restore old PC - rett %l3 ! Restore old nPC -"); - -/* Convert ch from a hex digit to an int */ - -static int -hex (unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch-'a'+10; - if (ch >= '0' && ch <= '9') - return ch-'0'; - if (ch >= 'A' && ch <= 'F') - return ch-'A'+10; - return -1; -} - -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -/* scan for the sequence $<data>#<checksum> */ - -unsigned char * -getpacket (void) -{ - unsigned char *buffer = &remcomInBuffer[0]; - unsigned char checksum; - unsigned char xmitcsum; - int count; - char ch; - - while (1) - { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar ()) != '$') - ; - -retry: - checksum = 0; - xmitcsum = -1; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar (); - if (ch == '$') - goto retry; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') - { - ch = getDebugChar (); - xmitcsum = hex (ch) << 4; - ch = getDebugChar (); - xmitcsum += hex (ch); - - if (checksum != xmitcsum) - { - putDebugChar ('-'); /* failed checksum */ - } - else - { - putDebugChar ('+'); /* successful transfer */ - - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') - { - putDebugChar (buffer[0]); - putDebugChar (buffer[1]); - - return &buffer[3]; - } - - return &buffer[0]; - } - } - } -} - -/* send the packet in buffer. */ - -static void -putpacket (unsigned char *buffer) -{ - unsigned char checksum; - int count; - unsigned char ch; - - /* $<packet info>#<checksum>. */ - do - { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch = buffer[count]) - { - putDebugChar (ch); - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum & 0xf]); - - } - while (getDebugChar() != '+'); -} - -/* Indicate to caller of mem2hex or hex2mem that there has been an - error. */ -static volatile int mem_err = 0; - -/* Convert the memory pointed to by mem into hex, placing result in buf. - * Return a pointer to the last char put in buf (null), in case of mem fault, - * return 0. - * If MAY_FAULT is non-zero, then we will handle memory faults by returning - * a 0, else treat a fault like any other fault in the stub. - */ - -static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) -{ - unsigned char ch; - - set_mem_fault_trap(may_fault); - - while (count-- > 0) - { - ch = *mem++; - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - - set_mem_fault_trap(0); - - return buf; -} - -/* convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte written */ - -static char * -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) -{ - int i; - unsigned char ch; - - set_mem_fault_trap(may_fault); - - for (i=0; i<count; i++) - { - ch = hex(*buf++) << 4; - ch |= hex(*buf++); - *mem++ = ch; - if (mem_err) - return 0; - } - - set_mem_fault_trap(0); - - return mem; -} - -/* This table contains the mapping between SPARC hardware trap types, and - signals, which are primarily what GDB understands. It also indicates - which hardware traps we need to commandeer when initializing the stub. */ - -static struct hard_trap_info -{ - unsigned char tt; /* Trap type code for SPARClite */ - unsigned char signo; /* Signal that we map this trap into */ -} hard_trap_info[] = { - {0x01, SIGSEGV}, /* instruction access error */ - {0x02, SIGILL}, /* privileged instruction */ - {0x03, SIGILL}, /* illegal instruction */ - {0x04, SIGEMT}, /* fp disabled */ - {0x07, SIGBUS}, /* mem address not aligned */ - {0x09, SIGSEGV}, /* data access exception */ - {0x0a, SIGEMT}, /* tag overflow */ - {0x20, SIGBUS}, /* r register access error */ - {0x21, SIGBUS}, /* instruction access error */ - {0x24, SIGEMT}, /* cp disabled */ - {0x29, SIGBUS}, /* data access error */ - {0x2a, SIGFPE}, /* divide by zero */ - {0x2b, SIGBUS}, /* data store error */ - {0x80+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ - {0xff, SIGTRAP}, /* hardware breakpoint */ - {0, 0} /* Must be last */ -}; - -/* Set up exception handlers for tracing and breakpoints */ - -void -set_debug_traps (void) -{ - struct hard_trap_info *ht; - -/* Only setup fp traps if the FP is disabled. */ - - for (ht = hard_trap_info; - ht->tt != 0 && ht->signo != 0; - ht++) - if (ht->tt != 4 || ! (read_psr () & 0x1000)) - exceptionHandler(ht->tt, trap_low); - - initialized = 1; -} - -asm (" -! Trap handler for memory errors. This just sets mem_err to be non-zero. It -! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -! 0 would ever contain code that could mem fault. This routine will skip -! past the faulting instruction after setting mem_err. - - .text - .align 4 - -_fltr_set_mem_err: - sethi %hi(_mem_err), %l0 - st %l1, [%l0 + %lo(_mem_err)] - jmpl %l2, %g0 - rett %l2+4 -"); - -static void -set_mem_fault_trap (int enable) -{ - extern void fltr_set_mem_err(); - mem_err = 0; - - if (enable) - exceptionHandler(9, fltr_set_mem_err); - else - exceptionHandler(9, trap_low); -} - -asm (" - .text - .align 4 - -_dummy_hw_breakpoint: - jmpl %l2, %g0 - rett %l2+4 - nop - nop -"); - -static void -get_in_break_mode (void) -{ - extern void dummy_hw_breakpoint(); - - exceptionHandler (255, dummy_hw_breakpoint); - - asm ("ta 255"); - - exceptionHandler (255, trap_low); -} - -/* Convert the SPARC hardware trap type code to a unix signal number. */ - -static int -computeSignal (int tt) -{ - struct hard_trap_info *ht; - - for (ht = hard_trap_info; ht->tt && ht->signo; ht++) - if (ht->tt == tt) - return ht->signo; - - return SIGHUP; /* default for things we don't know about */ -} - -/* - * While we find nice hex chars, build an int. - * Return number of chars processed. - */ - -static int -hexToInt(char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) - { - hexValue = hex(**ptr); - if (hexValue < 0) - break; - - *intValue = (*intValue << 4) | hexValue; - numChars ++; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command procesing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ - -static void -handle_exception (unsigned long *registers) -{ - int tt; /* Trap type */ - int sigval; - int addr; - int length; - char *ptr; - unsigned long *sp; - unsigned long dsr; - -/* First, we must force all of the windows to be spilled out */ - - asm(" save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - save %sp, -64, %sp - restore - restore - restore - restore - restore - restore - restore - restore -"); - - get_in_break_mode (); /* Enable DSU register writes */ - - registers[DIA1] = read_asi (1, 0xff00); - registers[DIA2] = read_asi (1, 0xff04); - registers[DDA1] = read_asi (1, 0xff08); - registers[DDA2] = read_asi (1, 0xff0c); - registers[DDV1] = read_asi (1, 0xff10); - registers[DDV2] = read_asi (1, 0xff14); - registers[DCR] = read_asi (1, 0xff18); - registers[DSR] = read_asi (1, 0xff1c); - - if (registers[PC] == (unsigned long)breakinst) - { - registers[PC] = registers[NPC]; - registers[NPC] += 4; - } - sp = (unsigned long *)registers[SP]; - - dsr = (unsigned long)registers[DSR]; - if (dsr & 0x3c) - tt = 255; - else - tt = (registers[TBR] >> 4) & 0xff; - - /* reply to host that an exception has occurred */ - sigval = computeSignal(tt); - ptr = remcomOutBuffer; - - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[PC >> 4]; - *ptr++ = hexchars[PC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[FP >> 4]; - *ptr++ = hexchars[FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[SP >> 4]; - *ptr++ = hexchars[SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)&sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[NPC >> 4]; - *ptr++ = hexchars[NPC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[O7 >> 4]; - *ptr++ = hexchars[O7 & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = 0; - - putpacket(remcomOutBuffer); - - while (1) - { - remcomOutBuffer[0] = 0; - - ptr = getpacket(); - switch (*ptr++) - { - case '?': - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval & 0xf]; - remcomOutBuffer[3] = 0; - break; - - case 'd': - /* toggle debug flag */ - break; - - case 'g': /* return the value of the CPU registers */ - memcpy (®isters[L0], sp, 16 * 4); /* Copy L & I regs from stack */ - mem2hex ((char *)registers, remcomOutBuffer, NUMREGBYTES, 0); - break; - - case 'G': /* Set the value of all registers */ - case 'P': /* Set the value of one register */ - { - unsigned long *newsp, psr; - - psr = registers[PSR]; - - if (ptr[-1] == 'P') - { - int regno; - - if (hexToInt (&ptr, ®no) - && *ptr++ == '=') - if (regno >= L0 && regno <= I7) - hex2mem (ptr, sp + regno - L0, 4, 0); - else - hex2mem (ptr, (char *)®isters[regno], 4, 0); - else - { - strcpy (remcomOutBuffer, "E01"); - break; - } - } - else - { - hex2mem (ptr, (char *)registers, NUMREGBYTES, 0); - memcpy (sp, ®isters[L0], 16 * 4); /* Copy L & I regs to stack */ - } - - /* See if the stack pointer has moved. If so, then copy the saved - locals and ins to the new location. This keeps the window - overflow and underflow routines happy. */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - - /* Don't allow CWP to be modified. */ - - if (psr != registers[PSR]) - registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); - - strcpy(remcomOutBuffer,"OK"); - } - break; - - case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - /* Try to read %x,%x. */ - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length)) - { - if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) - break; - - strcpy (remcomOutBuffer, "E03"); - } - else - strcpy(remcomOutBuffer,"E01"); - break; - - case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - /* Try to read '%x,%x:'. */ - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length) - && *ptr++ == ':') - { - if (hex2mem(ptr, (char *)addr, length, 1)) - strcpy(remcomOutBuffer, "OK"); - else - strcpy(remcomOutBuffer, "E03"); - } - else - strcpy(remcomOutBuffer, "E02"); - break; - - case 'c': /* cAA..AA Continue at address AA..AA(optional) */ - /* try to read optional parameter, pc unchanged if no parm */ - if (hexToInt(&ptr, &addr)) - { - registers[PC] = addr; - registers[NPC] = addr + 4; - } - -/* Need to flush the instruction cache here, as we may have deposited a - breakpoint, and the icache probably has no way of knowing that a data ref to - some location may have changed something that is in the instruction cache. - */ - - flush_i_cache (); - - if (!(registers[DSR] & 0x1) /* DSU enabled? */ - && !(registers[DCR] & 0x200)) /* Are we in break state? */ - { /* Yes, set the DSU regs */ - write_asi (1, 0xff00, registers[DIA1]); - write_asi (1, 0xff04, registers[DIA2]); - write_asi (1, 0xff08, registers[DDA1]); - write_asi (1, 0xff0c, registers[DDA2]); - write_asi (1, 0xff10, registers[DDV1]); - write_asi (1, 0xff14, registers[DDV2]); - write_asi (1, 0xff1c, registers[DSR]); - write_asi (1, 0xff18, registers[DCR] | 0x200); /* Clear break */ - } - - return; - - /* kill the program */ - case 'k' : /* do nothing */ - break; -#if 0 - case 't': /* Test feature */ - asm (" std %f30,[%sp]"); - break; -#endif - case 'r': /* Reset */ - asm ("call 0 - nop "); - break; - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void -breakpoint (void) -{ - if (!initialized) - return; - - asm(" .globl _breakinst - - _breakinst: ta 1 - "); -} +// OBSOLETE /**************************************************************************** +// OBSOLETE +// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED +// OBSOLETE +// OBSOLETE HP offers the following for use in the public domain. HP makes no +// OBSOLETE warranty with regard to the software or it's performance and the +// OBSOLETE user accepts the software "AS IS" with all faults. +// OBSOLETE +// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD +// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// OBSOLETE +// OBSOLETE ****************************************************************************/ +// OBSOLETE +// OBSOLETE /**************************************************************************** +// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ +// OBSOLETE * +// OBSOLETE * Module name: remcom.c $ +// OBSOLETE * Revision: 1.34 $ +// OBSOLETE * Date: 91/03/09 12:29:49 $ +// OBSOLETE * Contributor: Lake Stevens Instrument Division$ +// OBSOLETE * +// OBSOLETE * Description: low level support for gdb debugger. $ +// OBSOLETE * +// OBSOLETE * Considerations: only works on target hardware $ +// OBSOLETE * +// OBSOLETE * Written by: Glenn Engel $ +// OBSOLETE * ModuleState: Experimental $ +// OBSOLETE * +// OBSOLETE * NOTES: See Below $ +// OBSOLETE * +// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support. +// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware +// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. +// OBSOLETE * +// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board. +// OBSOLETE * +// OBSOLETE * To enable debugger support, two things need to happen. One, a +// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints +// OBSOLETE * or error conditions to be properly intercepted and reported to gdb. +// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This +// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint() +// OBSOLETE * simulates a breakpoint by executing a trap #1. +// OBSOLETE * +// OBSOLETE ************* +// OBSOLETE * +// OBSOLETE * The following gdb commands are supported: +// OBSOLETE * +// OBSOLETE * command function Return value +// OBSOLETE * +// OBSOLETE * g return the value of the CPU registers hex data or ENN +// OBSOLETE * G set the value of the CPU registers OK or ENN +// OBSOLETE * P set the value of a single CPU register OK or ENN +// OBSOLETE * +// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN +// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN +// OBSOLETE * +// OBSOLETE * c Resume at current address SNN ( signal NN) +// OBSOLETE * cAA..AA Continue at address AA..AA SNN +// OBSOLETE * +// OBSOLETE * s Step one instruction SNN +// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN +// OBSOLETE * +// OBSOLETE * k kill +// OBSOLETE * +// OBSOLETE * ? What was the last sigval ? SNN (signal NN) +// OBSOLETE * +// OBSOLETE * All commands and responses are sent with a packet which includes a +// OBSOLETE * checksum. A packet consists of +// OBSOLETE * +// OBSOLETE * $<packet info>#<checksum>. +// OBSOLETE * +// OBSOLETE * where +// OBSOLETE * <packet info> :: <characters representing the command or response> +// OBSOLETE * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> +// OBSOLETE * +// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'. +// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer. +// OBSOLETE * +// OBSOLETE * Example: +// OBSOLETE * +// OBSOLETE * Host: Reply: +// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42 +// OBSOLETE * +// OBSOLETE ****************************************************************************/ +// OBSOLETE +// OBSOLETE #include <string.h> +// OBSOLETE #include <signal.h> +// OBSOLETE #include <sparclite.h> +// OBSOLETE +// OBSOLETE /************************************************************************ +// OBSOLETE * +// OBSOLETE * external low-level support routines +// OBSOLETE */ +// OBSOLETE +// OBSOLETE extern void putDebugChar (int c); /* write a single character */ +// OBSOLETE extern int getDebugChar (void); /* read and return a single char */ +// OBSOLETE +// OBSOLETE /************************************************************************/ +// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */ +// OBSOLETE #define BUFMAX 2048 +// OBSOLETE +// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */ +// OBSOLETE +// OBSOLETE extern void breakinst (); +// OBSOLETE static void set_mem_fault_trap (int enable); +// OBSOLETE static void get_in_break_mode (void); +// OBSOLETE +// OBSOLETE static const char hexchars[]="0123456789abcdef"; +// OBSOLETE +// OBSOLETE #define NUMREGS 80 +// OBSOLETE +// OBSOLETE /* Number of bytes of registers. */ +// OBSOLETE #define NUMREGBYTES (NUMREGS * 4) +// OBSOLETE enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, +// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7, +// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7, +// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7, +// OBSOLETE +// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7, +// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15, +// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23, +// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31, +// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, +// OBSOLETE DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR }; +// OBSOLETE +// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/ +// OBSOLETE /* */ +// OBSOLETE +// OBSOLETE extern void trap_low(); +// OBSOLETE +// OBSOLETE /* Create private copies of common functions used by the stub. This prevents +// OBSOLETE nasty interactions between app code and the stub (for instance if user steps +// OBSOLETE into strlen, etc..) */ +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE strcpy (char *dst, const char *src) +// OBSOLETE { +// OBSOLETE char *retval = dst; +// OBSOLETE +// OBSOLETE while ((*dst++ = *src++) != '\000'); +// OBSOLETE +// OBSOLETE return retval; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void * +// OBSOLETE memcpy (void *vdst, const void *vsrc, int n) +// OBSOLETE { +// OBSOLETE char *dst = vdst; +// OBSOLETE const char *src = vsrc; +// OBSOLETE char *retval = dst; +// OBSOLETE +// OBSOLETE while (n-- > 0) +// OBSOLETE *dst++ = *src++; +// OBSOLETE +// OBSOLETE return retval; +// OBSOLETE } +// OBSOLETE +// OBSOLETE asm(" +// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8 +// OBSOLETE +// OBSOLETE .data +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE in_trap_handler: +// OBSOLETE .word 0 +// OBSOLETE +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE ! This function is called when any SPARC trap (except window overflow or +// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still +// OBSOLETE ! available before jumping into C code. It will also restore the world if you +// OBSOLETE ! return from handle_exception. +// OBSOLETE ! +// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. +// OBSOLETE ! Register usage throughout the routine is as follows: +// OBSOLETE ! +// OBSOLETE ! l0 - psr +// OBSOLETE ! l1 - pc +// OBSOLETE ! l2 - npc +// OBSOLETE ! l3 - wim +// OBSOLETE ! l4 - scratch and y reg +// OBSOLETE ! l5 - scratch and tbr +// OBSOLETE ! l6 - unused +// OBSOLETE ! l7 - unused +// OBSOLETE +// OBSOLETE .globl _trap_low +// OBSOLETE _trap_low: +// OBSOLETE mov %psr, %l0 +// OBSOLETE mov %wim, %l3 +// OBSOLETE +// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp +// OBSOLETE cmp %l4, 1 +// OBSOLETE bne window_fine ! Branch if not in the invalid window +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! Handle window overflow +// OBSOLETE +// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim +// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right +// OBSOLETE tst %g1 +// OBSOLETE bg good_wim ! Branch if new wim is non-zero +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim. +// OBSOLETE ! Since we don't want to make any assumptions about the number of register +// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly. +// OBSOLETE +// OBSOLETE not %g1 ! Fill g1 with ones +// OBSOLETE mov %g1, %wim ! Fill the wim with ones +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE mov %wim, %g1 ! Read back the wim +// OBSOLETE inc %g1 ! Now g1 has 1 just to left of wim +// OBSOLETE srl %g1, 1, %g1 ! Now put 1 at top of wim +// OBSOLETE mov %g0, %wim ! Clear wim so that subsequent save +// OBSOLETE nop ! won't trap +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE good_wim: +// OBSOLETE save %g0, %g0, %g0 ! Slip into next window +// OBSOLETE mov %g1, %wim ! Install the new wim +// OBSOLETE +// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers +// OBSOLETE std %l2, [%sp + 2 * 4] +// OBSOLETE std %l4, [%sp + 4 * 4] +// OBSOLETE std %l6, [%sp + 6 * 4] +// OBSOLETE +// OBSOLETE std %i0, [%sp + 8 * 4] +// OBSOLETE std %i2, [%sp + 10 * 4] +// OBSOLETE std %i4, [%sp + 12 * 4] +// OBSOLETE std %i6, [%sp + 14 * 4] +// OBSOLETE +// OBSOLETE restore ! Go back to trap window. +// OBSOLETE mov %l4, %g1 ! Restore %g1 +// OBSOLETE +// OBSOLETE window_fine: +// OBSOLETE sethi %hi(in_trap_handler), %l4 +// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 +// OBSOLETE tst %l5 +// OBSOLETE bg recursive_trap +// OBSOLETE inc %l5 +// OBSOLETE +// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack +// OBSOLETE +// OBSOLETE recursive_trap: +// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] +// OBSOLETE sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals +// OBSOLETE ! + hidden arg + arg spill +// OBSOLETE ! + doubleword alignment +// OBSOLETE ! + registers[72] local var +// OBSOLETE +// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] +// OBSOLETE std %g2, [%sp + (24 + 2) * 4] +// OBSOLETE std %g4, [%sp + (24 + 4) * 4] +// OBSOLETE std %g6, [%sp + (24 + 6) * 4] +// OBSOLETE +// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] +// OBSOLETE std %i2, [%sp + (24 + 10) * 4] +// OBSOLETE std %i4, [%sp + (24 + 12) * 4] +// OBSOLETE std %i6, [%sp + (24 + 14) * 4] +// OBSOLETE +// OBSOLETE mov %y, %l4 +// OBSOLETE mov %tbr, %l5 +// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y +// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR +// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM +// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR +// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC +// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC +// OBSOLETE +// OBSOLETE or %l0, 0xf20, %l4 +// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts +// OBSOLETE +// OBSOLETE set 0x1000, %l1 +// OBSOLETE btst %l1, %l0 ! FP enabled? +// OBSOLETE be no_fpstore +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so +// OBSOLETE ! traps must be enabled to allow the trap handler to clean things up. +// OBSOLETE +// OBSOLETE st %fsr, [%sp + (24 + 70) * 4] +// OBSOLETE +// OBSOLETE std %f0, [%sp + (24 + 32) * 4] +// OBSOLETE std %f2, [%sp + (24 + 34) * 4] +// OBSOLETE std %f4, [%sp + (24 + 36) * 4] +// OBSOLETE std %f6, [%sp + (24 + 38) * 4] +// OBSOLETE std %f8, [%sp + (24 + 40) * 4] +// OBSOLETE std %f10, [%sp + (24 + 42) * 4] +// OBSOLETE std %f12, [%sp + (24 + 44) * 4] +// OBSOLETE std %f14, [%sp + (24 + 46) * 4] +// OBSOLETE std %f16, [%sp + (24 + 48) * 4] +// OBSOLETE std %f18, [%sp + (24 + 50) * 4] +// OBSOLETE std %f20, [%sp + (24 + 52) * 4] +// OBSOLETE std %f22, [%sp + (24 + 54) * 4] +// OBSOLETE std %f24, [%sp + (24 + 56) * 4] +// OBSOLETE std %f26, [%sp + (24 + 58) * 4] +// OBSOLETE std %f28, [%sp + (24 + 60) * 4] +// OBSOLETE std %f30, [%sp + (24 + 62) * 4] +// OBSOLETE no_fpstore: +// OBSOLETE +// OBSOLETE call _handle_exception +// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers +// OBSOLETE +// OBSOLETE ! Reload all of the registers that aren't on the stack +// OBSOLETE +// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] +// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2 +// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4 +// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6 +// OBSOLETE +// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] +// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2 +// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4 +// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6 +// OBSOLETE +// OBSOLETE +// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR +// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC +// OBSOLETE +// OBSOLETE set 0x1000, %l5 +// OBSOLETE btst %l5, %l1 ! FP enabled? +// OBSOLETE be no_fpreload +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ldd [%sp + (24 + 32) * 4], %f0 +// OBSOLETE ldd [%sp + (24 + 34) * 4], %f2 +// OBSOLETE ldd [%sp + (24 + 36) * 4], %f4 +// OBSOLETE ldd [%sp + (24 + 38) * 4], %f6 +// OBSOLETE ldd [%sp + (24 + 40) * 4], %f8 +// OBSOLETE ldd [%sp + (24 + 42) * 4], %f10 +// OBSOLETE ldd [%sp + (24 + 44) * 4], %f12 +// OBSOLETE ldd [%sp + (24 + 46) * 4], %f14 +// OBSOLETE ldd [%sp + (24 + 48) * 4], %f16 +// OBSOLETE ldd [%sp + (24 + 50) * 4], %f18 +// OBSOLETE ldd [%sp + (24 + 52) * 4], %f20 +// OBSOLETE ldd [%sp + (24 + 54) * 4], %f22 +// OBSOLETE ldd [%sp + (24 + 56) * 4], %f24 +// OBSOLETE ldd [%sp + (24 + 58) * 4], %f26 +// OBSOLETE ldd [%sp + (24 + 60) * 4], %f28 +// OBSOLETE ldd [%sp + (24 + 62) * 4], %f30 +// OBSOLETE +// OBSOLETE ld [%sp + (24 + 70) * 4], %fsr +// OBSOLETE no_fpreload: +// OBSOLETE +// OBSOLETE restore ! Ensure that previous window is valid +// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap +// OBSOLETE +// OBSOLETE mov %l0, %y +// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled +// OBSOLETE ! for rett +// OBSOLETE sethi %hi(in_trap_handler), %l4 +// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 +// OBSOLETE dec %l5 +// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] +// OBSOLETE +// OBSOLETE jmpl %l2, %g0 ! Restore old PC +// OBSOLETE rett %l3 ! Restore old nPC +// OBSOLETE "); +// OBSOLETE +// OBSOLETE /* Convert ch from a hex digit to an int */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE hex (unsigned char ch) +// OBSOLETE { +// OBSOLETE if (ch >= 'a' && ch <= 'f') +// OBSOLETE return ch-'a'+10; +// OBSOLETE if (ch >= '0' && ch <= '9') +// OBSOLETE return ch-'0'; +// OBSOLETE if (ch >= 'A' && ch <= 'F') +// OBSOLETE return ch-'A'+10; +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static char remcomInBuffer[BUFMAX]; +// OBSOLETE static char remcomOutBuffer[BUFMAX]; +// OBSOLETE +// OBSOLETE /* scan for the sequence $<data>#<checksum> */ +// OBSOLETE +// OBSOLETE unsigned char * +// OBSOLETE getpacket (void) +// OBSOLETE { +// OBSOLETE unsigned char *buffer = &remcomInBuffer[0]; +// OBSOLETE unsigned char checksum; +// OBSOLETE unsigned char xmitcsum; +// OBSOLETE int count; +// OBSOLETE char ch; +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE /* wait around for the start character, ignore all other characters */ +// OBSOLETE while ((ch = getDebugChar ()) != '$') +// OBSOLETE ; +// OBSOLETE +// OBSOLETE retry: +// OBSOLETE checksum = 0; +// OBSOLETE xmitcsum = -1; +// OBSOLETE count = 0; +// OBSOLETE +// OBSOLETE /* now, read until a # or end of buffer is found */ +// OBSOLETE while (count < BUFMAX) +// OBSOLETE { +// OBSOLETE ch = getDebugChar (); +// OBSOLETE if (ch == '$') +// OBSOLETE goto retry; +// OBSOLETE if (ch == '#') +// OBSOLETE break; +// OBSOLETE checksum = checksum + ch; +// OBSOLETE buffer[count] = ch; +// OBSOLETE count = count + 1; +// OBSOLETE } +// OBSOLETE buffer[count] = 0; +// OBSOLETE +// OBSOLETE if (ch == '#') +// OBSOLETE { +// OBSOLETE ch = getDebugChar (); +// OBSOLETE xmitcsum = hex (ch) << 4; +// OBSOLETE ch = getDebugChar (); +// OBSOLETE xmitcsum += hex (ch); +// OBSOLETE +// OBSOLETE if (checksum != xmitcsum) +// OBSOLETE { +// OBSOLETE putDebugChar ('-'); /* failed checksum */ +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE putDebugChar ('+'); /* successful transfer */ +// OBSOLETE +// OBSOLETE /* if a sequence char is present, reply the sequence ID */ +// OBSOLETE if (buffer[2] == ':') +// OBSOLETE { +// OBSOLETE putDebugChar (buffer[0]); +// OBSOLETE putDebugChar (buffer[1]); +// OBSOLETE +// OBSOLETE return &buffer[3]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return &buffer[0]; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* send the packet in buffer. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE putpacket (unsigned char *buffer) +// OBSOLETE { +// OBSOLETE unsigned char checksum; +// OBSOLETE int count; +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE /* $<packet info>#<checksum>. */ +// OBSOLETE do +// OBSOLETE { +// OBSOLETE putDebugChar('$'); +// OBSOLETE checksum = 0; +// OBSOLETE count = 0; +// OBSOLETE +// OBSOLETE while (ch = buffer[count]) +// OBSOLETE { +// OBSOLETE putDebugChar (ch); +// OBSOLETE checksum += ch; +// OBSOLETE count += 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE putDebugChar('#'); +// OBSOLETE putDebugChar(hexchars[checksum >> 4]); +// OBSOLETE putDebugChar(hexchars[checksum & 0xf]); +// OBSOLETE +// OBSOLETE } +// OBSOLETE while (getDebugChar() != '+'); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an +// OBSOLETE error. */ +// OBSOLETE static volatile int mem_err = 0; +// OBSOLETE +// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf. +// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault, +// OBSOLETE * return 0. +// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning +// OBSOLETE * a 0, else treat a fault like any other fault in the stub. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static unsigned char * +// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +// OBSOLETE { +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(may_fault); +// OBSOLETE +// OBSOLETE while (count-- > 0) +// OBSOLETE { +// OBSOLETE ch = *mem++; +// OBSOLETE if (mem_err) +// OBSOLETE return 0; +// OBSOLETE *buf++ = hexchars[ch >> 4]; +// OBSOLETE *buf++ = hexchars[ch & 0xf]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE *buf = 0; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(0); +// OBSOLETE +// OBSOLETE return buf; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem +// OBSOLETE * return a pointer to the character AFTER the last byte written */ +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(may_fault); +// OBSOLETE +// OBSOLETE for (i=0; i<count; i++) +// OBSOLETE { +// OBSOLETE ch = hex(*buf++) << 4; +// OBSOLETE ch |= hex(*buf++); +// OBSOLETE *mem++ = ch; +// OBSOLETE if (mem_err) +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE set_mem_fault_trap(0); +// OBSOLETE +// OBSOLETE return mem; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This table contains the mapping between SPARC hardware trap types, and +// OBSOLETE signals, which are primarily what GDB understands. It also indicates +// OBSOLETE which hardware traps we need to commandeer when initializing the stub. */ +// OBSOLETE +// OBSOLETE static struct hard_trap_info +// OBSOLETE { +// OBSOLETE unsigned char tt; /* Trap type code for SPARClite */ +// OBSOLETE unsigned char signo; /* Signal that we map this trap into */ +// OBSOLETE } hard_trap_info[] = { +// OBSOLETE {0x01, SIGSEGV}, /* instruction access error */ +// OBSOLETE {0x02, SIGILL}, /* privileged instruction */ +// OBSOLETE {0x03, SIGILL}, /* illegal instruction */ +// OBSOLETE {0x04, SIGEMT}, /* fp disabled */ +// OBSOLETE {0x07, SIGBUS}, /* mem address not aligned */ +// OBSOLETE {0x09, SIGSEGV}, /* data access exception */ +// OBSOLETE {0x0a, SIGEMT}, /* tag overflow */ +// OBSOLETE {0x20, SIGBUS}, /* r register access error */ +// OBSOLETE {0x21, SIGBUS}, /* instruction access error */ +// OBSOLETE {0x24, SIGEMT}, /* cp disabled */ +// OBSOLETE {0x29, SIGBUS}, /* data access error */ +// OBSOLETE {0x2a, SIGFPE}, /* divide by zero */ +// OBSOLETE {0x2b, SIGBUS}, /* data store error */ +// OBSOLETE {0x80+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ +// OBSOLETE {0xff, SIGTRAP}, /* hardware breakpoint */ +// OBSOLETE {0, 0} /* Must be last */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* Set up exception handlers for tracing and breakpoints */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE set_debug_traps (void) +// OBSOLETE { +// OBSOLETE struct hard_trap_info *ht; +// OBSOLETE +// OBSOLETE /* Only setup fp traps if the FP is disabled. */ +// OBSOLETE +// OBSOLETE for (ht = hard_trap_info; +// OBSOLETE ht->tt != 0 && ht->signo != 0; +// OBSOLETE ht++) +// OBSOLETE if (ht->tt != 4 || ! (read_psr () & 0x1000)) +// OBSOLETE exceptionHandler(ht->tt, trap_low); +// OBSOLETE +// OBSOLETE initialized = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE asm (" +// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It +// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that +// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip +// OBSOLETE ! past the faulting instruction after setting mem_err. +// OBSOLETE +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE _fltr_set_mem_err: +// OBSOLETE sethi %hi(_mem_err), %l0 +// OBSOLETE st %l1, [%l0 + %lo(_mem_err)] +// OBSOLETE jmpl %l2, %g0 +// OBSOLETE rett %l2+4 +// OBSOLETE "); +// OBSOLETE +// OBSOLETE static void +// OBSOLETE set_mem_fault_trap (int enable) +// OBSOLETE { +// OBSOLETE extern void fltr_set_mem_err(); +// OBSOLETE mem_err = 0; +// OBSOLETE +// OBSOLETE if (enable) +// OBSOLETE exceptionHandler(9, fltr_set_mem_err); +// OBSOLETE else +// OBSOLETE exceptionHandler(9, trap_low); +// OBSOLETE } +// OBSOLETE +// OBSOLETE asm (" +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE _dummy_hw_breakpoint: +// OBSOLETE jmpl %l2, %g0 +// OBSOLETE rett %l2+4 +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE "); +// OBSOLETE +// OBSOLETE static void +// OBSOLETE get_in_break_mode (void) +// OBSOLETE { +// OBSOLETE extern void dummy_hw_breakpoint(); +// OBSOLETE +// OBSOLETE exceptionHandler (255, dummy_hw_breakpoint); +// OBSOLETE +// OBSOLETE asm ("ta 255"); +// OBSOLETE +// OBSOLETE exceptionHandler (255, trap_low); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE computeSignal (int tt) +// OBSOLETE { +// OBSOLETE struct hard_trap_info *ht; +// OBSOLETE +// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++) +// OBSOLETE if (ht->tt == tt) +// OBSOLETE return ht->signo; +// OBSOLETE +// OBSOLETE return SIGHUP; /* default for things we don't know about */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * While we find nice hex chars, build an int. +// OBSOLETE * Return number of chars processed. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE hexToInt(char **ptr, int *intValue) +// OBSOLETE { +// OBSOLETE int numChars = 0; +// OBSOLETE int hexValue; +// OBSOLETE +// OBSOLETE *intValue = 0; +// OBSOLETE +// OBSOLETE while (**ptr) +// OBSOLETE { +// OBSOLETE hexValue = hex(**ptr); +// OBSOLETE if (hexValue < 0) +// OBSOLETE break; +// OBSOLETE +// OBSOLETE *intValue = (*intValue << 4) | hexValue; +// OBSOLETE numChars ++; +// OBSOLETE +// OBSOLETE (*ptr)++; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return (numChars); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * This function does all command procesing for interfacing to gdb. It +// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0 +// OBSOLETE * otherwise. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE handle_exception (unsigned long *registers) +// OBSOLETE { +// OBSOLETE int tt; /* Trap type */ +// OBSOLETE int sigval; +// OBSOLETE int addr; +// OBSOLETE int length; +// OBSOLETE char *ptr; +// OBSOLETE unsigned long *sp; +// OBSOLETE unsigned long dsr; +// OBSOLETE +// OBSOLETE /* First, we must force all of the windows to be spilled out */ +// OBSOLETE +// OBSOLETE asm(" save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE save %sp, -64, %sp +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE "); +// OBSOLETE +// OBSOLETE get_in_break_mode (); /* Enable DSU register writes */ +// OBSOLETE +// OBSOLETE registers[DIA1] = read_asi (1, 0xff00); +// OBSOLETE registers[DIA2] = read_asi (1, 0xff04); +// OBSOLETE registers[DDA1] = read_asi (1, 0xff08); +// OBSOLETE registers[DDA2] = read_asi (1, 0xff0c); +// OBSOLETE registers[DDV1] = read_asi (1, 0xff10); +// OBSOLETE registers[DDV2] = read_asi (1, 0xff14); +// OBSOLETE registers[DCR] = read_asi (1, 0xff18); +// OBSOLETE registers[DSR] = read_asi (1, 0xff1c); +// OBSOLETE +// OBSOLETE if (registers[PC] == (unsigned long)breakinst) +// OBSOLETE { +// OBSOLETE registers[PC] = registers[NPC]; +// OBSOLETE registers[NPC] += 4; +// OBSOLETE } +// OBSOLETE sp = (unsigned long *)registers[SP]; +// OBSOLETE +// OBSOLETE dsr = (unsigned long)registers[DSR]; +// OBSOLETE if (dsr & 0x3c) +// OBSOLETE tt = 255; +// OBSOLETE else +// OBSOLETE tt = (registers[TBR] >> 4) & 0xff; +// OBSOLETE +// OBSOLETE /* reply to host that an exception has occurred */ +// OBSOLETE sigval = computeSignal(tt); +// OBSOLETE ptr = remcomOutBuffer; +// OBSOLETE +// OBSOLETE *ptr++ = 'T'; +// OBSOLETE *ptr++ = hexchars[sigval >> 4]; +// OBSOLETE *ptr++ = hexchars[sigval & 0xf]; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[PC >> 4]; +// OBSOLETE *ptr++ = hexchars[PC & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[FP >> 4]; +// OBSOLETE *ptr++ = hexchars[FP & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[SP >> 4]; +// OBSOLETE *ptr++ = hexchars[SP & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[NPC >> 4]; +// OBSOLETE *ptr++ = hexchars[NPC & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[O7 >> 4]; +// OBSOLETE *ptr++ = hexchars[O7 & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = 0; +// OBSOLETE +// OBSOLETE putpacket(remcomOutBuffer); +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE remcomOutBuffer[0] = 0; +// OBSOLETE +// OBSOLETE ptr = getpacket(); +// OBSOLETE switch (*ptr++) +// OBSOLETE { +// OBSOLETE case '?': +// OBSOLETE remcomOutBuffer[0] = 'S'; +// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4]; +// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf]; +// OBSOLETE remcomOutBuffer[3] = 0; +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'd': +// OBSOLETE /* toggle debug flag */ +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'g': /* return the value of the CPU registers */ +// OBSOLETE memcpy (®isters[L0], sp, 16 * 4); /* Copy L & I regs from stack */ +// OBSOLETE mem2hex ((char *)registers, remcomOutBuffer, NUMREGBYTES, 0); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'G': /* Set the value of all registers */ +// OBSOLETE case 'P': /* Set the value of one register */ +// OBSOLETE { +// OBSOLETE unsigned long *newsp, psr; +// OBSOLETE +// OBSOLETE psr = registers[PSR]; +// OBSOLETE +// OBSOLETE if (ptr[-1] == 'P') +// OBSOLETE { +// OBSOLETE int regno; +// OBSOLETE +// OBSOLETE if (hexToInt (&ptr, ®no) +// OBSOLETE && *ptr++ == '=') +// OBSOLETE if (regno >= L0 && regno <= I7) +// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0); +// OBSOLETE else +// OBSOLETE hex2mem (ptr, (char *)®isters[regno], 4, 0); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE strcpy (remcomOutBuffer, "E01"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE hex2mem (ptr, (char *)registers, NUMREGBYTES, 0); +// OBSOLETE memcpy (sp, ®isters[L0], 16 * 4); /* Copy L & I regs to stack */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved +// OBSOLETE locals and ins to the new location. This keeps the window +// OBSOLETE overflow and underflow routines happy. */ +// OBSOLETE +// OBSOLETE newsp = (unsigned long *)registers[SP]; +// OBSOLETE if (sp != newsp) +// OBSOLETE sp = memcpy(newsp, sp, 16 * 4); +// OBSOLETE +// OBSOLETE /* Don't allow CWP to be modified. */ +// OBSOLETE +// OBSOLETE if (psr != registers[PSR]) +// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); +// OBSOLETE +// OBSOLETE strcpy(remcomOutBuffer,"OK"); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ +// OBSOLETE /* Try to read %x,%x. */ +// OBSOLETE +// OBSOLETE if (hexToInt(&ptr, &addr) +// OBSOLETE && *ptr++ == ',' +// OBSOLETE && hexToInt(&ptr, &length)) +// OBSOLETE { +// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) +// OBSOLETE break; +// OBSOLETE +// OBSOLETE strcpy (remcomOutBuffer, "E03"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer,"E01"); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ +// OBSOLETE /* Try to read '%x,%x:'. */ +// OBSOLETE +// OBSOLETE if (hexToInt(&ptr, &addr) +// OBSOLETE && *ptr++ == ',' +// OBSOLETE && hexToInt(&ptr, &length) +// OBSOLETE && *ptr++ == ':') +// OBSOLETE { +// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1)) +// OBSOLETE strcpy(remcomOutBuffer, "OK"); +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer, "E03"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer, "E02"); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */ +// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */ +// OBSOLETE if (hexToInt(&ptr, &addr)) +// OBSOLETE { +// OBSOLETE registers[PC] = addr; +// OBSOLETE registers[NPC] = addr + 4; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a +// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to +// OBSOLETE some location may have changed something that is in the instruction cache. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE flush_i_cache (); +// OBSOLETE +// OBSOLETE if (!(registers[DSR] & 0x1) /* DSU enabled? */ +// OBSOLETE && !(registers[DCR] & 0x200)) /* Are we in break state? */ +// OBSOLETE { /* Yes, set the DSU regs */ +// OBSOLETE write_asi (1, 0xff00, registers[DIA1]); +// OBSOLETE write_asi (1, 0xff04, registers[DIA2]); +// OBSOLETE write_asi (1, 0xff08, registers[DDA1]); +// OBSOLETE write_asi (1, 0xff0c, registers[DDA2]); +// OBSOLETE write_asi (1, 0xff10, registers[DDV1]); +// OBSOLETE write_asi (1, 0xff14, registers[DDV2]); +// OBSOLETE write_asi (1, 0xff1c, registers[DSR]); +// OBSOLETE write_asi (1, 0xff18, registers[DCR] | 0x200); /* Clear break */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE return; +// OBSOLETE +// OBSOLETE /* kill the program */ +// OBSOLETE case 'k' : /* do nothing */ +// OBSOLETE break; +// OBSOLETE #if 0 +// OBSOLETE case 't': /* Test feature */ +// OBSOLETE asm (" std %f30,[%sp]"); +// OBSOLETE break; +// OBSOLETE #endif +// OBSOLETE case 'r': /* Reset */ +// OBSOLETE asm ("call 0 +// OBSOLETE nop "); +// OBSOLETE break; +// OBSOLETE } /* switch */ +// OBSOLETE +// OBSOLETE /* reply to the request */ +// OBSOLETE putpacket(remcomOutBuffer); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This function will generate a breakpoint exception. It is used at the +// OBSOLETE beginning of a program to sync up with a debugger and can be used +// OBSOLETE otherwise as a quick means to stop program execution and "break" into +// OBSOLETE the debugger. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE breakpoint (void) +// OBSOLETE { +// OBSOLETE if (!initialized) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE asm(" .globl _breakinst +// OBSOLETE +// OBSOLETE _breakinst: ta 1 +// OBSOLETE "); +// OBSOLETE } diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index aa06747..8c376c5 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -1,869 +1,869 @@ -/* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger. - Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "gdbcore.h" -#include "breakpoint.h" -#include "target.h" -#include "serial.h" -#include "regcache.h" -#include <sys/types.h> - -#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__) -#define HAVE_SOCKETS -#include <sys/time.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#endif - -static struct target_ops sparclite_ops; - -static char *remote_target_name = NULL; -static struct serial *remote_desc = NULL; -static int serial_flag; -#ifdef HAVE_SOCKETS -static int udp_fd = -1; -#endif - -static struct serial *open_tty (char *name); -static int send_resp (struct serial *desc, char c); -static void close_tty (void * ignore); -#ifdef HAVE_SOCKETS -static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout); -static int send_udp_buf (int fd, unsigned char *buf, int len); -#endif -static void sparclite_open (char *name, int from_tty); -static void sparclite_close (int quitting); -static void download (char *target_name, char *args, int from_tty, - void (*write_routine) (bfd * from_bfd, - asection * from_sec, - file_ptr from_addr, - bfd_vma to_addr, int len), - void (*start_routine) (bfd_vma entry)); -static void sparclite_serial_start (bfd_vma entry); -static void sparclite_serial_write (bfd * from_bfd, asection * from_sec, - file_ptr from_addr, - bfd_vma to_addr, int len); -#ifdef HAVE_SOCKETS -static unsigned short calc_checksum (unsigned char *buffer, int count); -static void sparclite_udp_start (bfd_vma entry); -static void sparclite_udp_write (bfd * from_bfd, asection * from_sec, - file_ptr from_addr, bfd_vma to_addr, - int len); -#endif -static void sparclite_download (char *filename, int from_tty); - -#define DDA2_SUP_ASI 0xb000000 -#define DDA1_SUP_ASI 0xb0000 - -#define DDA2_ASI_MASK 0xff000000 -#define DDA1_ASI_MASK 0xff0000 -#define DIA2_SUP_MODE 0x8000 -#define DIA1_SUP_MODE 0x4000 -#define DDA2_ENABLE 0x100 -#define DDA1_ENABLE 0x80 -#define DIA2_ENABLE 0x40 -#define DIA1_ENABLE 0x20 -#define DSINGLE_STEP 0x10 /* not used */ -#define DDV_TYPE_MASK 0xc -#define DDV_TYPE_LOAD 0x0 -#define DDV_TYPE_STORE 0x4 -#define DDV_TYPE_ACCESS 0x8 -#define DDV_TYPE_ALWAYS 0xc -#define DDV_COND 0x2 -#define DDV_MASK 0x1 - -int -sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type) -{ - CORE_ADDR dcr; - - dcr = read_register (DCR_REGNUM); - - if (!(dcr & DDA1_ENABLE)) - { - write_register (DDA1_REGNUM, addr); - dcr &= ~(DDA1_ASI_MASK | DDV_TYPE_MASK); - dcr |= (DDA1_SUP_ASI | DDA1_ENABLE); - if (type == 1) - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_LOAD & (~DDV_COND & ~DDV_MASK)); - } - else if (type == 0) - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_STORE & (~DDV_COND & ~DDV_MASK)); - } - else - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_ACCESS); - } - write_register (DCR_REGNUM, dcr); - } - else if (!(dcr & DDA2_ENABLE)) - { - write_register (DDA2_REGNUM, addr); - dcr &= ~(DDA2_ASI_MASK & DDV_TYPE_MASK); - dcr |= (DDA2_SUP_ASI | DDA2_ENABLE); - if (type == 1) - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_LOAD & ~DDV_COND & ~DDV_MASK); - } - else if (type == 0) - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_STORE & ~DDV_COND & ~DDV_MASK); - } - else - { - write_register (DDV1_REGNUM, 0); - write_register (DDV2_REGNUM, 0xffffffff); - dcr |= (DDV_TYPE_ACCESS); - } - write_register (DCR_REGNUM, dcr); - } - else - return -1; - - return 0; -} - -int -sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type) -{ - CORE_ADDR dcr, dda1, dda2; - - dcr = read_register (DCR_REGNUM); - dda1 = read_register (DDA1_REGNUM); - dda2 = read_register (DDA2_REGNUM); - - if ((dcr & DDA1_ENABLE) && addr == dda1) - write_register (DCR_REGNUM, (dcr & ~DDA1_ENABLE)); - else if ((dcr & DDA2_ENABLE) && addr == dda2) - write_register (DCR_REGNUM, (dcr & ~DDA2_ENABLE)); - else - return -1; - - return 0; -} - -int -sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len) -{ - CORE_ADDR dcr; - - dcr = read_register (DCR_REGNUM); - - if (!(dcr & DIA1_ENABLE)) - { - write_register (DIA1_REGNUM, addr); - write_register (DCR_REGNUM, (dcr | DIA1_ENABLE | DIA1_SUP_MODE)); - } - else if (!(dcr & DIA2_ENABLE)) - { - write_register (DIA2_REGNUM, addr); - write_register (DCR_REGNUM, (dcr | DIA2_ENABLE | DIA2_SUP_MODE)); - } - else - return -1; - - return 0; -} - -int -sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow) -{ - CORE_ADDR dcr, dia1, dia2; - - dcr = read_register (DCR_REGNUM); - dia1 = read_register (DIA1_REGNUM); - dia2 = read_register (DIA2_REGNUM); - - if ((dcr & DIA1_ENABLE) && addr == dia1) - write_register (DCR_REGNUM, (dcr & ~DIA1_ENABLE)); - else if ((dcr & DIA2_ENABLE) && addr == dia2) - write_register (DCR_REGNUM, (dcr & ~DIA2_ENABLE)); - else - return -1; - - return 0; -} - -int -sparclite_check_watch_resources (int type, int cnt, int ot) -{ - /* Watchpoints not supported on simulator. */ - if (strcmp (target_shortname, "sim") == 0) - return 0; - - if (type == bp_hardware_breakpoint) - { - if (TARGET_HW_BREAK_LIMIT == 0) - return 0; - else if (cnt <= TARGET_HW_BREAK_LIMIT) - return 1; - } - else - { - if (TARGET_HW_WATCH_LIMIT == 0) - return 0; - else if (ot) - return -1; - else if (cnt <= TARGET_HW_WATCH_LIMIT) - return 1; - } - return -1; -} - -CORE_ADDR -sparclite_stopped_data_address (void) -{ - CORE_ADDR dsr, dda1, dda2; - - dsr = read_register (DSR_REGNUM); - dda1 = read_register (DDA1_REGNUM); - dda2 = read_register (DDA2_REGNUM); - - if (dsr & 0x10) - return dda1; - else if (dsr & 0x20) - return dda2; - else - return 0; -} - -static struct serial * -open_tty (char *name) -{ - struct serial *desc; - - desc = serial_open (name); - if (!desc) - perror_with_name (name); - - if (baud_rate != -1) - { - if (serial_setbaudrate (desc, baud_rate)) - { - serial_close (desc); - perror_with_name (name); - } - } - - serial_raw (desc); - - serial_flush_input (desc); - - return desc; -} - -/* Read a single character from the remote end, masking it down to 7 bits. */ - -static int -readchar (struct serial *desc, int timeout) -{ - int ch; - char s[10]; - - ch = serial_readchar (desc, timeout); - - switch (ch) - { - case SERIAL_EOF: - error ("SPARClite remote connection closed"); - case SERIAL_ERROR: - perror_with_name ("SPARClite communication error"); - case SERIAL_TIMEOUT: - error ("SPARClite remote timeout"); - default: - if (remote_debug > 0) - { - sprintf (s, "[%02x]", ch & 0xff); - puts_debug ("read -->", s, "<--"); - } - return ch; - } -} - -static void -debug_serial_write (struct serial *desc, char *buf, int len) -{ - char s[10]; - - serial_write (desc, buf, len); - if (remote_debug > 0) - { - while (len-- > 0) - { - sprintf (s, "[%02x]", *buf & 0xff); - puts_debug ("Sent -->", s, "<--"); - buf++; - } - } -} - - -static int -send_resp (struct serial *desc, char c) -{ - debug_serial_write (desc, &c, 1); - return readchar (desc, remote_timeout); -} - -static void -close_tty (void *ignore) -{ - if (!remote_desc) - return; - - serial_close (remote_desc); - - remote_desc = NULL; -} - -#ifdef HAVE_SOCKETS -static int -recv_udp_buf (int fd, unsigned char *buf, int len, int timeout) -{ - int cc; - fd_set readfds; - - FD_ZERO (&readfds); - FD_SET (fd, &readfds); - - if (timeout >= 0) - { - struct timeval timebuf; - - timebuf.tv_sec = timeout; - timebuf.tv_usec = 0; - cc = select (fd + 1, &readfds, 0, 0, &timebuf); - } - else - cc = select (fd + 1, &readfds, 0, 0, 0); - - if (cc == 0) - return 0; - - if (cc != 1) - perror_with_name ("recv_udp_buf: Bad return value from select:"); - - cc = recv (fd, buf, len, 0); - - if (cc < 0) - perror_with_name ("Got an error from recv: "); -} - -static int -send_udp_buf (int fd, unsigned char *buf, int len) -{ - int cc; - - cc = send (fd, buf, len, 0); - - if (cc == len) - return; - - if (cc < 0) - perror_with_name ("Got an error from send: "); - - error ("Short count in send: tried %d, sent %d\n", len, cc); -} -#endif /* HAVE_SOCKETS */ - -static void -sparclite_open (char *name, int from_tty) -{ - struct cleanup *old_chain; - int c; - char *p; - - if (!name) - error ("You need to specify what device or hostname is associated with the SparcLite board."); - - target_preopen (from_tty); - - unpush_target (&sparclite_ops); - - if (remote_target_name) - xfree (remote_target_name); - - remote_target_name = xstrdup (name); - - /* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can - mean either a serial port on a terminal server, or the IP address of a - SPARClite demo board. If there's no colon, then it pretty much has to be - a local device (except for DOS... grrmble) */ - - p = strchr (name, ' '); - - if (p) - { - *p++ = '\000'; - while ((*p != '\000') && isspace (*p)) - p++; - - if (strncmp (name, "serial", strlen (name)) == 0) - serial_flag = 1; - else if (strncmp (name, "udp", strlen (name)) == 0) - serial_flag = 0; - else - error ("Must specify either `serial' or `udp'."); - } - else - { - p = name; - - if (!strchr (name, ':')) - serial_flag = 1; /* No colon is unambiguous (local device) */ - else - error ("Usage: target sparclite serial /dev/ttyb\n\ -or: target sparclite udp host"); - } - - if (serial_flag) - { - remote_desc = open_tty (p); - - old_chain = make_cleanup (close_tty, 0 /*ignore*/); - - c = send_resp (remote_desc, 0x00); - - if (c != 0xaa) - error ("Unknown response (0x%x) from SparcLite. Try resetting the board.", - c); - - c = send_resp (remote_desc, 0x55); - - if (c != 0x55) - error ("Sparclite appears to be ill."); - } - else - { -#ifdef HAVE_SOCKETS - struct hostent *he; - struct sockaddr_in sockaddr; - unsigned char buffer[100]; - int cc; - - /* Setup the socket. Must be raw UDP. */ - - he = gethostbyname (p); - - if (!he) - error ("No such host %s.", p); - - udp_fd = socket (PF_INET, SOCK_DGRAM, 0); - - old_chain = make_cleanup (close, udp_fd); - - sockaddr.sin_family = PF_INET; - sockaddr.sin_port = htons (7000); - memcpy (&sockaddr.sin_addr.s_addr, he->h_addr, sizeof (struct in_addr)); - - if (connect (udp_fd, &sockaddr, sizeof (sockaddr))) - perror_with_name ("Connect failed"); - - buffer[0] = 0x5; - buffer[1] = 0; - - send_udp_buf (udp_fd, buffer, 2); /* Request version */ - cc = recv_udp_buf (udp_fd, buffer, sizeof (buffer), 5); /* Get response */ - if (cc == 0) - error ("SPARClite isn't responding."); - - if (cc < 3) - error ("SPARClite appears to be ill."); -#else - error ("UDP downloading is not supported for DOS hosts."); -#endif /* HAVE_SOCKETS */ - } - - printf_unfiltered ("[SPARClite appears to be alive]\n"); - - push_target (&sparclite_ops); - - discard_cleanups (old_chain); - - return; -} - -static void -sparclite_close (int quitting) -{ - if (serial_flag) - close_tty (0); -#ifdef HAVE_SOCKETS - else if (udp_fd != -1) - close (udp_fd); -#endif -} - -#define LOAD_ADDRESS 0x40000000 - -static void -download (char *target_name, char *args, int from_tty, - void (*write_routine) (bfd *from_bfd, asection *from_sec, - file_ptr from_addr, bfd_vma to_addr, int len), - void (*start_routine) (bfd_vma entry)) -{ - struct cleanup *old_chain; - asection *section; - bfd *pbfd; - bfd_vma entry; - int i; -#define WRITESIZE 1024 - char *filename; - int quiet; - int nostart; - - quiet = 0; - nostart = 0; - filename = NULL; - - while (*args != '\000') - { - char *arg; - - while (isspace (*args)) - args++; - - arg = args; - - while ((*args != '\000') && !isspace (*args)) - args++; - - if (*args != '\000') - *args++ = '\000'; - - if (*arg != '-') - filename = arg; - else if (strncmp (arg, "-quiet", strlen (arg)) == 0) - quiet = 1; - else if (strncmp (arg, "-nostart", strlen (arg)) == 0) - nostart = 1; - else - error ("unknown option `%s'", arg); - } - - if (!filename) - filename = get_exec_file (1); - - pbfd = bfd_openr (filename, gnutarget); - if (pbfd == NULL) - { - perror_with_name (filename); - return; - } - old_chain = make_cleanup_bfd_close (pbfd); - - if (!bfd_check_format (pbfd, bfd_object)) - error ("\"%s\" is not an object file: %s", filename, - bfd_errmsg (bfd_get_error ())); - - for (section = pbfd->sections; section; section = section->next) - { - if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) - { - bfd_vma section_address; - bfd_size_type section_size; - file_ptr fptr; - const char *section_name; - - section_name = bfd_get_section_name (pbfd, section); - - section_address = bfd_get_section_vma (pbfd, section); - - /* Adjust sections from a.out files, since they don't - carry their addresses with. */ - if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour) - { - if (strcmp (section_name, ".text") == 0) - section_address = bfd_get_start_address (pbfd); - else if (strcmp (section_name, ".data") == 0) - { - /* Read the first 8 bytes of the data section. - There should be the string 'DaTa' followed by - a word containing the actual section address. */ - struct data_marker - { - char signature[4]; /* 'DaTa' */ - unsigned char sdata[4]; /* &sdata */ - } - marker; - bfd_get_section_contents (pbfd, section, &marker, 0, - sizeof (marker)); - if (strncmp (marker.signature, "DaTa", 4) == 0) - { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - section_address = bfd_getb32 (marker.sdata); - else - section_address = bfd_getl32 (marker.sdata); - } - } - } - - section_size = bfd_get_section_size_before_reloc (section); - - if (!quiet) - printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n", - bfd_get_section_name (pbfd, section), - section_address, - section_size); - - fptr = 0; - while (section_size > 0) - { - int count; - static char inds[] = "|/-\\"; - static int k = 0; - - QUIT; - - count = min (section_size, WRITESIZE); - - write_routine (pbfd, section, fptr, section_address, count); - - if (!quiet) - { - printf_unfiltered ("\r%c", inds[k++ % 4]); - gdb_flush (gdb_stdout); - } - - section_address += count; - fptr += count; - section_size -= count; - } - } - } - - if (!nostart) - { - entry = bfd_get_start_address (pbfd); - - if (!quiet) - printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry); - - start_routine (entry); - } - - do_cleanups (old_chain); -} - -static void -sparclite_serial_start (bfd_vma entry) -{ - char buffer[5]; - int i; - - buffer[0] = 0x03; - store_unsigned_integer (buffer + 1, 4, entry); - - debug_serial_write (remote_desc, buffer, 1 + 4); - i = readchar (remote_desc, remote_timeout); - if (i != 0x55) - error ("Can't start SparcLite. Error code %d\n", i); -} - -static void -sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, - bfd_vma to_addr, int len) -{ - char buffer[4 + 4 + WRITESIZE]; /* addr + len + data */ - unsigned char checksum; - int i; - - store_unsigned_integer (buffer, 4, to_addr); /* Address */ - store_unsigned_integer (buffer + 4, 4, len); /* Length */ - - bfd_get_section_contents (from_bfd, from_sec, buffer + 8, from_addr, len); - - checksum = 0; - for (i = 0; i < len; i++) - checksum += buffer[8 + i]; - - i = send_resp (remote_desc, 0x01); - - if (i != 0x5a) - error ("Bad response from load command (0x%x)", i); - - debug_serial_write (remote_desc, buffer, 4 + 4 + len); - i = readchar (remote_desc, remote_timeout); - - if (i != checksum) - error ("Bad checksum from load command (0x%x)", i); -} - -#ifdef HAVE_SOCKETS - -static unsigned short -calc_checksum (unsigned char *buffer, int count) -{ - unsigned short checksum; - - checksum = 0; - for (; count > 0; count -= 2, buffer += 2) - checksum += (*buffer << 8) | *(buffer + 1); - - if (count != 0) - checksum += *buffer << 8; - - return checksum; -} - -static void -sparclite_udp_start (bfd_vma entry) -{ - unsigned char buffer[6]; - int i; - - buffer[0] = 0x3; - buffer[1] = 0; - buffer[2] = entry >> 24; - buffer[3] = entry >> 16; - buffer[4] = entry >> 8; - buffer[5] = entry; - - send_udp_buf (udp_fd, buffer, 6); /* Send start addr */ - i = recv_udp_buf (udp_fd, buffer, sizeof (buffer), -1); /* Get response */ - - if (i < 1 || buffer[0] != 0x55) - error ("Failed to take start address."); -} - -static void -sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, - bfd_vma to_addr, int len) -{ - unsigned char buffer[2000]; - unsigned short checksum; - static int pkt_num = 0; - static unsigned long old_addr = -1; - int i; - - while (1) - { - if (to_addr != old_addr) - { - buffer[0] = 0x1; /* Load command */ - buffer[1] = 0x1; /* Loading address */ - buffer[2] = to_addr >> 24; - buffer[3] = to_addr >> 16; - buffer[4] = to_addr >> 8; - buffer[5] = to_addr; - - checksum = 0; - for (i = 0; i < 6; i++) - checksum += buffer[i]; - checksum &= 0xff; - - send_udp_buf (udp_fd, buffer, 6); - i = recv_udp_buf (udp_fd, buffer, sizeof buffer, -1); - - if (i < 1) - error ("Got back short checksum for load addr."); - - if (checksum != buffer[0]) - error ("Got back bad checksum for load addr."); - - pkt_num = 0; /* Load addr resets packet seq # */ - old_addr = to_addr; - } - - bfd_get_section_contents (from_bfd, from_sec, buffer + 6, from_addr, - len); - - checksum = calc_checksum (buffer + 6, len); - - buffer[0] = 0x1; /* Load command */ - buffer[1] = 0x2; /* Loading data */ - buffer[2] = pkt_num >> 8; - buffer[3] = pkt_num; - buffer[4] = checksum >> 8; - buffer[5] = checksum; - - send_udp_buf (udp_fd, buffer, len + 6); - i = recv_udp_buf (udp_fd, buffer, sizeof buffer, 3); - - if (i == 0) - { - fprintf_unfiltered (gdb_stderr, "send_data: timeout sending %d bytes to address 0x%x retrying\n", len, to_addr); - continue; - } - - if (buffer[0] != 0xff) - error ("Got back bad response for load data."); - - old_addr += len; - pkt_num++; - - return; - } -} - -#endif /* HAVE_SOCKETS */ - -static void -sparclite_download (char *filename, int from_tty) -{ - if (!serial_flag) -#ifdef HAVE_SOCKETS - download (remote_target_name, filename, from_tty, sparclite_udp_write, - sparclite_udp_start); -#else - internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* sparclite_open should prevent this! */ -#endif - else - download (remote_target_name, filename, from_tty, sparclite_serial_write, - sparclite_serial_start); -} - -/* Set up the sparclite target vector. */ - -static void -init_sparclite_ops (void) -{ - sparclite_ops.to_shortname = "sparclite"; - sparclite_ops.to_longname = "SPARClite download target"; - sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\ -Specify the device it is connected to (e.g. /dev/ttya)."; - sparclite_ops.to_open = sparclite_open; - sparclite_ops.to_close = sparclite_close; - sparclite_ops.to_load = sparclite_download; - sparclite_ops.to_stratum = download_stratum; - sparclite_ops.to_magic = OPS_MAGIC; -} - -void -_initialize_sparcl_tdep (void) -{ - init_sparclite_ops (); - add_target (&sparclite_ops); -} +// OBSOLETE /* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger. +// OBSOLETE Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "breakpoint.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "serial.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE #include <sys/types.h> +// OBSOLETE +// OBSOLETE #if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__) +// OBSOLETE #define HAVE_SOCKETS +// OBSOLETE #include <sys/time.h> +// OBSOLETE #include <sys/socket.h> +// OBSOLETE #include <netinet/in.h> +// OBSOLETE #include <netdb.h> +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE static struct target_ops sparclite_ops; +// OBSOLETE +// OBSOLETE static char *remote_target_name = NULL; +// OBSOLETE static struct serial *remote_desc = NULL; +// OBSOLETE static int serial_flag; +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE static int udp_fd = -1; +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE static struct serial *open_tty (char *name); +// OBSOLETE static int send_resp (struct serial *desc, char c); +// OBSOLETE static void close_tty (void * ignore); +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout); +// OBSOLETE static int send_udp_buf (int fd, unsigned char *buf, int len); +// OBSOLETE #endif +// OBSOLETE static void sparclite_open (char *name, int from_tty); +// OBSOLETE static void sparclite_close (int quitting); +// OBSOLETE static void download (char *target_name, char *args, int from_tty, +// OBSOLETE void (*write_routine) (bfd * from_bfd, +// OBSOLETE asection * from_sec, +// OBSOLETE file_ptr from_addr, +// OBSOLETE bfd_vma to_addr, int len), +// OBSOLETE void (*start_routine) (bfd_vma entry)); +// OBSOLETE static void sparclite_serial_start (bfd_vma entry); +// OBSOLETE static void sparclite_serial_write (bfd * from_bfd, asection * from_sec, +// OBSOLETE file_ptr from_addr, +// OBSOLETE bfd_vma to_addr, int len); +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE static unsigned short calc_checksum (unsigned char *buffer, int count); +// OBSOLETE static void sparclite_udp_start (bfd_vma entry); +// OBSOLETE static void sparclite_udp_write (bfd * from_bfd, asection * from_sec, +// OBSOLETE file_ptr from_addr, bfd_vma to_addr, +// OBSOLETE int len); +// OBSOLETE #endif +// OBSOLETE static void sparclite_download (char *filename, int from_tty); +// OBSOLETE +// OBSOLETE #define DDA2_SUP_ASI 0xb000000 +// OBSOLETE #define DDA1_SUP_ASI 0xb0000 +// OBSOLETE +// OBSOLETE #define DDA2_ASI_MASK 0xff000000 +// OBSOLETE #define DDA1_ASI_MASK 0xff0000 +// OBSOLETE #define DIA2_SUP_MODE 0x8000 +// OBSOLETE #define DIA1_SUP_MODE 0x4000 +// OBSOLETE #define DDA2_ENABLE 0x100 +// OBSOLETE #define DDA1_ENABLE 0x80 +// OBSOLETE #define DIA2_ENABLE 0x40 +// OBSOLETE #define DIA1_ENABLE 0x20 +// OBSOLETE #define DSINGLE_STEP 0x10 /* not used */ +// OBSOLETE #define DDV_TYPE_MASK 0xc +// OBSOLETE #define DDV_TYPE_LOAD 0x0 +// OBSOLETE #define DDV_TYPE_STORE 0x4 +// OBSOLETE #define DDV_TYPE_ACCESS 0x8 +// OBSOLETE #define DDV_TYPE_ALWAYS 0xc +// OBSOLETE #define DDV_COND 0x2 +// OBSOLETE #define DDV_MASK 0x1 +// OBSOLETE +// OBSOLETE int +// OBSOLETE sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type) +// OBSOLETE { +// OBSOLETE CORE_ADDR dcr; +// OBSOLETE +// OBSOLETE dcr = read_register (DCR_REGNUM); +// OBSOLETE +// OBSOLETE if (!(dcr & DDA1_ENABLE)) +// OBSOLETE { +// OBSOLETE write_register (DDA1_REGNUM, addr); +// OBSOLETE dcr &= ~(DDA1_ASI_MASK | DDV_TYPE_MASK); +// OBSOLETE dcr |= (DDA1_SUP_ASI | DDA1_ENABLE); +// OBSOLETE if (type == 1) +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_LOAD & (~DDV_COND & ~DDV_MASK)); +// OBSOLETE } +// OBSOLETE else if (type == 0) +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_STORE & (~DDV_COND & ~DDV_MASK)); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_ACCESS); +// OBSOLETE } +// OBSOLETE write_register (DCR_REGNUM, dcr); +// OBSOLETE } +// OBSOLETE else if (!(dcr & DDA2_ENABLE)) +// OBSOLETE { +// OBSOLETE write_register (DDA2_REGNUM, addr); +// OBSOLETE dcr &= ~(DDA2_ASI_MASK & DDV_TYPE_MASK); +// OBSOLETE dcr |= (DDA2_SUP_ASI | DDA2_ENABLE); +// OBSOLETE if (type == 1) +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_LOAD & ~DDV_COND & ~DDV_MASK); +// OBSOLETE } +// OBSOLETE else if (type == 0) +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_STORE & ~DDV_COND & ~DDV_MASK); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE write_register (DDV1_REGNUM, 0); +// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff); +// OBSOLETE dcr |= (DDV_TYPE_ACCESS); +// OBSOLETE } +// OBSOLETE write_register (DCR_REGNUM, dcr); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type) +// OBSOLETE { +// OBSOLETE CORE_ADDR dcr, dda1, dda2; +// OBSOLETE +// OBSOLETE dcr = read_register (DCR_REGNUM); +// OBSOLETE dda1 = read_register (DDA1_REGNUM); +// OBSOLETE dda2 = read_register (DDA2_REGNUM); +// OBSOLETE +// OBSOLETE if ((dcr & DDA1_ENABLE) && addr == dda1) +// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA1_ENABLE)); +// OBSOLETE else if ((dcr & DDA2_ENABLE) && addr == dda2) +// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA2_ENABLE)); +// OBSOLETE else +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len) +// OBSOLETE { +// OBSOLETE CORE_ADDR dcr; +// OBSOLETE +// OBSOLETE dcr = read_register (DCR_REGNUM); +// OBSOLETE +// OBSOLETE if (!(dcr & DIA1_ENABLE)) +// OBSOLETE { +// OBSOLETE write_register (DIA1_REGNUM, addr); +// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA1_ENABLE | DIA1_SUP_MODE)); +// OBSOLETE } +// OBSOLETE else if (!(dcr & DIA2_ENABLE)) +// OBSOLETE { +// OBSOLETE write_register (DIA2_REGNUM, addr); +// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA2_ENABLE | DIA2_SUP_MODE)); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow) +// OBSOLETE { +// OBSOLETE CORE_ADDR dcr, dia1, dia2; +// OBSOLETE +// OBSOLETE dcr = read_register (DCR_REGNUM); +// OBSOLETE dia1 = read_register (DIA1_REGNUM); +// OBSOLETE dia2 = read_register (DIA2_REGNUM); +// OBSOLETE +// OBSOLETE if ((dcr & DIA1_ENABLE) && addr == dia1) +// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA1_ENABLE)); +// OBSOLETE else if ((dcr & DIA2_ENABLE) && addr == dia2) +// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA2_ENABLE)); +// OBSOLETE else +// OBSOLETE return -1; +// OBSOLETE +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE sparclite_check_watch_resources (int type, int cnt, int ot) +// OBSOLETE { +// OBSOLETE /* Watchpoints not supported on simulator. */ +// OBSOLETE if (strcmp (target_shortname, "sim") == 0) +// OBSOLETE return 0; +// OBSOLETE +// OBSOLETE if (type == bp_hardware_breakpoint) +// OBSOLETE { +// OBSOLETE if (TARGET_HW_BREAK_LIMIT == 0) +// OBSOLETE return 0; +// OBSOLETE else if (cnt <= TARGET_HW_BREAK_LIMIT) +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (TARGET_HW_WATCH_LIMIT == 0) +// OBSOLETE return 0; +// OBSOLETE else if (ot) +// OBSOLETE return -1; +// OBSOLETE else if (cnt <= TARGET_HW_WATCH_LIMIT) +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE sparclite_stopped_data_address (void) +// OBSOLETE { +// OBSOLETE CORE_ADDR dsr, dda1, dda2; +// OBSOLETE +// OBSOLETE dsr = read_register (DSR_REGNUM); +// OBSOLETE dda1 = read_register (DDA1_REGNUM); +// OBSOLETE dda2 = read_register (DDA2_REGNUM); +// OBSOLETE +// OBSOLETE if (dsr & 0x10) +// OBSOLETE return dda1; +// OBSOLETE else if (dsr & 0x20) +// OBSOLETE return dda2; +// OBSOLETE else +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static struct serial * +// OBSOLETE open_tty (char *name) +// OBSOLETE { +// OBSOLETE struct serial *desc; +// OBSOLETE +// OBSOLETE desc = serial_open (name); +// OBSOLETE if (!desc) +// OBSOLETE perror_with_name (name); +// OBSOLETE +// OBSOLETE if (baud_rate != -1) +// OBSOLETE { +// OBSOLETE if (serial_setbaudrate (desc, baud_rate)) +// OBSOLETE { +// OBSOLETE serial_close (desc); +// OBSOLETE perror_with_name (name); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE serial_raw (desc); +// OBSOLETE +// OBSOLETE serial_flush_input (desc); +// OBSOLETE +// OBSOLETE return desc; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read a single character from the remote end, masking it down to 7 bits. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE readchar (struct serial *desc, int timeout) +// OBSOLETE { +// OBSOLETE int ch; +// OBSOLETE char s[10]; +// OBSOLETE +// OBSOLETE ch = serial_readchar (desc, timeout); +// OBSOLETE +// OBSOLETE switch (ch) +// OBSOLETE { +// OBSOLETE case SERIAL_EOF: +// OBSOLETE error ("SPARClite remote connection closed"); +// OBSOLETE case SERIAL_ERROR: +// OBSOLETE perror_with_name ("SPARClite communication error"); +// OBSOLETE case SERIAL_TIMEOUT: +// OBSOLETE error ("SPARClite remote timeout"); +// OBSOLETE default: +// OBSOLETE if (remote_debug > 0) +// OBSOLETE { +// OBSOLETE sprintf (s, "[%02x]", ch & 0xff); +// OBSOLETE puts_debug ("read -->", s, "<--"); +// OBSOLETE } +// OBSOLETE return ch; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE debug_serial_write (struct serial *desc, char *buf, int len) +// OBSOLETE { +// OBSOLETE char s[10]; +// OBSOLETE +// OBSOLETE serial_write (desc, buf, len); +// OBSOLETE if (remote_debug > 0) +// OBSOLETE { +// OBSOLETE while (len-- > 0) +// OBSOLETE { +// OBSOLETE sprintf (s, "[%02x]", *buf & 0xff); +// OBSOLETE puts_debug ("Sent -->", s, "<--"); +// OBSOLETE buf++; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE static int +// OBSOLETE send_resp (struct serial *desc, char c) +// OBSOLETE { +// OBSOLETE debug_serial_write (desc, &c, 1); +// OBSOLETE return readchar (desc, remote_timeout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE close_tty (void *ignore) +// OBSOLETE { +// OBSOLETE if (!remote_desc) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE serial_close (remote_desc); +// OBSOLETE +// OBSOLETE remote_desc = NULL; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE static int +// OBSOLETE recv_udp_buf (int fd, unsigned char *buf, int len, int timeout) +// OBSOLETE { +// OBSOLETE int cc; +// OBSOLETE fd_set readfds; +// OBSOLETE +// OBSOLETE FD_ZERO (&readfds); +// OBSOLETE FD_SET (fd, &readfds); +// OBSOLETE +// OBSOLETE if (timeout >= 0) +// OBSOLETE { +// OBSOLETE struct timeval timebuf; +// OBSOLETE +// OBSOLETE timebuf.tv_sec = timeout; +// OBSOLETE timebuf.tv_usec = 0; +// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, &timebuf); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, 0); +// OBSOLETE +// OBSOLETE if (cc == 0) +// OBSOLETE return 0; +// OBSOLETE +// OBSOLETE if (cc != 1) +// OBSOLETE perror_with_name ("recv_udp_buf: Bad return value from select:"); +// OBSOLETE +// OBSOLETE cc = recv (fd, buf, len, 0); +// OBSOLETE +// OBSOLETE if (cc < 0) +// OBSOLETE perror_with_name ("Got an error from recv: "); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static int +// OBSOLETE send_udp_buf (int fd, unsigned char *buf, int len) +// OBSOLETE { +// OBSOLETE int cc; +// OBSOLETE +// OBSOLETE cc = send (fd, buf, len, 0); +// OBSOLETE +// OBSOLETE if (cc == len) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (cc < 0) +// OBSOLETE perror_with_name ("Got an error from send: "); +// OBSOLETE +// OBSOLETE error ("Short count in send: tried %d, sent %d\n", len, cc); +// OBSOLETE } +// OBSOLETE #endif /* HAVE_SOCKETS */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_open (char *name, int from_tty) +// OBSOLETE { +// OBSOLETE struct cleanup *old_chain; +// OBSOLETE int c; +// OBSOLETE char *p; +// OBSOLETE +// OBSOLETE if (!name) +// OBSOLETE error ("You need to specify what device or hostname is associated with the SparcLite board."); +// OBSOLETE +// OBSOLETE target_preopen (from_tty); +// OBSOLETE +// OBSOLETE unpush_target (&sparclite_ops); +// OBSOLETE +// OBSOLETE if (remote_target_name) +// OBSOLETE xfree (remote_target_name); +// OBSOLETE +// OBSOLETE remote_target_name = xstrdup (name); +// OBSOLETE +// OBSOLETE /* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can +// OBSOLETE mean either a serial port on a terminal server, or the IP address of a +// OBSOLETE SPARClite demo board. If there's no colon, then it pretty much has to be +// OBSOLETE a local device (except for DOS... grrmble) */ +// OBSOLETE +// OBSOLETE p = strchr (name, ' '); +// OBSOLETE +// OBSOLETE if (p) +// OBSOLETE { +// OBSOLETE *p++ = '\000'; +// OBSOLETE while ((*p != '\000') && isspace (*p)) +// OBSOLETE p++; +// OBSOLETE +// OBSOLETE if (strncmp (name, "serial", strlen (name)) == 0) +// OBSOLETE serial_flag = 1; +// OBSOLETE else if (strncmp (name, "udp", strlen (name)) == 0) +// OBSOLETE serial_flag = 0; +// OBSOLETE else +// OBSOLETE error ("Must specify either `serial' or `udp'."); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE p = name; +// OBSOLETE +// OBSOLETE if (!strchr (name, ':')) +// OBSOLETE serial_flag = 1; /* No colon is unambiguous (local device) */ +// OBSOLETE else +// OBSOLETE error ("Usage: target sparclite serial /dev/ttyb\n\ +// OBSOLETE or: target sparclite udp host"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (serial_flag) +// OBSOLETE { +// OBSOLETE remote_desc = open_tty (p); +// OBSOLETE +// OBSOLETE old_chain = make_cleanup (close_tty, 0 /*ignore*/); +// OBSOLETE +// OBSOLETE c = send_resp (remote_desc, 0x00); +// OBSOLETE +// OBSOLETE if (c != 0xaa) +// OBSOLETE error ("Unknown response (0x%x) from SparcLite. Try resetting the board.", +// OBSOLETE c); +// OBSOLETE +// OBSOLETE c = send_resp (remote_desc, 0x55); +// OBSOLETE +// OBSOLETE if (c != 0x55) +// OBSOLETE error ("Sparclite appears to be ill."); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE struct hostent *he; +// OBSOLETE struct sockaddr_in sockaddr; +// OBSOLETE unsigned char buffer[100]; +// OBSOLETE int cc; +// OBSOLETE +// OBSOLETE /* Setup the socket. Must be raw UDP. */ +// OBSOLETE +// OBSOLETE he = gethostbyname (p); +// OBSOLETE +// OBSOLETE if (!he) +// OBSOLETE error ("No such host %s.", p); +// OBSOLETE +// OBSOLETE udp_fd = socket (PF_INET, SOCK_DGRAM, 0); +// OBSOLETE +// OBSOLETE old_chain = make_cleanup (close, udp_fd); +// OBSOLETE +// OBSOLETE sockaddr.sin_family = PF_INET; +// OBSOLETE sockaddr.sin_port = htons (7000); +// OBSOLETE memcpy (&sockaddr.sin_addr.s_addr, he->h_addr, sizeof (struct in_addr)); +// OBSOLETE +// OBSOLETE if (connect (udp_fd, &sockaddr, sizeof (sockaddr))) +// OBSOLETE perror_with_name ("Connect failed"); +// OBSOLETE +// OBSOLETE buffer[0] = 0x5; +// OBSOLETE buffer[1] = 0; +// OBSOLETE +// OBSOLETE send_udp_buf (udp_fd, buffer, 2); /* Request version */ +// OBSOLETE cc = recv_udp_buf (udp_fd, buffer, sizeof (buffer), 5); /* Get response */ +// OBSOLETE if (cc == 0) +// OBSOLETE error ("SPARClite isn't responding."); +// OBSOLETE +// OBSOLETE if (cc < 3) +// OBSOLETE error ("SPARClite appears to be ill."); +// OBSOLETE #else +// OBSOLETE error ("UDP downloading is not supported for DOS hosts."); +// OBSOLETE #endif /* HAVE_SOCKETS */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE printf_unfiltered ("[SPARClite appears to be alive]\n"); +// OBSOLETE +// OBSOLETE push_target (&sparclite_ops); +// OBSOLETE +// OBSOLETE discard_cleanups (old_chain); +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_close (int quitting) +// OBSOLETE { +// OBSOLETE if (serial_flag) +// OBSOLETE close_tty (0); +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE else if (udp_fd != -1) +// OBSOLETE close (udp_fd); +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define LOAD_ADDRESS 0x40000000 +// OBSOLETE +// OBSOLETE static void +// OBSOLETE download (char *target_name, char *args, int from_tty, +// OBSOLETE void (*write_routine) (bfd *from_bfd, asection *from_sec, +// OBSOLETE file_ptr from_addr, bfd_vma to_addr, int len), +// OBSOLETE void (*start_routine) (bfd_vma entry)) +// OBSOLETE { +// OBSOLETE struct cleanup *old_chain; +// OBSOLETE asection *section; +// OBSOLETE bfd *pbfd; +// OBSOLETE bfd_vma entry; +// OBSOLETE int i; +// OBSOLETE #define WRITESIZE 1024 +// OBSOLETE char *filename; +// OBSOLETE int quiet; +// OBSOLETE int nostart; +// OBSOLETE +// OBSOLETE quiet = 0; +// OBSOLETE nostart = 0; +// OBSOLETE filename = NULL; +// OBSOLETE +// OBSOLETE while (*args != '\000') +// OBSOLETE { +// OBSOLETE char *arg; +// OBSOLETE +// OBSOLETE while (isspace (*args)) +// OBSOLETE args++; +// OBSOLETE +// OBSOLETE arg = args; +// OBSOLETE +// OBSOLETE while ((*args != '\000') && !isspace (*args)) +// OBSOLETE args++; +// OBSOLETE +// OBSOLETE if (*args != '\000') +// OBSOLETE *args++ = '\000'; +// OBSOLETE +// OBSOLETE if (*arg != '-') +// OBSOLETE filename = arg; +// OBSOLETE else if (strncmp (arg, "-quiet", strlen (arg)) == 0) +// OBSOLETE quiet = 1; +// OBSOLETE else if (strncmp (arg, "-nostart", strlen (arg)) == 0) +// OBSOLETE nostart = 1; +// OBSOLETE else +// OBSOLETE error ("unknown option `%s'", arg); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!filename) +// OBSOLETE filename = get_exec_file (1); +// OBSOLETE +// OBSOLETE pbfd = bfd_openr (filename, gnutarget); +// OBSOLETE if (pbfd == NULL) +// OBSOLETE { +// OBSOLETE perror_with_name (filename); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE old_chain = make_cleanup_bfd_close (pbfd); +// OBSOLETE +// OBSOLETE if (!bfd_check_format (pbfd, bfd_object)) +// OBSOLETE error ("\"%s\" is not an object file: %s", filename, +// OBSOLETE bfd_errmsg (bfd_get_error ())); +// OBSOLETE +// OBSOLETE for (section = pbfd->sections; section; section = section->next) +// OBSOLETE { +// OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_LOAD) +// OBSOLETE { +// OBSOLETE bfd_vma section_address; +// OBSOLETE bfd_size_type section_size; +// OBSOLETE file_ptr fptr; +// OBSOLETE const char *section_name; +// OBSOLETE +// OBSOLETE section_name = bfd_get_section_name (pbfd, section); +// OBSOLETE +// OBSOLETE section_address = bfd_get_section_vma (pbfd, section); +// OBSOLETE +// OBSOLETE /* Adjust sections from a.out files, since they don't +// OBSOLETE carry their addresses with. */ +// OBSOLETE if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour) +// OBSOLETE { +// OBSOLETE if (strcmp (section_name, ".text") == 0) +// OBSOLETE section_address = bfd_get_start_address (pbfd); +// OBSOLETE else if (strcmp (section_name, ".data") == 0) +// OBSOLETE { +// OBSOLETE /* Read the first 8 bytes of the data section. +// OBSOLETE There should be the string 'DaTa' followed by +// OBSOLETE a word containing the actual section address. */ +// OBSOLETE struct data_marker +// OBSOLETE { +// OBSOLETE char signature[4]; /* 'DaTa' */ +// OBSOLETE unsigned char sdata[4]; /* &sdata */ +// OBSOLETE } +// OBSOLETE marker; +// OBSOLETE bfd_get_section_contents (pbfd, section, &marker, 0, +// OBSOLETE sizeof (marker)); +// OBSOLETE if (strncmp (marker.signature, "DaTa", 4) == 0) +// OBSOLETE { +// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) +// OBSOLETE section_address = bfd_getb32 (marker.sdata); +// OBSOLETE else +// OBSOLETE section_address = bfd_getl32 (marker.sdata); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE section_size = bfd_get_section_size_before_reloc (section); +// OBSOLETE +// OBSOLETE if (!quiet) +// OBSOLETE printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n", +// OBSOLETE bfd_get_section_name (pbfd, section), +// OBSOLETE section_address, +// OBSOLETE section_size); +// OBSOLETE +// OBSOLETE fptr = 0; +// OBSOLETE while (section_size > 0) +// OBSOLETE { +// OBSOLETE int count; +// OBSOLETE static char inds[] = "|/-\\"; +// OBSOLETE static int k = 0; +// OBSOLETE +// OBSOLETE QUIT; +// OBSOLETE +// OBSOLETE count = min (section_size, WRITESIZE); +// OBSOLETE +// OBSOLETE write_routine (pbfd, section, fptr, section_address, count); +// OBSOLETE +// OBSOLETE if (!quiet) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\r%c", inds[k++ % 4]); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE section_address += count; +// OBSOLETE fptr += count; +// OBSOLETE section_size -= count; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (!nostart) +// OBSOLETE { +// OBSOLETE entry = bfd_get_start_address (pbfd); +// OBSOLETE +// OBSOLETE if (!quiet) +// OBSOLETE printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry); +// OBSOLETE +// OBSOLETE start_routine (entry); +// OBSOLETE } +// OBSOLETE +// OBSOLETE do_cleanups (old_chain); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_serial_start (bfd_vma entry) +// OBSOLETE { +// OBSOLETE char buffer[5]; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE buffer[0] = 0x03; +// OBSOLETE store_unsigned_integer (buffer + 1, 4, entry); +// OBSOLETE +// OBSOLETE debug_serial_write (remote_desc, buffer, 1 + 4); +// OBSOLETE i = readchar (remote_desc, remote_timeout); +// OBSOLETE if (i != 0x55) +// OBSOLETE error ("Can't start SparcLite. Error code %d\n", i); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, +// OBSOLETE bfd_vma to_addr, int len) +// OBSOLETE { +// OBSOLETE char buffer[4 + 4 + WRITESIZE]; /* addr + len + data */ +// OBSOLETE unsigned char checksum; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE store_unsigned_integer (buffer, 4, to_addr); /* Address */ +// OBSOLETE store_unsigned_integer (buffer + 4, 4, len); /* Length */ +// OBSOLETE +// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 8, from_addr, len); +// OBSOLETE +// OBSOLETE checksum = 0; +// OBSOLETE for (i = 0; i < len; i++) +// OBSOLETE checksum += buffer[8 + i]; +// OBSOLETE +// OBSOLETE i = send_resp (remote_desc, 0x01); +// OBSOLETE +// OBSOLETE if (i != 0x5a) +// OBSOLETE error ("Bad response from load command (0x%x)", i); +// OBSOLETE +// OBSOLETE debug_serial_write (remote_desc, buffer, 4 + 4 + len); +// OBSOLETE i = readchar (remote_desc, remote_timeout); +// OBSOLETE +// OBSOLETE if (i != checksum) +// OBSOLETE error ("Bad checksum from load command (0x%x)", i); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE +// OBSOLETE static unsigned short +// OBSOLETE calc_checksum (unsigned char *buffer, int count) +// OBSOLETE { +// OBSOLETE unsigned short checksum; +// OBSOLETE +// OBSOLETE checksum = 0; +// OBSOLETE for (; count > 0; count -= 2, buffer += 2) +// OBSOLETE checksum += (*buffer << 8) | *(buffer + 1); +// OBSOLETE +// OBSOLETE if (count != 0) +// OBSOLETE checksum += *buffer << 8; +// OBSOLETE +// OBSOLETE return checksum; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_udp_start (bfd_vma entry) +// OBSOLETE { +// OBSOLETE unsigned char buffer[6]; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE buffer[0] = 0x3; +// OBSOLETE buffer[1] = 0; +// OBSOLETE buffer[2] = entry >> 24; +// OBSOLETE buffer[3] = entry >> 16; +// OBSOLETE buffer[4] = entry >> 8; +// OBSOLETE buffer[5] = entry; +// OBSOLETE +// OBSOLETE send_udp_buf (udp_fd, buffer, 6); /* Send start addr */ +// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof (buffer), -1); /* Get response */ +// OBSOLETE +// OBSOLETE if (i < 1 || buffer[0] != 0x55) +// OBSOLETE error ("Failed to take start address."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr, +// OBSOLETE bfd_vma to_addr, int len) +// OBSOLETE { +// OBSOLETE unsigned char buffer[2000]; +// OBSOLETE unsigned short checksum; +// OBSOLETE static int pkt_num = 0; +// OBSOLETE static unsigned long old_addr = -1; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE if (to_addr != old_addr) +// OBSOLETE { +// OBSOLETE buffer[0] = 0x1; /* Load command */ +// OBSOLETE buffer[1] = 0x1; /* Loading address */ +// OBSOLETE buffer[2] = to_addr >> 24; +// OBSOLETE buffer[3] = to_addr >> 16; +// OBSOLETE buffer[4] = to_addr >> 8; +// OBSOLETE buffer[5] = to_addr; +// OBSOLETE +// OBSOLETE checksum = 0; +// OBSOLETE for (i = 0; i < 6; i++) +// OBSOLETE checksum += buffer[i]; +// OBSOLETE checksum &= 0xff; +// OBSOLETE +// OBSOLETE send_udp_buf (udp_fd, buffer, 6); +// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, -1); +// OBSOLETE +// OBSOLETE if (i < 1) +// OBSOLETE error ("Got back short checksum for load addr."); +// OBSOLETE +// OBSOLETE if (checksum != buffer[0]) +// OBSOLETE error ("Got back bad checksum for load addr."); +// OBSOLETE +// OBSOLETE pkt_num = 0; /* Load addr resets packet seq # */ +// OBSOLETE old_addr = to_addr; +// OBSOLETE } +// OBSOLETE +// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 6, from_addr, +// OBSOLETE len); +// OBSOLETE +// OBSOLETE checksum = calc_checksum (buffer + 6, len); +// OBSOLETE +// OBSOLETE buffer[0] = 0x1; /* Load command */ +// OBSOLETE buffer[1] = 0x2; /* Loading data */ +// OBSOLETE buffer[2] = pkt_num >> 8; +// OBSOLETE buffer[3] = pkt_num; +// OBSOLETE buffer[4] = checksum >> 8; +// OBSOLETE buffer[5] = checksum; +// OBSOLETE +// OBSOLETE send_udp_buf (udp_fd, buffer, len + 6); +// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, 3); +// OBSOLETE +// OBSOLETE if (i == 0) +// OBSOLETE { +// OBSOLETE fprintf_unfiltered (gdb_stderr, "send_data: timeout sending %d bytes to address 0x%x retrying\n", len, to_addr); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (buffer[0] != 0xff) +// OBSOLETE error ("Got back bad response for load data."); +// OBSOLETE +// OBSOLETE old_addr += len; +// OBSOLETE pkt_num++; +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* HAVE_SOCKETS */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclite_download (char *filename, int from_tty) +// OBSOLETE { +// OBSOLETE if (!serial_flag) +// OBSOLETE #ifdef HAVE_SOCKETS +// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_udp_write, +// OBSOLETE sparclite_udp_start); +// OBSOLETE #else +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* sparclite_open should prevent this! */ +// OBSOLETE #endif +// OBSOLETE else +// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_serial_write, +// OBSOLETE sparclite_serial_start); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Set up the sparclite target vector. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE init_sparclite_ops (void) +// OBSOLETE { +// OBSOLETE sparclite_ops.to_shortname = "sparclite"; +// OBSOLETE sparclite_ops.to_longname = "SPARClite download target"; +// OBSOLETE sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\ +// OBSOLETE Specify the device it is connected to (e.g. /dev/ttya)."; +// OBSOLETE sparclite_ops.to_open = sparclite_open; +// OBSOLETE sparclite_ops.to_close = sparclite_close; +// OBSOLETE sparclite_ops.to_load = sparclite_download; +// OBSOLETE sparclite_ops.to_stratum = download_stratum; +// OBSOLETE sparclite_ops.to_magic = OPS_MAGIC; +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_sparcl_tdep (void) +// OBSOLETE { +// OBSOLETE init_sparclite_ops (); +// OBSOLETE add_target (&sparclite_ops); +// OBSOLETE } diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c index fa2ca1e..9247131 100644 --- a/gdb/sparclet-rom.c +++ b/gdb/sparclet-rom.c @@ -1,316 +1,316 @@ -/* Remote target glue for the SPARC Sparclet ROM monitor. - - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free - Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "monitor.h" -#include "serial.h" -#include "srec.h" -#include "symtab.h" -#include "symfile.h" /* for generic_load */ -#include "regcache.h" -#include <time.h> - -extern void report_transfer_performance (unsigned long, time_t, time_t); - -static struct target_ops sparclet_ops; - -static void sparclet_open (char *args, int from_tty); - -/* This array of registers need to match the indexes used by GDB. - This exists because the various ROM monitors use different strings - than does GDB, and don't necessarily support all the registers - either. So, typing "info reg sp" becomes a "r30". */ - -/*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM - 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2 - 0000010 - INS LOCALS OUTS GLOBALS - 0 0x00000000 0x00000000 0x00000000 0x00000000 - 1 0x00000000 0x00000000 0x00000000 0x00000000 - 2 0x00000000 0x00000000 0x00000000 0x00000000 - 3 0x00000000 0x00000000 0x00000000 0x00000000 - 4 0x00000000 0x00000000 0x00000000 0x00000000 - 5 0x00000000 0x00001000 0x00000000 0x00000000 - 6 0x00000000 0x00000000 0x123f0000 0x00000000 - 7 0x00000000 0x00000000 0x00000000 0x00000000 - pc: 0x12010000 0x00000000 unimp - npc: 0x12010004 0x00001000 unimp 0x1000 - tbr: 0x00000000 - y: 0x00000000 - */ -/* these correspond to the offsets from tm-* files from config directories */ - -/* is wim part of psr?? */ -/* monitor wants lower case */ -static char *sparclet_regnames[] = { - "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", - "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", - "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", - - "", "", "", "", "", "", "", "", /* no FPU regs */ - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", - /* no CPSR, FPSR */ - "y", "psr", "wim", "tbr", "pc", "npc", "", "", - - "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", - - /* ASR15 ASR19 (don't display them) */ - "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", -/* - "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", - "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", - "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", - "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", - "apsr", - */ -}; - - - -/* Function: sparclet_supply_register - Just returns with no action. - This function is required, because parse_register_dump (monitor.c) - expects to be able to call it. If we don't supply something, it will - call a null pointer and core-dump. Since this function does not - actually do anything, GDB will request the registers individually. */ - -static void -sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen) -{ - return; -} - -static void -sparclet_load (struct serial *desc, char *file, int hashmark) -{ - bfd *abfd; - asection *s; - int i; - CORE_ADDR load_offset; - time_t start_time, end_time; - unsigned long data_count = 0; - - /* enable user to specify address for downloading as 2nd arg to load */ - - i = sscanf (file, "%*s 0x%lx", &load_offset); - if (i >= 1) - { - char *p; - - for (p = file; *p != '\000' && !isspace (*p); p++); - - *p = '\000'; - } - else - load_offset = 0; - - abfd = bfd_openr (file, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", file); - return; - } - - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); - return; - } - - start_time = time (NULL); - - for (s = abfd->sections; s; s = s->next) - if (s->flags & SEC_LOAD) - { - bfd_size_type section_size; - bfd_vma vma; - - vma = bfd_get_section_vma (abfd, s) + load_offset; - section_size = bfd_section_size (abfd, s); - - data_count += section_size; - - printf_filtered ("%s\t: 0x%4x .. 0x%4x ", - bfd_get_section_name (abfd, s), vma, - vma + section_size); - gdb_flush (gdb_stdout); - - monitor_printf ("load c r %x %x\r", vma, section_size); - - monitor_expect ("load: loading ", NULL, 0); - monitor_expect ("\r", NULL, 0); - - for (i = 0; i < section_size; i += 2048) - { - int numbytes; - char buf[2048]; - - numbytes = min (sizeof buf, section_size - i); - - bfd_get_section_contents (abfd, s, buf, i, numbytes); - - serial_write (desc, buf, numbytes); - - if (hashmark) - { - putchar_unfiltered ('#'); - gdb_flush (gdb_stdout); - } - } /* Per-packet (or S-record) loop */ - - monitor_expect_prompt (NULL, 0); - - putchar_unfiltered ('\n'); - } /* Loadable sections */ - - monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd)); - monitor_expect_prompt (NULL, 0); - monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4); - monitor_expect_prompt (NULL, 0); - - monitor_printf ("run\r"); - - end_time = time (NULL); - - if (hashmark) - putchar_unfiltered ('\n'); - - report_transfer_performance (data_count, start_time, end_time); - - pop_target (); - push_remote_target (monitor_get_dev_name (), 1); - - throw_exception (RETURN_QUIT); -} - -/* Define the monitor command strings. Since these are passed directly - through to a printf style function, we may include formatting - strings. We also need a CR or LF on the end. */ - -/* need to pause the monitor for timing reasons, so slow it down */ - -static char *sparclet_inits[] = -{"\n\r\r\n", NULL}; - -static struct monitor_ops sparclet_cmds; - -static void -init_sparclet_cmds (void) -{ - sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR | - MO_HEX_PREFIX | - MO_NO_ECHO_ON_OPEN | - MO_NO_ECHO_ON_SETMEM | - MO_RUN_FIRST_TIME | - MO_GETMEM_READ_SINGLE; /* flags */ - sparclet_cmds.init = sparclet_inits; /* Init strings */ - sparclet_cmds.cont = "cont\r"; /* continue command */ - sparclet_cmds.step = "step\r"; /* single step */ - sparclet_cmds.stop = "\r"; /* break interrupts the program */ - sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */ - sparclet_cmds.clr_break = "-bp %x\r"; /* can't use "br" because only 2 hw bps are supported */ - sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */ - "-bp\r"; /* clear all breakpoints */ - sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */ - /* can't use "fi" because it takes words, not bytes */ - /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */ - sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */ - sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */ - sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */ - sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */ - sparclet_cmds.setmem.resp_delim = NULL; /*": " *//* setmem.resp_delim */ - sparclet_cmds.setmem.term = NULL; /*"? " *//* setmem.term */ - sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" *//* setmem.term_cmd */ - /* since the parsing of multiple bytes is difficult due to - interspersed addresses, we'll only read 1 value at a time, - even tho these can handle a count */ - /* we can use -n to set count to read, but may have to parse? */ - sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */ - sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */ - sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */ - sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */ - sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */ - sparclet_cmds.getmem.term = NULL; /* getmem.term */ - sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */ - sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */ - sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */ - sparclet_cmds.setreg.term = NULL; /* setreg.term */ - sparclet_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */ - sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */ - sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */ - sparclet_cmds.getreg.term = NULL; /* getreg.term */ - sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */ - sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */ - sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */ - sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */ - sparclet_cmds.load_routine = sparclet_load; /* load_routine */ - sparclet_cmds.load = NULL; /* download command (srecs on console) */ - sparclet_cmds.loadresp = NULL; /* load response */ - sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */ - /* yikes! gdb core dumps without this delimitor!! */ - sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */ - sparclet_cmds.cmd_end = NULL; /* optional command terminator */ - sparclet_cmds.target = &sparclet_ops; /* target operations */ - sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ - sparclet_cmds.regnames = sparclet_regnames; /* registers names */ - sparclet_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ -}; - -static void -sparclet_open (char *args, int from_tty) -{ - monitor_open (args, &sparclet_cmds, from_tty); -} - -void -_initialize_sparclet (void) -{ - int i; - init_sparclet_cmds (); - - for (i = 0; i < NUM_REGS; i++) - if (sparclet_regnames[i][0] == 'c' || - sparclet_regnames[i][0] == 'a') - sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */ - - sparclet_regnames[0] = 0; /* mon won't report %G0 */ - - init_monitor_ops (&sparclet_ops); - sparclet_ops.to_shortname = "sparclet"; /* for the target command */ - sparclet_ops.to_longname = "SPARC Sparclet monitor"; - /* use SW breaks; target only supports 2 HW breakpoints */ - sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint; - sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint; - - sparclet_ops.to_doc = - "Use a board running the Sparclet debug monitor.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya)."; - - sparclet_ops.to_open = sparclet_open; - add_target (&sparclet_ops); -} +// OBSOLETE /* Remote target glue for the SPARC Sparclet ROM monitor. +// OBSOLETE +// OBSOLETE Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free +// OBSOLETE Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "monitor.h" +// OBSOLETE #include "serial.h" +// OBSOLETE #include "srec.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "symfile.h" /* for generic_load */ +// OBSOLETE #include "regcache.h" +// OBSOLETE #include <time.h> +// OBSOLETE +// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t); +// OBSOLETE +// OBSOLETE static struct target_ops sparclet_ops; +// OBSOLETE +// OBSOLETE static void sparclet_open (char *args, int from_tty); +// OBSOLETE +// OBSOLETE /* This array of registers need to match the indexes used by GDB. +// OBSOLETE This exists because the various ROM monitors use different strings +// OBSOLETE than does GDB, and don't necessarily support all the registers +// OBSOLETE either. So, typing "info reg sp" becomes a "r30". */ +// OBSOLETE +// OBSOLETE /*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM +// OBSOLETE 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2 +// OBSOLETE 0000010 +// OBSOLETE INS LOCALS OUTS GLOBALS +// OBSOLETE 0 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE 1 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE 2 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE 3 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE 4 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE 5 0x00000000 0x00001000 0x00000000 0x00000000 +// OBSOLETE 6 0x00000000 0x00000000 0x123f0000 0x00000000 +// OBSOLETE 7 0x00000000 0x00000000 0x00000000 0x00000000 +// OBSOLETE pc: 0x12010000 0x00000000 unimp +// OBSOLETE npc: 0x12010004 0x00001000 unimp 0x1000 +// OBSOLETE tbr: 0x00000000 +// OBSOLETE y: 0x00000000 +// OBSOLETE */ +// OBSOLETE /* these correspond to the offsets from tm-* files from config directories */ +// OBSOLETE +// OBSOLETE /* is wim part of psr?? */ +// OBSOLETE /* monitor wants lower case */ +// OBSOLETE static char *sparclet_regnames[] = { +// OBSOLETE "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", +// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", +// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", +// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", +// OBSOLETE +// OBSOLETE "", "", "", "", "", "", "", "", /* no FPU regs */ +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE "", "", "", "", "", "", "", "", +// OBSOLETE /* no CPSR, FPSR */ +// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", +// OBSOLETE +// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", +// OBSOLETE +// OBSOLETE /* ASR15 ASR19 (don't display them) */ +// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", +// OBSOLETE /* +// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", +// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", +// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", +// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", +// OBSOLETE "apsr", +// OBSOLETE */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Function: sparclet_supply_register +// OBSOLETE Just returns with no action. +// OBSOLETE This function is required, because parse_register_dump (monitor.c) +// OBSOLETE expects to be able to call it. If we don't supply something, it will +// OBSOLETE call a null pointer and core-dump. Since this function does not +// OBSOLETE actually do anything, GDB will request the registers individually. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen) +// OBSOLETE { +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclet_load (struct serial *desc, char *file, int hashmark) +// OBSOLETE { +// OBSOLETE bfd *abfd; +// OBSOLETE asection *s; +// OBSOLETE int i; +// OBSOLETE CORE_ADDR load_offset; +// OBSOLETE time_t start_time, end_time; +// OBSOLETE unsigned long data_count = 0; +// OBSOLETE +// OBSOLETE /* enable user to specify address for downloading as 2nd arg to load */ +// OBSOLETE +// OBSOLETE i = sscanf (file, "%*s 0x%lx", &load_offset); +// OBSOLETE if (i >= 1) +// OBSOLETE { +// OBSOLETE char *p; +// OBSOLETE +// OBSOLETE for (p = file; *p != '\000' && !isspace (*p); p++); +// OBSOLETE +// OBSOLETE *p = '\000'; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE load_offset = 0; +// OBSOLETE +// OBSOLETE abfd = bfd_openr (file, 0); +// OBSOLETE if (!abfd) +// OBSOLETE { +// OBSOLETE printf_filtered ("Unable to open file %s\n", file); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0) +// OBSOLETE { +// OBSOLETE printf_filtered ("File is not an object file\n"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE start_time = time (NULL); +// OBSOLETE +// OBSOLETE for (s = abfd->sections; s; s = s->next) +// OBSOLETE if (s->flags & SEC_LOAD) +// OBSOLETE { +// OBSOLETE bfd_size_type section_size; +// OBSOLETE bfd_vma vma; +// OBSOLETE +// OBSOLETE vma = bfd_get_section_vma (abfd, s) + load_offset; +// OBSOLETE section_size = bfd_section_size (abfd, s); +// OBSOLETE +// OBSOLETE data_count += section_size; +// OBSOLETE +// OBSOLETE printf_filtered ("%s\t: 0x%4x .. 0x%4x ", +// OBSOLETE bfd_get_section_name (abfd, s), vma, +// OBSOLETE vma + section_size); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE +// OBSOLETE monitor_printf ("load c r %x %x\r", vma, section_size); +// OBSOLETE +// OBSOLETE monitor_expect ("load: loading ", NULL, 0); +// OBSOLETE monitor_expect ("\r", NULL, 0); +// OBSOLETE +// OBSOLETE for (i = 0; i < section_size; i += 2048) +// OBSOLETE { +// OBSOLETE int numbytes; +// OBSOLETE char buf[2048]; +// OBSOLETE +// OBSOLETE numbytes = min (sizeof buf, section_size - i); +// OBSOLETE +// OBSOLETE bfd_get_section_contents (abfd, s, buf, i, numbytes); +// OBSOLETE +// OBSOLETE serial_write (desc, buf, numbytes); +// OBSOLETE +// OBSOLETE if (hashmark) +// OBSOLETE { +// OBSOLETE putchar_unfiltered ('#'); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE } /* Per-packet (or S-record) loop */ +// OBSOLETE +// OBSOLETE monitor_expect_prompt (NULL, 0); +// OBSOLETE +// OBSOLETE putchar_unfiltered ('\n'); +// OBSOLETE } /* Loadable sections */ +// OBSOLETE +// OBSOLETE monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd)); +// OBSOLETE monitor_expect_prompt (NULL, 0); +// OBSOLETE monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4); +// OBSOLETE monitor_expect_prompt (NULL, 0); +// OBSOLETE +// OBSOLETE monitor_printf ("run\r"); +// OBSOLETE +// OBSOLETE end_time = time (NULL); +// OBSOLETE +// OBSOLETE if (hashmark) +// OBSOLETE putchar_unfiltered ('\n'); +// OBSOLETE +// OBSOLETE report_transfer_performance (data_count, start_time, end_time); +// OBSOLETE +// OBSOLETE pop_target (); +// OBSOLETE push_remote_target (monitor_get_dev_name (), 1); +// OBSOLETE +// OBSOLETE throw_exception (RETURN_QUIT); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Define the monitor command strings. Since these are passed directly +// OBSOLETE through to a printf style function, we may include formatting +// OBSOLETE strings. We also need a CR or LF on the end. */ +// OBSOLETE +// OBSOLETE /* need to pause the monitor for timing reasons, so slow it down */ +// OBSOLETE +// OBSOLETE static char *sparclet_inits[] = +// OBSOLETE {"\n\r\r\n", NULL}; +// OBSOLETE +// OBSOLETE static struct monitor_ops sparclet_cmds; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE init_sparclet_cmds (void) +// OBSOLETE { +// OBSOLETE sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR | +// OBSOLETE MO_HEX_PREFIX | +// OBSOLETE MO_NO_ECHO_ON_OPEN | +// OBSOLETE MO_NO_ECHO_ON_SETMEM | +// OBSOLETE MO_RUN_FIRST_TIME | +// OBSOLETE MO_GETMEM_READ_SINGLE; /* flags */ +// OBSOLETE sparclet_cmds.init = sparclet_inits; /* Init strings */ +// OBSOLETE sparclet_cmds.cont = "cont\r"; /* continue command */ +// OBSOLETE sparclet_cmds.step = "step\r"; /* single step */ +// OBSOLETE sparclet_cmds.stop = "\r"; /* break interrupts the program */ +// OBSOLETE sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */ +// OBSOLETE sparclet_cmds.clr_break = "-bp %x\r"; /* can't use "br" because only 2 hw bps are supported */ +// OBSOLETE sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */ +// OBSOLETE "-bp\r"; /* clear all breakpoints */ +// OBSOLETE sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */ +// OBSOLETE /* can't use "fi" because it takes words, not bytes */ +// OBSOLETE /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */ +// OBSOLETE sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */ +// OBSOLETE sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */ +// OBSOLETE sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */ +// OBSOLETE sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */ +// OBSOLETE sparclet_cmds.setmem.resp_delim = NULL; /*": " *//* setmem.resp_delim */ +// OBSOLETE sparclet_cmds.setmem.term = NULL; /*"? " *//* setmem.term */ +// OBSOLETE sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" *//* setmem.term_cmd */ +// OBSOLETE /* since the parsing of multiple bytes is difficult due to +// OBSOLETE interspersed addresses, we'll only read 1 value at a time, +// OBSOLETE even tho these can handle a count */ +// OBSOLETE /* we can use -n to set count to read, but may have to parse? */ +// OBSOLETE sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */ +// OBSOLETE sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */ +// OBSOLETE sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */ +// OBSOLETE sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */ +// OBSOLETE sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */ +// OBSOLETE sparclet_cmds.getmem.term = NULL; /* getmem.term */ +// OBSOLETE sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */ +// OBSOLETE sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */ +// OBSOLETE sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */ +// OBSOLETE sparclet_cmds.setreg.term = NULL; /* setreg.term */ +// OBSOLETE sparclet_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */ +// OBSOLETE sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */ +// OBSOLETE sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */ +// OBSOLETE sparclet_cmds.getreg.term = NULL; /* getreg.term */ +// OBSOLETE sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */ +// OBSOLETE sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */ +// OBSOLETE sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */ +// OBSOLETE sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */ +// OBSOLETE sparclet_cmds.load_routine = sparclet_load; /* load_routine */ +// OBSOLETE sparclet_cmds.load = NULL; /* download command (srecs on console) */ +// OBSOLETE sparclet_cmds.loadresp = NULL; /* load response */ +// OBSOLETE sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */ +// OBSOLETE /* yikes! gdb core dumps without this delimitor!! */ +// OBSOLETE sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */ +// OBSOLETE sparclet_cmds.cmd_end = NULL; /* optional command terminator */ +// OBSOLETE sparclet_cmds.target = &sparclet_ops; /* target operations */ +// OBSOLETE sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ +// OBSOLETE sparclet_cmds.regnames = sparclet_regnames; /* registers names */ +// OBSOLETE sparclet_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE sparclet_open (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE monitor_open (args, &sparclet_cmds, from_tty); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_sparclet (void) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE init_sparclet_cmds (); +// OBSOLETE +// OBSOLETE for (i = 0; i < NUM_REGS; i++) +// OBSOLETE if (sparclet_regnames[i][0] == 'c' || +// OBSOLETE sparclet_regnames[i][0] == 'a') +// OBSOLETE sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */ +// OBSOLETE +// OBSOLETE sparclet_regnames[0] = 0; /* mon won't report %G0 */ +// OBSOLETE +// OBSOLETE init_monitor_ops (&sparclet_ops); +// OBSOLETE sparclet_ops.to_shortname = "sparclet"; /* for the target command */ +// OBSOLETE sparclet_ops.to_longname = "SPARC Sparclet monitor"; +// OBSOLETE /* use SW breaks; target only supports 2 HW breakpoints */ +// OBSOLETE sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint; +// OBSOLETE sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint; +// OBSOLETE +// OBSOLETE sparclet_ops.to_doc = +// OBSOLETE "Use a board running the Sparclet debug monitor.\n\ +// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya)."; +// OBSOLETE +// OBSOLETE sparclet_ops.to_open = sparclet_open; +// OBSOLETE add_target (&sparclet_ops); +// OBSOLETE } diff --git a/gdb/sparclet-stub.c b/gdb/sparclet-stub.c index f593df7..88740f2 100644 --- a/gdb/sparclet-stub.c +++ b/gdb/sparclet-stub.c @@ -1,1167 +1,1167 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware - * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. - * - * This code has been extensively tested on the Fujitsu SPARClite demo board. - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * P set the value of a single CPU register OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $<packet info>#<checksum>. - * - * where - * <packet info> :: <characters representing the command or response> - * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>> - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include <string.h> -#include <signal.h> - -/************************************************************************ - * - * external low-level support routines - */ - -extern void putDebugChar(); /* write a single character */ -extern int getDebugChar(); /* read and return a single char */ - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 2048 - -static int initialized = 0; /* !0 means we've been initialized */ -static int remote_debug = 0; /* turn on verbose debugging */ - -extern void breakinst(); -void _cprint(); -static void hw_breakpoint(); -static void set_mem_fault_trap(); -static void get_in_break_mode(); -static unsigned char *mem2hex(); - -static const char hexchars[]="0123456789abcdef"; - -#define NUMREGS 121 - -static unsigned long saved_stack_pointer; - -/* Number of bytes of registers. */ -#define NUMREGBYTES (NUMREGS * 4) -enum regnames { G0, G1, G2, G3, G4, G5, G6, G7, - O0, O1, O2, O3, O4, O5, SP, O7, - L0, L1, L2, L3, L4, L5, L6, L7, - I0, I1, I2, I3, I4, I5, FP, I7, - - F0, F1, F2, F3, F4, F5, F6, F7, - F8, F9, F10, F11, F12, F13, F14, F15, - F16, F17, F18, F19, F20, F21, F22, F23, - F24, F25, F26, F27, F28, F29, F30, F31, - - Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, - CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1, - - ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22, - /* the following not actually implemented */ - AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7, - AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15, - AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23, - AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31, - APSR -}; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void trap_low(); - -asm(" - .reserve trapstack, 1000 * 4, \"bss\", 8 - - .data - .align 4 - -in_trap_handler: - .word 0 - - .text - .align 4 - -! This function is called when any SPARC trap (except window overflow or -! underflow) occurs. It makes sure that the invalid register window is still -! available before jumping into C code. It will also restore the world if you -! return from handle_exception. -! -! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. - - .globl _trap_low -_trap_low: - mov %psr, %l0 - mov %wim, %l3 - - srl %l3, %l0, %l4 ! wim >> cwp - and %l4, 0xff, %l4 ! Mask off windows 28, 29 - cmp %l4, 1 - bne window_fine ! Branch if not in the invalid window - nop - -! Handle window overflow - - mov %g1, %l4 ! Save g1, we use it to hold the wim - srl %l3, 1, %g1 ! Rotate wim right - and %g1, 0xff, %g1 ! Mask off windows 28, 29 - tst %g1 - bg good_wim ! Branch if new wim is non-zero - nop - -! At this point, we need to bring a 1 into the high order bit of the wim. -! Since we don't want to make any assumptions about the number of register -! windows, we figure it out dynamically so as to setup the wim correctly. - - ! The normal way doesn't work on the sparclet as register windows - ! 28 and 29 are special purpose windows. - !not %g1 ! Fill g1 with ones - !mov %g1, %wim ! Fill the wim with ones - !nop - !nop - !nop - !mov %wim, %g1 ! Read back the wim - !inc %g1 ! Now g1 has 1 just to left of wim - !srl %g1, 1, %g1 ! Now put 1 at top of wim - - mov 0x80, %g1 ! Hack for sparclet - - ! This doesn't work on the sparclet. - !mov %g0, %wim ! Clear wim so that subsequent save - ! won't trap - andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29 - mov %l5, %wim - nop - nop - nop - -good_wim: - save %g0, %g0, %g0 ! Slip into next window - mov %g1, %wim ! Install the new wim - - std %l0, [%sp + 0 * 4] ! save L & I registers - std %l2, [%sp + 2 * 4] - std %l4, [%sp + 4 * 4] - std %l6, [%sp + 6 * 4] - - std %i0, [%sp + 8 * 4] - std %i2, [%sp + 10 * 4] - std %i4, [%sp + 12 * 4] - std %i6, [%sp + 14 * 4] - - restore ! Go back to trap window. - mov %l4, %g1 ! Restore %g1 - -window_fine: - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - tst %l5 - bg recursive_trap - inc %l5 - - set trapstack+1000*4, %sp ! Switch to trap stack - -recursive_trap: - st %l5, [%lo(in_trap_handler) + %l4] - sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[121] - - std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] - std %g2, [%sp + (24 + 2) * 4] - std %g4, [%sp + (24 + 4) * 4] - std %g6, [%sp + (24 + 6) * 4] - - std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] - std %i2, [%sp + (24 + 10) * 4] - std %i4, [%sp + (24 + 12) * 4] - std %i6, [%sp + (24 + 14) * 4] - - ! FP regs (sparclet doesn't have fpu) - - mov %y, %l4 - mov %tbr, %l5 - st %l4, [%sp + (24 + 64) * 4] ! Y - st %l0, [%sp + (24 + 65) * 4] ! PSR - st %l3, [%sp + (24 + 66) * 4] ! WIM - st %l5, [%sp + (24 + 67) * 4] ! TBR - st %l1, [%sp + (24 + 68) * 4] ! PC - st %l2, [%sp + (24 + 69) * 4] ! NPC - ! CPSR and FPSR not impl - or %l0, 0xf20, %l4 - mov %l4, %psr ! Turn on traps, disable interrupts - nop - nop - nop - -! Save coprocessor state. -! See SK/demo/hdlc_demo/ldc_swap_context.S. - - mov %psr, %l0 - sethi %hi(0x2000), %l5 ! EC bit in PSR - or %l5, %l0, %l5 - mov %l5, %psr ! enable coprocessor - nop ! 3 nops after write to %psr (needed?) - nop - nop - crdcxt %ccsr, %l1 ! capture CCSR - mov 0x6, %l2 - cwrcxt %l2, %ccsr ! set CCP state machine for CCFR - crdcxt %ccfr, %l2 ! capture CCOR - cwrcxt %l2, %ccfr ! tickle CCFR - crdcxt %ccfr, %l3 ! capture CCOBR - cwrcxt %l3, %ccfr ! tickle CCFR - crdcxt %ccfr, %l4 ! capture CCIBR - cwrcxt %l4, %ccfr ! tickle CCFR - crdcxt %ccfr, %l5 ! capture CCIR - cwrcxt %l5, %ccfr ! tickle CCFR - crdcxt %ccpr, %l6 ! capture CCPR - crdcxt %cccrcr, %l7 ! capture CCCRCR - st %l1, [%sp + (24 + 72) * 4] ! save CCSR - st %l2, [%sp + (24 + 75) * 4] ! save CCOR - st %l3, [%sp + (24 + 76) * 4] ! save CCOBR - st %l4, [%sp + (24 + 77) * 4] ! save CCIBR - st %l5, [%sp + (24 + 78) * 4] ! save CCIR - st %l6, [%sp + (24 + 73) * 4] ! save CCPR - st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR - mov %l0, %psr ! restore original PSR - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! End of saving coprocessor state. -! Save asr regs - -! Part of this is silly -- we should not display ASR15 or ASR19 at all. - - sethi %hi(0x01000000), %l6 - st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP - sethi %hi(0xdeadc0de), %l6 - or %l6, %lo(0xdeadc0de), %l6 - st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE - - rd %asr1, %l4 - st %l4, [%sp + (24 + 80) * 4] -! rd %asr15, %l4 ! must not read ASR15 -! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap) - rd %asr17, %l4 - st %l4, [%sp + (24 + 82) * 4] - rd %asr18, %l4 - st %l4, [%sp + (24 + 83) * 4] -! rd %asr19, %l4 ! must not read asr19 -! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU) - rd %asr20, %l4 - st %l4, [%sp + (24 + 85) * 4] - rd %asr21, %l4 - st %l4, [%sp + (24 + 86) * 4] - rd %asr22, %l4 - st %l4, [%sp + (24 + 87) * 4] - -! End of saving asr regs - - call _handle_exception - add %sp, 24 * 4, %o0 ! Pass address of registers - -! Reload all of the registers that aren't on the stack - - ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] - ldd [%sp + (24 + 2) * 4], %g2 - ldd [%sp + (24 + 4) * 4], %g4 - ldd [%sp + (24 + 6) * 4], %g6 - - ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] - ldd [%sp + (24 + 10) * 4], %i2 - ldd [%sp + (24 + 12) * 4], %i4 - ldd [%sp + (24 + 14) * 4], %i6 - - ! FP regs (sparclet doesn't have fpu) - -! Update the coprocessor registers. -! See SK/demo/hdlc_demo/ldc_swap_context.S. - - mov %psr, %l0 - sethi %hi(0x2000), %l5 ! EC bit in PSR - or %l5, %l0, %l5 - mov %l5, %psr ! enable coprocessor - nop ! 3 nops after write to %psr (needed?) - nop - nop - - mov 0x6, %l2 - cwrcxt %l2, %ccsr ! set CCP state machine for CCFR - - ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR - ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR - ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR - ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR - ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR - ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR - ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR - - cwrcxt %l2, %ccfr ! restore CCOR - cwrcxt %l3, %ccfr ! restore CCOBR - cwrcxt %l4, %ccfr ! restore CCIBR - cwrcxt %l5, %ccfr ! restore CCIR - cwrcxt %l6, %ccpr ! restore CCPR - cwrcxt %l7, %cccrcr ! restore CCCRCR - cwrcxt %l1, %ccsr ! restore CCSR - - mov %l0, %psr ! restore PSR - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! End of coprocessor handling stuff. -! Update asr regs - - ld [%sp + (24 + 80) * 4], %l4 - wr %l4, %asr1 -! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15 -! wr %l4, %asr15 - ld [%sp + (24 + 82) * 4], %l4 - wr %l4, %asr17 - ld [%sp + (24 + 83) * 4], %l4 - wr %l4, %asr18 -! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19 -! wr %l4, %asr19 -! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20 -! wr %l4, %asr20 -! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21 -! wr %l4, %asr21 - ld [%sp + (24 + 87) * 4], %l4 - wr %l4, %asr22 - -! End of restoring asr regs - - - ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR - ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC - - restore ! Ensure that previous window is valid - save %g0, %g0, %g0 ! by causing a window_underflow trap - - mov %l0, %y - mov %l1, %psr ! Make sure that traps are disabled - ! for rett - nop ! 3 nops after write to %psr (needed?) - nop - nop - - sethi %hi(in_trap_handler), %l4 - ld [%lo(in_trap_handler) + %l4], %l5 - dec %l5 - st %l5, [%lo(in_trap_handler) + %l4] - - jmpl %l2, %g0 ! Restore old PC - rett %l3 ! Restore old nPC -"); - -/* Convert ch from a hex digit to an int */ - -static int -hex (unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch-'a'+10; - if (ch >= '0' && ch <= '9') - return ch-'0'; - if (ch >= 'A' && ch <= 'F') - return ch-'A'+10; - return -1; -} - -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -/* scan for the sequence $<data>#<checksum> */ - -unsigned char * -getpacket (void) -{ - unsigned char *buffer = &remcomInBuffer[0]; - unsigned char checksum; - unsigned char xmitcsum; - int count; - char ch; - - while (1) - { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar ()) != '$') - ; - -retry: - checksum = 0; - xmitcsum = -1; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar (); - if (ch == '$') - goto retry; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') - { - ch = getDebugChar (); - xmitcsum = hex (ch) << 4; - ch = getDebugChar (); - xmitcsum += hex (ch); - - if (checksum != xmitcsum) - { - putDebugChar ('-'); /* failed checksum */ - } - else - { - putDebugChar ('+'); /* successful transfer */ - - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') - { - putDebugChar (buffer[0]); - putDebugChar (buffer[1]); - - return &buffer[3]; - } - - return &buffer[0]; - } - } - } -} - -/* send the packet in buffer. */ - -static void -putpacket (unsigned char *buffer) -{ - unsigned char checksum; - int count; - unsigned char ch; - - /* $<packet info>#<checksum>. */ - do - { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch = buffer[count]) - { - putDebugChar(ch); - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum & 0xf]); - - } - while (getDebugChar() != '+'); -} - -/* Indicate to caller of mem2hex or hex2mem that there has been an - error. */ -static volatile int mem_err = 0; - -/* Convert the memory pointed to by mem into hex, placing result in buf. - * Return a pointer to the last char put in buf (null), in case of mem fault, - * return 0. - * If MAY_FAULT is non-zero, then we will handle memory faults by returning - * a 0, else treat a fault like any other fault in the stub. - */ - -static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) -{ - unsigned char ch; - - set_mem_fault_trap(may_fault); - - while (count-- > 0) - { - ch = *mem++; - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - - set_mem_fault_trap(0); - - return buf; -} - -/* convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte written */ - -static char * -hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) -{ - int i; - unsigned char ch; - - set_mem_fault_trap(may_fault); - - for (i=0; i<count; i++) - { - ch = hex(*buf++) << 4; - ch |= hex(*buf++); - *mem++ = ch; - if (mem_err) - return 0; - } - - set_mem_fault_trap(0); - - return mem; -} - -/* This table contains the mapping between SPARC hardware trap types, and - signals, which are primarily what GDB understands. It also indicates - which hardware traps we need to commandeer when initializing the stub. */ - -static struct hard_trap_info -{ - unsigned char tt; /* Trap type code for SPARClite */ - unsigned char signo; /* Signal that we map this trap into */ -} hard_trap_info[] = { - {1, SIGSEGV}, /* instruction access exception */ - {0x3b, SIGSEGV}, /* instruction access error */ - {2, SIGILL}, /* illegal instruction */ - {3, SIGILL}, /* privileged instruction */ - {4, SIGEMT}, /* fp disabled */ - {0x24, SIGEMT}, /* cp disabled */ - {7, SIGBUS}, /* mem address not aligned */ - {0x29, SIGSEGV}, /* data access exception */ - {10, SIGEMT}, /* tag overflow */ - {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ - {0, 0} /* Must be last */ -}; - -/* Set up exception handlers for tracing and breakpoints */ - -void -set_debug_traps (void) -{ - struct hard_trap_info *ht; - - for (ht = hard_trap_info; ht->tt && ht->signo; ht++) - exceptionHandler(ht->tt, trap_low); - - initialized = 1; -} - -asm (" -! Trap handler for memory errors. This just sets mem_err to be non-zero. It -! assumes that %l1 is non-zero. This should be safe, as it is doubtful that -! 0 would ever contain code that could mem fault. This routine will skip -! past the faulting instruction after setting mem_err. - - .text - .align 4 - -_fltr_set_mem_err: - sethi %hi(_mem_err), %l0 - st %l1, [%l0 + %lo(_mem_err)] - jmpl %l2, %g0 - rett %l2+4 -"); - -static void -set_mem_fault_trap (int enable) -{ - extern void fltr_set_mem_err(); - mem_err = 0; - - if (enable) - exceptionHandler(0x29, fltr_set_mem_err); - else - exceptionHandler(0x29, trap_low); -} - -asm (" - .text - .align 4 - -_dummy_hw_breakpoint: - jmpl %l2, %g0 - rett %l2+4 - nop - nop -"); - -static void -set_hw_breakpoint_trap (int enable) -{ - extern void dummy_hw_breakpoint(); - - if (enable) - exceptionHandler(255, dummy_hw_breakpoint); - else - exceptionHandler(255, trap_low); -} - -static void -get_in_break_mode (void) -{ -#if 0 - int x; - mesg("get_in_break_mode, sp = "); - phex(&x); -#endif - set_hw_breakpoint_trap(1); - - asm(" - sethi %hi(0xff10), %l4 - or %l4, %lo(0xff10), %l4 - sta %g0, [%l4]0x1 - nop - nop - nop - "); - - set_hw_breakpoint_trap(0); -} - -/* Convert the SPARC hardware trap type code to a unix signal number. */ - -static int -computeSignal (int tt) -{ - struct hard_trap_info *ht; - - for (ht = hard_trap_info; ht->tt && ht->signo; ht++) - if (ht->tt == tt) - return ht->signo; - - return SIGHUP; /* default for things we don't know about */ -} - -/* - * While we find nice hex chars, build an int. - * Return number of chars processed. - */ - -static int -hexToInt(char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) - { - hexValue = hex(**ptr); - if (hexValue < 0) - break; - - *intValue = (*intValue << 4) | hexValue; - numChars ++; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command procesing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ - -static void -handle_exception (unsigned long *registers) -{ - int tt; /* Trap type */ - int sigval; - int addr; - int length; - char *ptr; - unsigned long *sp; - unsigned long dsr; - -/* First, we must force all of the windows to be spilled out */ - - asm(" - ! Ugh. sparclet has broken save - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - !save %sp, -64, %sp - save - add %fp,-64,%sp - restore - restore - restore - restore - restore - restore - restore - restore -"); - - if (registers[PC] == (unsigned long)breakinst) - { - registers[PC] = registers[NPC]; - registers[NPC] += 4; - } - sp = (unsigned long *)registers[SP]; - - tt = (registers[TBR] >> 4) & 0xff; - - /* reply to host that an exception has occurred */ - sigval = computeSignal(tt); - ptr = remcomOutBuffer; - - *ptr++ = 'T'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[PC >> 4]; - *ptr++ = hexchars[PC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[FP >> 4]; - *ptr++ = hexchars[FP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[SP >> 4]; - *ptr++ = hexchars[SP & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)&sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[NPC >> 4]; - *ptr++ = hexchars[NPC & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = hexchars[O7 >> 4]; - *ptr++ = hexchars[O7 & 0xf]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = 0; - - putpacket(remcomOutBuffer); - - while (1) - { - remcomOutBuffer[0] = 0; - - ptr = getpacket(); - switch (*ptr++) - { - case '?': - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval & 0xf]; - remcomOutBuffer[3] = 0; - break; - - case 'd': - remote_debug = !(remote_debug); /* toggle debug flag */ - break; - - case 'g': /* return the value of the CPU registers */ - { - ptr = remcomOutBuffer; - ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ - ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ - memset(ptr, '0', 32 * 8); /* Floating point */ - ptr = mem2hex((char *)®isters[Y], - ptr + 32 * 4 * 2, - 8 * 4, - 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ - ptr = mem2hex((char *)®isters[CCSR], - ptr, - 8 * 4, - 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */ - ptr = mem2hex((char *)®isters[ASR1], - ptr, - 8 * 4, - 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */ -#if 0 /* not implemented */ - ptr = mem2hex((char *) ®isters[AWR0], - ptr, - 32 * 4, - 0); /* Alternate Window Registers */ -#endif - } - break; - - case 'G': /* set value of all the CPU registers - return OK */ - case 'P': /* set value of one CPU register - return OK */ - { - unsigned long *newsp, psr; - - psr = registers[PSR]; - - if (ptr[-1] == 'P') /* do a single register */ - { - int regno; - - if (hexToInt (&ptr, ®no) - && *ptr++ == '=') - if (regno >= L0 && regno <= I7) - hex2mem (ptr, sp + regno - L0, 4, 0); - else - hex2mem (ptr, (char *)®isters[regno], 4, 0); - else - { - strcpy (remcomOutBuffer, "E01"); - break; - } - } - else - { - hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ - hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ - hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], - 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */ - hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR], - 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */ - hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1], - 8 * 4, 0); /* ASR1 ... ASR22 */ -#if 0 /* not implemented */ - hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0], - 8 * 4, 0); /* Alternate Window Registers */ -#endif - } - /* See if the stack pointer has moved. If so, then copy the saved - locals and ins to the new location. This keeps the window - overflow and underflow routines happy. */ - - newsp = (unsigned long *)registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); - - /* Don't allow CWP to be modified. */ - - if (psr != registers[PSR]) - registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); - - strcpy(remcomOutBuffer,"OK"); - } - break; - - case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - /* Try to read %x,%x. */ - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length)) - { - if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) - break; - - strcpy (remcomOutBuffer, "E03"); - } - else - strcpy(remcomOutBuffer,"E01"); - break; - - case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - /* Try to read '%x,%x:'. */ - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length) - && *ptr++ == ':') - { - if (hex2mem(ptr, (char *)addr, length, 1)) - strcpy(remcomOutBuffer, "OK"); - else - strcpy(remcomOutBuffer, "E03"); - } - else - strcpy(remcomOutBuffer, "E02"); - break; - - case 'c': /* cAA..AA Continue at address AA..AA(optional) */ - /* try to read optional parameter, pc unchanged if no parm */ - - if (hexToInt(&ptr, &addr)) - { - registers[PC] = addr; - registers[NPC] = addr + 4; - } - -/* Need to flush the instruction cache here, as we may have deposited a - breakpoint, and the icache probably has no way of knowing that a data ref to - some location may have changed something that is in the instruction cache. - */ - - flush_i_cache(); - return; - - /* kill the program */ - case 'k' : /* do nothing */ - break; -#if 0 - case 't': /* Test feature */ - asm (" std %f30,[%sp]"); - break; -#endif - case 'r': /* Reset */ - asm ("call 0 - nop "); - break; - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void -breakpoint (void) -{ - if (!initialized) - return; - - asm(" .globl _breakinst - - _breakinst: ta 1 - "); -} - -static void -hw_breakpoint (void) -{ - asm(" - ta 127 - "); -} - -#if 0 /* experimental and never finished, left here for reference */ -static void -splet_temp(void) -{ - asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals - ! + hidden arg + arg spill - ! + doubleword alignment - ! + registers[121] - -! Leave a trail of breadcrumbs! (save register save area for debugging) - mov %sp, %l0 - add %l0, 24*4, %l0 - sethi %hi(_debug_registers), %l1 - st %l0, [%lo(_debug_registers) + %l1] - -! Save the Alternate Register Set: (not implemented yet) -! To save the Alternate Register set, we must: -! 1) Save the current SP in some global location. -! 2) Swap the register sets. -! 3) Save the Alternate SP in the Y register -! 4) Fetch the SP that we saved in step 1. -! 5) Use that to save the rest of the regs (not forgetting ASP in Y) -! 6) Restore the Alternate SP from Y -! 7) Swap the registers back. - -! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER: - sethi %hi(_saved_stack_pointer), %l0 - st %sp, [%lo(_saved_stack_pointer) + %l0] - -! 2) Swap the register sets: - mov %psr, %l1 - sethi %hi(0x10000), %l2 - xor %l1, %l2, %l1 - mov %l1, %psr - nop ! 3 nops after write to %psr (needed?) - nop - nop - -! 3) Save Alternate L0 in Y - wr %l0, 0, %y - -! 4) Load former SP into alternate SP, using L0 - sethi %hi(_saved_stack_pointer), %l0 - or %lo(_saved_stack_pointer), %l0, %l0 - swap [%l0], %sp - -! 4.5) Restore alternate L0 - rd %y, %l0 - -! 5) Save the Alternate Window Registers - st %r0, [%sp + (24 + 88) * 4] ! AWR0 - st %r1, [%sp + (24 + 89) * 4] ! AWR1 - st %r2, [%sp + (24 + 90) * 4] ! AWR2 - st %r3, [%sp + (24 + 91) * 4] ! AWR3 - st %r4, [%sp + (24 + 92) * 4] ! AWR4 - st %r5, [%sp + (24 + 93) * 4] ! AWR5 - st %r6, [%sp + (24 + 94) * 4] ! AWR6 - st %r7, [%sp + (24 + 95) * 4] ! AWR7 - st %r8, [%sp + (24 + 96) * 4] ! AWR8 - st %r9, [%sp + (24 + 97) * 4] ! AWR9 - st %r10, [%sp + (24 + 98) * 4] ! AWR10 - st %r11, [%sp + (24 + 99) * 4] ! AWR11 - st %r12, [%sp + (24 + 100) * 4] ! AWR12 - st %r13, [%sp + (24 + 101) * 4] ! AWR13 -! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP) - st %r15, [%sp + (24 + 103) * 4] ! AWR15 - st %r16, [%sp + (24 + 104) * 4] ! AWR16 - st %r17, [%sp + (24 + 105) * 4] ! AWR17 - st %r18, [%sp + (24 + 106) * 4] ! AWR18 - st %r19, [%sp + (24 + 107) * 4] ! AWR19 - st %r20, [%sp + (24 + 108) * 4] ! AWR20 - st %r21, [%sp + (24 + 109) * 4] ! AWR21 - st %r22, [%sp + (24 + 110) * 4] ! AWR22 - st %r23, [%sp + (24 + 111) * 4] ! AWR23 - st %r24, [%sp + (24 + 112) * 4] ! AWR24 - st %r25, [%sp + (24 + 113) * 4] ! AWR25 - st %r26, [%sp + (24 + 114) * 4] ! AWR26 - st %r27, [%sp + (24 + 115) * 4] ! AWR27 - st %r28, [%sp + (24 + 116) * 4] ! AWR28 - st %r29, [%sp + (24 + 117) * 4] ! AWR29 - st %r30, [%sp + (24 + 118) * 4] ! AWR30 - st %r31, [%sp + (24 + 119) * 4] ! AWR21 - -! Get the Alternate PSR (I hope...) - - rd %psr, %l2 - st %l2, [%sp + (24 + 120) * 4] ! APSR - -! Don't forget the alternate stack pointer - - rd %y, %l3 - st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP) - -! 6) Restore the Alternate SP (saved in Y) - - rd %y, %o6 - - -! 7) Swap the registers back: - - mov %psr, %l1 - sethi %hi(0x10000), %l2 - xor %l1, %l2, %l1 - mov %l1, %psr - nop ! 3 nops after write to %psr (needed?) - nop - nop -"); -} - -#endif +// OBSOLETE /**************************************************************************** +// OBSOLETE +// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED +// OBSOLETE +// OBSOLETE HP offers the following for use in the public domain. HP makes no +// OBSOLETE warranty with regard to the software or it's performance and the +// OBSOLETE user accepts the software "AS IS" with all faults. +// OBSOLETE +// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD +// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// OBSOLETE +// OBSOLETE ****************************************************************************/ +// OBSOLETE +// OBSOLETE /**************************************************************************** +// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ +// OBSOLETE * +// OBSOLETE * Module name: remcom.c $ +// OBSOLETE * Revision: 1.34 $ +// OBSOLETE * Date: 91/03/09 12:29:49 $ +// OBSOLETE * Contributor: Lake Stevens Instrument Division$ +// OBSOLETE * +// OBSOLETE * Description: low level support for gdb debugger. $ +// OBSOLETE * +// OBSOLETE * Considerations: only works on target hardware $ +// OBSOLETE * +// OBSOLETE * Written by: Glenn Engel $ +// OBSOLETE * ModuleState: Experimental $ +// OBSOLETE * +// OBSOLETE * NOTES: See Below $ +// OBSOLETE * +// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support. +// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware +// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. +// OBSOLETE * +// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board. +// OBSOLETE * +// OBSOLETE * To enable debugger support, two things need to happen. One, a +// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints +// OBSOLETE * or error conditions to be properly intercepted and reported to gdb. +// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This +// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint() +// OBSOLETE * simulates a breakpoint by executing a trap #1. +// OBSOLETE * +// OBSOLETE ************* +// OBSOLETE * +// OBSOLETE * The following gdb commands are supported: +// OBSOLETE * +// OBSOLETE * command function Return value +// OBSOLETE * +// OBSOLETE * g return the value of the CPU registers hex data or ENN +// OBSOLETE * G set the value of the CPU registers OK or ENN +// OBSOLETE * P set the value of a single CPU register OK or ENN +// OBSOLETE * +// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN +// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN +// OBSOLETE * +// OBSOLETE * c Resume at current address SNN ( signal NN) +// OBSOLETE * cAA..AA Continue at address AA..AA SNN +// OBSOLETE * +// OBSOLETE * s Step one instruction SNN +// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN +// OBSOLETE * +// OBSOLETE * k kill +// OBSOLETE * +// OBSOLETE * ? What was the last sigval ? SNN (signal NN) +// OBSOLETE * +// OBSOLETE * All commands and responses are sent with a packet which includes a +// OBSOLETE * checksum. A packet consists of +// OBSOLETE * +// OBSOLETE * $<packet info>#<checksum>. +// OBSOLETE * +// OBSOLETE * where +// OBSOLETE * <packet info> :: <characters representing the command or response> +// OBSOLETE * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>> +// OBSOLETE * +// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'. +// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer. +// OBSOLETE * +// OBSOLETE * Example: +// OBSOLETE * +// OBSOLETE * Host: Reply: +// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42 +// OBSOLETE * +// OBSOLETE ****************************************************************************/ +// OBSOLETE +// OBSOLETE #include <string.h> +// OBSOLETE #include <signal.h> +// OBSOLETE +// OBSOLETE /************************************************************************ +// OBSOLETE * +// OBSOLETE * external low-level support routines +// OBSOLETE */ +// OBSOLETE +// OBSOLETE extern void putDebugChar(); /* write a single character */ +// OBSOLETE extern int getDebugChar(); /* read and return a single char */ +// OBSOLETE +// OBSOLETE /************************************************************************/ +// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */ +// OBSOLETE #define BUFMAX 2048 +// OBSOLETE +// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */ +// OBSOLETE static int remote_debug = 0; /* turn on verbose debugging */ +// OBSOLETE +// OBSOLETE extern void breakinst(); +// OBSOLETE void _cprint(); +// OBSOLETE static void hw_breakpoint(); +// OBSOLETE static void set_mem_fault_trap(); +// OBSOLETE static void get_in_break_mode(); +// OBSOLETE static unsigned char *mem2hex(); +// OBSOLETE +// OBSOLETE static const char hexchars[]="0123456789abcdef"; +// OBSOLETE +// OBSOLETE #define NUMREGS 121 +// OBSOLETE +// OBSOLETE static unsigned long saved_stack_pointer; +// OBSOLETE +// OBSOLETE /* Number of bytes of registers. */ +// OBSOLETE #define NUMREGBYTES (NUMREGS * 4) +// OBSOLETE enum regnames { G0, G1, G2, G3, G4, G5, G6, G7, +// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7, +// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7, +// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7, +// OBSOLETE +// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7, +// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15, +// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23, +// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31, +// OBSOLETE +// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, +// OBSOLETE CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1, +// OBSOLETE +// OBSOLETE ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22, +// OBSOLETE /* the following not actually implemented */ +// OBSOLETE AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7, +// OBSOLETE AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15, +// OBSOLETE AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23, +// OBSOLETE AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31, +// OBSOLETE APSR +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/ +// OBSOLETE /* */ +// OBSOLETE +// OBSOLETE extern void trap_low(); +// OBSOLETE +// OBSOLETE asm(" +// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8 +// OBSOLETE +// OBSOLETE .data +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE in_trap_handler: +// OBSOLETE .word 0 +// OBSOLETE +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE ! This function is called when any SPARC trap (except window overflow or +// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still +// OBSOLETE ! available before jumping into C code. It will also restore the world if you +// OBSOLETE ! return from handle_exception. +// OBSOLETE ! +// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. +// OBSOLETE +// OBSOLETE .globl _trap_low +// OBSOLETE _trap_low: +// OBSOLETE mov %psr, %l0 +// OBSOLETE mov %wim, %l3 +// OBSOLETE +// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp +// OBSOLETE and %l4, 0xff, %l4 ! Mask off windows 28, 29 +// OBSOLETE cmp %l4, 1 +// OBSOLETE bne window_fine ! Branch if not in the invalid window +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! Handle window overflow +// OBSOLETE +// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim +// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right +// OBSOLETE and %g1, 0xff, %g1 ! Mask off windows 28, 29 +// OBSOLETE tst %g1 +// OBSOLETE bg good_wim ! Branch if new wim is non-zero +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim. +// OBSOLETE ! Since we don't want to make any assumptions about the number of register +// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly. +// OBSOLETE +// OBSOLETE ! The normal way doesn't work on the sparclet as register windows +// OBSOLETE ! 28 and 29 are special purpose windows. +// OBSOLETE !not %g1 ! Fill g1 with ones +// OBSOLETE !mov %g1, %wim ! Fill the wim with ones +// OBSOLETE !nop +// OBSOLETE !nop +// OBSOLETE !nop +// OBSOLETE !mov %wim, %g1 ! Read back the wim +// OBSOLETE !inc %g1 ! Now g1 has 1 just to left of wim +// OBSOLETE !srl %g1, 1, %g1 ! Now put 1 at top of wim +// OBSOLETE +// OBSOLETE mov 0x80, %g1 ! Hack for sparclet +// OBSOLETE +// OBSOLETE ! This doesn't work on the sparclet. +// OBSOLETE !mov %g0, %wim ! Clear wim so that subsequent save +// OBSOLETE ! won't trap +// OBSOLETE andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29 +// OBSOLETE mov %l5, %wim +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE good_wim: +// OBSOLETE save %g0, %g0, %g0 ! Slip into next window +// OBSOLETE mov %g1, %wim ! Install the new wim +// OBSOLETE +// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers +// OBSOLETE std %l2, [%sp + 2 * 4] +// OBSOLETE std %l4, [%sp + 4 * 4] +// OBSOLETE std %l6, [%sp + 6 * 4] +// OBSOLETE +// OBSOLETE std %i0, [%sp + 8 * 4] +// OBSOLETE std %i2, [%sp + 10 * 4] +// OBSOLETE std %i4, [%sp + 12 * 4] +// OBSOLETE std %i6, [%sp + 14 * 4] +// OBSOLETE +// OBSOLETE restore ! Go back to trap window. +// OBSOLETE mov %l4, %g1 ! Restore %g1 +// OBSOLETE +// OBSOLETE window_fine: +// OBSOLETE sethi %hi(in_trap_handler), %l4 +// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 +// OBSOLETE tst %l5 +// OBSOLETE bg recursive_trap +// OBSOLETE inc %l5 +// OBSOLETE +// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack +// OBSOLETE +// OBSOLETE recursive_trap: +// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] +// OBSOLETE sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals +// OBSOLETE ! + hidden arg + arg spill +// OBSOLETE ! + doubleword alignment +// OBSOLETE ! + registers[121] +// OBSOLETE +// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] +// OBSOLETE std %g2, [%sp + (24 + 2) * 4] +// OBSOLETE std %g4, [%sp + (24 + 4) * 4] +// OBSOLETE std %g6, [%sp + (24 + 6) * 4] +// OBSOLETE +// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] +// OBSOLETE std %i2, [%sp + (24 + 10) * 4] +// OBSOLETE std %i4, [%sp + (24 + 12) * 4] +// OBSOLETE std %i6, [%sp + (24 + 14) * 4] +// OBSOLETE +// OBSOLETE ! FP regs (sparclet doesn't have fpu) +// OBSOLETE +// OBSOLETE mov %y, %l4 +// OBSOLETE mov %tbr, %l5 +// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y +// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR +// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM +// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR +// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC +// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC +// OBSOLETE ! CPSR and FPSR not impl +// OBSOLETE or %l0, 0xf20, %l4 +// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! Save coprocessor state. +// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S. +// OBSOLETE +// OBSOLETE mov %psr, %l0 +// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR +// OBSOLETE or %l5, %l0, %l5 +// OBSOLETE mov %l5, %psr ! enable coprocessor +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE crdcxt %ccsr, %l1 ! capture CCSR +// OBSOLETE mov 0x6, %l2 +// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR +// OBSOLETE crdcxt %ccfr, %l2 ! capture CCOR +// OBSOLETE cwrcxt %l2, %ccfr ! tickle CCFR +// OBSOLETE crdcxt %ccfr, %l3 ! capture CCOBR +// OBSOLETE cwrcxt %l3, %ccfr ! tickle CCFR +// OBSOLETE crdcxt %ccfr, %l4 ! capture CCIBR +// OBSOLETE cwrcxt %l4, %ccfr ! tickle CCFR +// OBSOLETE crdcxt %ccfr, %l5 ! capture CCIR +// OBSOLETE cwrcxt %l5, %ccfr ! tickle CCFR +// OBSOLETE crdcxt %ccpr, %l6 ! capture CCPR +// OBSOLETE crdcxt %cccrcr, %l7 ! capture CCCRCR +// OBSOLETE st %l1, [%sp + (24 + 72) * 4] ! save CCSR +// OBSOLETE st %l2, [%sp + (24 + 75) * 4] ! save CCOR +// OBSOLETE st %l3, [%sp + (24 + 76) * 4] ! save CCOBR +// OBSOLETE st %l4, [%sp + (24 + 77) * 4] ! save CCIBR +// OBSOLETE st %l5, [%sp + (24 + 78) * 4] ! save CCIR +// OBSOLETE st %l6, [%sp + (24 + 73) * 4] ! save CCPR +// OBSOLETE st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR +// OBSOLETE mov %l0, %psr ! restore original PSR +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! End of saving coprocessor state. +// OBSOLETE ! Save asr regs +// OBSOLETE +// OBSOLETE ! Part of this is silly -- we should not display ASR15 or ASR19 at all. +// OBSOLETE +// OBSOLETE sethi %hi(0x01000000), %l6 +// OBSOLETE st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP +// OBSOLETE sethi %hi(0xdeadc0de), %l6 +// OBSOLETE or %l6, %lo(0xdeadc0de), %l6 +// OBSOLETE st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE +// OBSOLETE +// OBSOLETE rd %asr1, %l4 +// OBSOLETE st %l4, [%sp + (24 + 80) * 4] +// OBSOLETE ! rd %asr15, %l4 ! must not read ASR15 +// OBSOLETE ! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap) +// OBSOLETE rd %asr17, %l4 +// OBSOLETE st %l4, [%sp + (24 + 82) * 4] +// OBSOLETE rd %asr18, %l4 +// OBSOLETE st %l4, [%sp + (24 + 83) * 4] +// OBSOLETE ! rd %asr19, %l4 ! must not read asr19 +// OBSOLETE ! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU) +// OBSOLETE rd %asr20, %l4 +// OBSOLETE st %l4, [%sp + (24 + 85) * 4] +// OBSOLETE rd %asr21, %l4 +// OBSOLETE st %l4, [%sp + (24 + 86) * 4] +// OBSOLETE rd %asr22, %l4 +// OBSOLETE st %l4, [%sp + (24 + 87) * 4] +// OBSOLETE +// OBSOLETE ! End of saving asr regs +// OBSOLETE +// OBSOLETE call _handle_exception +// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers +// OBSOLETE +// OBSOLETE ! Reload all of the registers that aren't on the stack +// OBSOLETE +// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] +// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2 +// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4 +// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6 +// OBSOLETE +// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] +// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2 +// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4 +// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6 +// OBSOLETE +// OBSOLETE ! FP regs (sparclet doesn't have fpu) +// OBSOLETE +// OBSOLETE ! Update the coprocessor registers. +// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S. +// OBSOLETE +// OBSOLETE mov %psr, %l0 +// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR +// OBSOLETE or %l5, %l0, %l5 +// OBSOLETE mov %l5, %psr ! enable coprocessor +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE mov 0x6, %l2 +// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR +// OBSOLETE +// OBSOLETE ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR +// OBSOLETE ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR +// OBSOLETE ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR +// OBSOLETE ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR +// OBSOLETE ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR +// OBSOLETE ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR +// OBSOLETE ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR +// OBSOLETE +// OBSOLETE cwrcxt %l2, %ccfr ! restore CCOR +// OBSOLETE cwrcxt %l3, %ccfr ! restore CCOBR +// OBSOLETE cwrcxt %l4, %ccfr ! restore CCIBR +// OBSOLETE cwrcxt %l5, %ccfr ! restore CCIR +// OBSOLETE cwrcxt %l6, %ccpr ! restore CCPR +// OBSOLETE cwrcxt %l7, %cccrcr ! restore CCCRCR +// OBSOLETE cwrcxt %l1, %ccsr ! restore CCSR +// OBSOLETE +// OBSOLETE mov %l0, %psr ! restore PSR +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! End of coprocessor handling stuff. +// OBSOLETE ! Update asr regs +// OBSOLETE +// OBSOLETE ld [%sp + (24 + 80) * 4], %l4 +// OBSOLETE wr %l4, %asr1 +// OBSOLETE ! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15 +// OBSOLETE ! wr %l4, %asr15 +// OBSOLETE ld [%sp + (24 + 82) * 4], %l4 +// OBSOLETE wr %l4, %asr17 +// OBSOLETE ld [%sp + (24 + 83) * 4], %l4 +// OBSOLETE wr %l4, %asr18 +// OBSOLETE ! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19 +// OBSOLETE ! wr %l4, %asr19 +// OBSOLETE ! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20 +// OBSOLETE ! wr %l4, %asr20 +// OBSOLETE ! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21 +// OBSOLETE ! wr %l4, %asr21 +// OBSOLETE ld [%sp + (24 + 87) * 4], %l4 +// OBSOLETE wr %l4, %asr22 +// OBSOLETE +// OBSOLETE ! End of restoring asr regs +// OBSOLETE +// OBSOLETE +// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR +// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC +// OBSOLETE +// OBSOLETE restore ! Ensure that previous window is valid +// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap +// OBSOLETE +// OBSOLETE mov %l0, %y +// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled +// OBSOLETE ! for rett +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE sethi %hi(in_trap_handler), %l4 +// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5 +// OBSOLETE dec %l5 +// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4] +// OBSOLETE +// OBSOLETE jmpl %l2, %g0 ! Restore old PC +// OBSOLETE rett %l3 ! Restore old nPC +// OBSOLETE "); +// OBSOLETE +// OBSOLETE /* Convert ch from a hex digit to an int */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE hex (unsigned char ch) +// OBSOLETE { +// OBSOLETE if (ch >= 'a' && ch <= 'f') +// OBSOLETE return ch-'a'+10; +// OBSOLETE if (ch >= '0' && ch <= '9') +// OBSOLETE return ch-'0'; +// OBSOLETE if (ch >= 'A' && ch <= 'F') +// OBSOLETE return ch-'A'+10; +// OBSOLETE return -1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static char remcomInBuffer[BUFMAX]; +// OBSOLETE static char remcomOutBuffer[BUFMAX]; +// OBSOLETE +// OBSOLETE /* scan for the sequence $<data>#<checksum> */ +// OBSOLETE +// OBSOLETE unsigned char * +// OBSOLETE getpacket (void) +// OBSOLETE { +// OBSOLETE unsigned char *buffer = &remcomInBuffer[0]; +// OBSOLETE unsigned char checksum; +// OBSOLETE unsigned char xmitcsum; +// OBSOLETE int count; +// OBSOLETE char ch; +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE /* wait around for the start character, ignore all other characters */ +// OBSOLETE while ((ch = getDebugChar ()) != '$') +// OBSOLETE ; +// OBSOLETE +// OBSOLETE retry: +// OBSOLETE checksum = 0; +// OBSOLETE xmitcsum = -1; +// OBSOLETE count = 0; +// OBSOLETE +// OBSOLETE /* now, read until a # or end of buffer is found */ +// OBSOLETE while (count < BUFMAX) +// OBSOLETE { +// OBSOLETE ch = getDebugChar (); +// OBSOLETE if (ch == '$') +// OBSOLETE goto retry; +// OBSOLETE if (ch == '#') +// OBSOLETE break; +// OBSOLETE checksum = checksum + ch; +// OBSOLETE buffer[count] = ch; +// OBSOLETE count = count + 1; +// OBSOLETE } +// OBSOLETE buffer[count] = 0; +// OBSOLETE +// OBSOLETE if (ch == '#') +// OBSOLETE { +// OBSOLETE ch = getDebugChar (); +// OBSOLETE xmitcsum = hex (ch) << 4; +// OBSOLETE ch = getDebugChar (); +// OBSOLETE xmitcsum += hex (ch); +// OBSOLETE +// OBSOLETE if (checksum != xmitcsum) +// OBSOLETE { +// OBSOLETE putDebugChar ('-'); /* failed checksum */ +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE putDebugChar ('+'); /* successful transfer */ +// OBSOLETE +// OBSOLETE /* if a sequence char is present, reply the sequence ID */ +// OBSOLETE if (buffer[2] == ':') +// OBSOLETE { +// OBSOLETE putDebugChar (buffer[0]); +// OBSOLETE putDebugChar (buffer[1]); +// OBSOLETE +// OBSOLETE return &buffer[3]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return &buffer[0]; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* send the packet in buffer. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE putpacket (unsigned char *buffer) +// OBSOLETE { +// OBSOLETE unsigned char checksum; +// OBSOLETE int count; +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE /* $<packet info>#<checksum>. */ +// OBSOLETE do +// OBSOLETE { +// OBSOLETE putDebugChar('$'); +// OBSOLETE checksum = 0; +// OBSOLETE count = 0; +// OBSOLETE +// OBSOLETE while (ch = buffer[count]) +// OBSOLETE { +// OBSOLETE putDebugChar(ch); +// OBSOLETE checksum += ch; +// OBSOLETE count += 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE putDebugChar('#'); +// OBSOLETE putDebugChar(hexchars[checksum >> 4]); +// OBSOLETE putDebugChar(hexchars[checksum & 0xf]); +// OBSOLETE +// OBSOLETE } +// OBSOLETE while (getDebugChar() != '+'); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an +// OBSOLETE error. */ +// OBSOLETE static volatile int mem_err = 0; +// OBSOLETE +// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf. +// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault, +// OBSOLETE * return 0. +// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning +// OBSOLETE * a 0, else treat a fault like any other fault in the stub. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static unsigned char * +// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) +// OBSOLETE { +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(may_fault); +// OBSOLETE +// OBSOLETE while (count-- > 0) +// OBSOLETE { +// OBSOLETE ch = *mem++; +// OBSOLETE if (mem_err) +// OBSOLETE return 0; +// OBSOLETE *buf++ = hexchars[ch >> 4]; +// OBSOLETE *buf++ = hexchars[ch & 0xf]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE *buf = 0; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(0); +// OBSOLETE +// OBSOLETE return buf; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem +// OBSOLETE * return a pointer to the character AFTER the last byte written */ +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE unsigned char ch; +// OBSOLETE +// OBSOLETE set_mem_fault_trap(may_fault); +// OBSOLETE +// OBSOLETE for (i=0; i<count; i++) +// OBSOLETE { +// OBSOLETE ch = hex(*buf++) << 4; +// OBSOLETE ch |= hex(*buf++); +// OBSOLETE *mem++ = ch; +// OBSOLETE if (mem_err) +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE set_mem_fault_trap(0); +// OBSOLETE +// OBSOLETE return mem; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This table contains the mapping between SPARC hardware trap types, and +// OBSOLETE signals, which are primarily what GDB understands. It also indicates +// OBSOLETE which hardware traps we need to commandeer when initializing the stub. */ +// OBSOLETE +// OBSOLETE static struct hard_trap_info +// OBSOLETE { +// OBSOLETE unsigned char tt; /* Trap type code for SPARClite */ +// OBSOLETE unsigned char signo; /* Signal that we map this trap into */ +// OBSOLETE } hard_trap_info[] = { +// OBSOLETE {1, SIGSEGV}, /* instruction access exception */ +// OBSOLETE {0x3b, SIGSEGV}, /* instruction access error */ +// OBSOLETE {2, SIGILL}, /* illegal instruction */ +// OBSOLETE {3, SIGILL}, /* privileged instruction */ +// OBSOLETE {4, SIGEMT}, /* fp disabled */ +// OBSOLETE {0x24, SIGEMT}, /* cp disabled */ +// OBSOLETE {7, SIGBUS}, /* mem address not aligned */ +// OBSOLETE {0x29, SIGSEGV}, /* data access exception */ +// OBSOLETE {10, SIGEMT}, /* tag overflow */ +// OBSOLETE {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ +// OBSOLETE {0, 0} /* Must be last */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* Set up exception handlers for tracing and breakpoints */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE set_debug_traps (void) +// OBSOLETE { +// OBSOLETE struct hard_trap_info *ht; +// OBSOLETE +// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++) +// OBSOLETE exceptionHandler(ht->tt, trap_low); +// OBSOLETE +// OBSOLETE initialized = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE asm (" +// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It +// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that +// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip +// OBSOLETE ! past the faulting instruction after setting mem_err. +// OBSOLETE +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE _fltr_set_mem_err: +// OBSOLETE sethi %hi(_mem_err), %l0 +// OBSOLETE st %l1, [%l0 + %lo(_mem_err)] +// OBSOLETE jmpl %l2, %g0 +// OBSOLETE rett %l2+4 +// OBSOLETE "); +// OBSOLETE +// OBSOLETE static void +// OBSOLETE set_mem_fault_trap (int enable) +// OBSOLETE { +// OBSOLETE extern void fltr_set_mem_err(); +// OBSOLETE mem_err = 0; +// OBSOLETE +// OBSOLETE if (enable) +// OBSOLETE exceptionHandler(0x29, fltr_set_mem_err); +// OBSOLETE else +// OBSOLETE exceptionHandler(0x29, trap_low); +// OBSOLETE } +// OBSOLETE +// OBSOLETE asm (" +// OBSOLETE .text +// OBSOLETE .align 4 +// OBSOLETE +// OBSOLETE _dummy_hw_breakpoint: +// OBSOLETE jmpl %l2, %g0 +// OBSOLETE rett %l2+4 +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE "); +// OBSOLETE +// OBSOLETE static void +// OBSOLETE set_hw_breakpoint_trap (int enable) +// OBSOLETE { +// OBSOLETE extern void dummy_hw_breakpoint(); +// OBSOLETE +// OBSOLETE if (enable) +// OBSOLETE exceptionHandler(255, dummy_hw_breakpoint); +// OBSOLETE else +// OBSOLETE exceptionHandler(255, trap_low); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE get_in_break_mode (void) +// OBSOLETE { +// OBSOLETE #if 0 +// OBSOLETE int x; +// OBSOLETE mesg("get_in_break_mode, sp = "); +// OBSOLETE phex(&x); +// OBSOLETE #endif +// OBSOLETE set_hw_breakpoint_trap(1); +// OBSOLETE +// OBSOLETE asm(" +// OBSOLETE sethi %hi(0xff10), %l4 +// OBSOLETE or %l4, %lo(0xff10), %l4 +// OBSOLETE sta %g0, [%l4]0x1 +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE "); +// OBSOLETE +// OBSOLETE set_hw_breakpoint_trap(0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE computeSignal (int tt) +// OBSOLETE { +// OBSOLETE struct hard_trap_info *ht; +// OBSOLETE +// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++) +// OBSOLETE if (ht->tt == tt) +// OBSOLETE return ht->signo; +// OBSOLETE +// OBSOLETE return SIGHUP; /* default for things we don't know about */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * While we find nice hex chars, build an int. +// OBSOLETE * Return number of chars processed. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE hexToInt(char **ptr, int *intValue) +// OBSOLETE { +// OBSOLETE int numChars = 0; +// OBSOLETE int hexValue; +// OBSOLETE +// OBSOLETE *intValue = 0; +// OBSOLETE +// OBSOLETE while (**ptr) +// OBSOLETE { +// OBSOLETE hexValue = hex(**ptr); +// OBSOLETE if (hexValue < 0) +// OBSOLETE break; +// OBSOLETE +// OBSOLETE *intValue = (*intValue << 4) | hexValue; +// OBSOLETE numChars ++; +// OBSOLETE +// OBSOLETE (*ptr)++; +// OBSOLETE } +// OBSOLETE +// OBSOLETE return (numChars); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * This function does all command procesing for interfacing to gdb. It +// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0 +// OBSOLETE * otherwise. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE handle_exception (unsigned long *registers) +// OBSOLETE { +// OBSOLETE int tt; /* Trap type */ +// OBSOLETE int sigval; +// OBSOLETE int addr; +// OBSOLETE int length; +// OBSOLETE char *ptr; +// OBSOLETE unsigned long *sp; +// OBSOLETE unsigned long dsr; +// OBSOLETE +// OBSOLETE /* First, we must force all of the windows to be spilled out */ +// OBSOLETE +// OBSOLETE asm(" +// OBSOLETE ! Ugh. sparclet has broken save +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE !save %sp, -64, %sp +// OBSOLETE save +// OBSOLETE add %fp,-64,%sp +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE restore +// OBSOLETE "); +// OBSOLETE +// OBSOLETE if (registers[PC] == (unsigned long)breakinst) +// OBSOLETE { +// OBSOLETE registers[PC] = registers[NPC]; +// OBSOLETE registers[NPC] += 4; +// OBSOLETE } +// OBSOLETE sp = (unsigned long *)registers[SP]; +// OBSOLETE +// OBSOLETE tt = (registers[TBR] >> 4) & 0xff; +// OBSOLETE +// OBSOLETE /* reply to host that an exception has occurred */ +// OBSOLETE sigval = computeSignal(tt); +// OBSOLETE ptr = remcomOutBuffer; +// OBSOLETE +// OBSOLETE *ptr++ = 'T'; +// OBSOLETE *ptr++ = hexchars[sigval >> 4]; +// OBSOLETE *ptr++ = hexchars[sigval & 0xf]; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[PC >> 4]; +// OBSOLETE *ptr++ = hexchars[PC & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[FP >> 4]; +// OBSOLETE *ptr++ = hexchars[FP & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[SP >> 4]; +// OBSOLETE *ptr++ = hexchars[SP & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[NPC >> 4]; +// OBSOLETE *ptr++ = hexchars[NPC & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = hexchars[O7 >> 4]; +// OBSOLETE *ptr++ = hexchars[O7 & 0xf]; +// OBSOLETE *ptr++ = ':'; +// OBSOLETE ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); +// OBSOLETE *ptr++ = ';'; +// OBSOLETE +// OBSOLETE *ptr++ = 0; +// OBSOLETE +// OBSOLETE putpacket(remcomOutBuffer); +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE remcomOutBuffer[0] = 0; +// OBSOLETE +// OBSOLETE ptr = getpacket(); +// OBSOLETE switch (*ptr++) +// OBSOLETE { +// OBSOLETE case '?': +// OBSOLETE remcomOutBuffer[0] = 'S'; +// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4]; +// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf]; +// OBSOLETE remcomOutBuffer[3] = 0; +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'd': +// OBSOLETE remote_debug = !(remote_debug); /* toggle debug flag */ +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'g': /* return the value of the CPU registers */ +// OBSOLETE { +// OBSOLETE ptr = remcomOutBuffer; +// OBSOLETE ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ +// OBSOLETE ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ +// OBSOLETE memset(ptr, '0', 32 * 8); /* Floating point */ +// OBSOLETE ptr = mem2hex((char *)®isters[Y], +// OBSOLETE ptr + 32 * 4 * 2, +// OBSOLETE 8 * 4, +// OBSOLETE 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ +// OBSOLETE ptr = mem2hex((char *)®isters[CCSR], +// OBSOLETE ptr, +// OBSOLETE 8 * 4, +// OBSOLETE 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */ +// OBSOLETE ptr = mem2hex((char *)®isters[ASR1], +// OBSOLETE ptr, +// OBSOLETE 8 * 4, +// OBSOLETE 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */ +// OBSOLETE #if 0 /* not implemented */ +// OBSOLETE ptr = mem2hex((char *) ®isters[AWR0], +// OBSOLETE ptr, +// OBSOLETE 32 * 4, +// OBSOLETE 0); /* Alternate Window Registers */ +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'G': /* set value of all the CPU registers - return OK */ +// OBSOLETE case 'P': /* set value of one CPU register - return OK */ +// OBSOLETE { +// OBSOLETE unsigned long *newsp, psr; +// OBSOLETE +// OBSOLETE psr = registers[PSR]; +// OBSOLETE +// OBSOLETE if (ptr[-1] == 'P') /* do a single register */ +// OBSOLETE { +// OBSOLETE int regno; +// OBSOLETE +// OBSOLETE if (hexToInt (&ptr, ®no) +// OBSOLETE && *ptr++ == '=') +// OBSOLETE if (regno >= L0 && regno <= I7) +// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0); +// OBSOLETE else +// OBSOLETE hex2mem (ptr, (char *)®isters[regno], 4, 0); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE strcpy (remcomOutBuffer, "E01"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ +// OBSOLETE hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ +// OBSOLETE hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], +// OBSOLETE 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */ +// OBSOLETE hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR], +// OBSOLETE 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */ +// OBSOLETE hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1], +// OBSOLETE 8 * 4, 0); /* ASR1 ... ASR22 */ +// OBSOLETE #if 0 /* not implemented */ +// OBSOLETE hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0], +// OBSOLETE 8 * 4, 0); /* Alternate Window Registers */ +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved +// OBSOLETE locals and ins to the new location. This keeps the window +// OBSOLETE overflow and underflow routines happy. */ +// OBSOLETE +// OBSOLETE newsp = (unsigned long *)registers[SP]; +// OBSOLETE if (sp != newsp) +// OBSOLETE sp = memcpy(newsp, sp, 16 * 4); +// OBSOLETE +// OBSOLETE /* Don't allow CWP to be modified. */ +// OBSOLETE +// OBSOLETE if (psr != registers[PSR]) +// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); +// OBSOLETE +// OBSOLETE strcpy(remcomOutBuffer,"OK"); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ +// OBSOLETE /* Try to read %x,%x. */ +// OBSOLETE +// OBSOLETE if (hexToInt(&ptr, &addr) +// OBSOLETE && *ptr++ == ',' +// OBSOLETE && hexToInt(&ptr, &length)) +// OBSOLETE { +// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) +// OBSOLETE break; +// OBSOLETE +// OBSOLETE strcpy (remcomOutBuffer, "E03"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer,"E01"); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ +// OBSOLETE /* Try to read '%x,%x:'. */ +// OBSOLETE +// OBSOLETE if (hexToInt(&ptr, &addr) +// OBSOLETE && *ptr++ == ',' +// OBSOLETE && hexToInt(&ptr, &length) +// OBSOLETE && *ptr++ == ':') +// OBSOLETE { +// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1)) +// OBSOLETE strcpy(remcomOutBuffer, "OK"); +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer, "E03"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE strcpy(remcomOutBuffer, "E02"); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */ +// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */ +// OBSOLETE +// OBSOLETE if (hexToInt(&ptr, &addr)) +// OBSOLETE { +// OBSOLETE registers[PC] = addr; +// OBSOLETE registers[NPC] = addr + 4; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a +// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to +// OBSOLETE some location may have changed something that is in the instruction cache. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE flush_i_cache(); +// OBSOLETE return; +// OBSOLETE +// OBSOLETE /* kill the program */ +// OBSOLETE case 'k' : /* do nothing */ +// OBSOLETE break; +// OBSOLETE #if 0 +// OBSOLETE case 't': /* Test feature */ +// OBSOLETE asm (" std %f30,[%sp]"); +// OBSOLETE break; +// OBSOLETE #endif +// OBSOLETE case 'r': /* Reset */ +// OBSOLETE asm ("call 0 +// OBSOLETE nop "); +// OBSOLETE break; +// OBSOLETE } /* switch */ +// OBSOLETE +// OBSOLETE /* reply to the request */ +// OBSOLETE putpacket(remcomOutBuffer); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This function will generate a breakpoint exception. It is used at the +// OBSOLETE beginning of a program to sync up with a debugger and can be used +// OBSOLETE otherwise as a quick means to stop program execution and "break" into +// OBSOLETE the debugger. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE breakpoint (void) +// OBSOLETE { +// OBSOLETE if (!initialized) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE asm(" .globl _breakinst +// OBSOLETE +// OBSOLETE _breakinst: ta 1 +// OBSOLETE "); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE hw_breakpoint (void) +// OBSOLETE { +// OBSOLETE asm(" +// OBSOLETE ta 127 +// OBSOLETE "); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 /* experimental and never finished, left here for reference */ +// OBSOLETE static void +// OBSOLETE splet_temp(void) +// OBSOLETE { +// OBSOLETE asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals +// OBSOLETE ! + hidden arg + arg spill +// OBSOLETE ! + doubleword alignment +// OBSOLETE ! + registers[121] +// OBSOLETE +// OBSOLETE ! Leave a trail of breadcrumbs! (save register save area for debugging) +// OBSOLETE mov %sp, %l0 +// OBSOLETE add %l0, 24*4, %l0 +// OBSOLETE sethi %hi(_debug_registers), %l1 +// OBSOLETE st %l0, [%lo(_debug_registers) + %l1] +// OBSOLETE +// OBSOLETE ! Save the Alternate Register Set: (not implemented yet) +// OBSOLETE ! To save the Alternate Register set, we must: +// OBSOLETE ! 1) Save the current SP in some global location. +// OBSOLETE ! 2) Swap the register sets. +// OBSOLETE ! 3) Save the Alternate SP in the Y register +// OBSOLETE ! 4) Fetch the SP that we saved in step 1. +// OBSOLETE ! 5) Use that to save the rest of the regs (not forgetting ASP in Y) +// OBSOLETE ! 6) Restore the Alternate SP from Y +// OBSOLETE ! 7) Swap the registers back. +// OBSOLETE +// OBSOLETE ! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER: +// OBSOLETE sethi %hi(_saved_stack_pointer), %l0 +// OBSOLETE st %sp, [%lo(_saved_stack_pointer) + %l0] +// OBSOLETE +// OBSOLETE ! 2) Swap the register sets: +// OBSOLETE mov %psr, %l1 +// OBSOLETE sethi %hi(0x10000), %l2 +// OBSOLETE xor %l1, %l2, %l1 +// OBSOLETE mov %l1, %psr +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE +// OBSOLETE ! 3) Save Alternate L0 in Y +// OBSOLETE wr %l0, 0, %y +// OBSOLETE +// OBSOLETE ! 4) Load former SP into alternate SP, using L0 +// OBSOLETE sethi %hi(_saved_stack_pointer), %l0 +// OBSOLETE or %lo(_saved_stack_pointer), %l0, %l0 +// OBSOLETE swap [%l0], %sp +// OBSOLETE +// OBSOLETE ! 4.5) Restore alternate L0 +// OBSOLETE rd %y, %l0 +// OBSOLETE +// OBSOLETE ! 5) Save the Alternate Window Registers +// OBSOLETE st %r0, [%sp + (24 + 88) * 4] ! AWR0 +// OBSOLETE st %r1, [%sp + (24 + 89) * 4] ! AWR1 +// OBSOLETE st %r2, [%sp + (24 + 90) * 4] ! AWR2 +// OBSOLETE st %r3, [%sp + (24 + 91) * 4] ! AWR3 +// OBSOLETE st %r4, [%sp + (24 + 92) * 4] ! AWR4 +// OBSOLETE st %r5, [%sp + (24 + 93) * 4] ! AWR5 +// OBSOLETE st %r6, [%sp + (24 + 94) * 4] ! AWR6 +// OBSOLETE st %r7, [%sp + (24 + 95) * 4] ! AWR7 +// OBSOLETE st %r8, [%sp + (24 + 96) * 4] ! AWR8 +// OBSOLETE st %r9, [%sp + (24 + 97) * 4] ! AWR9 +// OBSOLETE st %r10, [%sp + (24 + 98) * 4] ! AWR10 +// OBSOLETE st %r11, [%sp + (24 + 99) * 4] ! AWR11 +// OBSOLETE st %r12, [%sp + (24 + 100) * 4] ! AWR12 +// OBSOLETE st %r13, [%sp + (24 + 101) * 4] ! AWR13 +// OBSOLETE ! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP) +// OBSOLETE st %r15, [%sp + (24 + 103) * 4] ! AWR15 +// OBSOLETE st %r16, [%sp + (24 + 104) * 4] ! AWR16 +// OBSOLETE st %r17, [%sp + (24 + 105) * 4] ! AWR17 +// OBSOLETE st %r18, [%sp + (24 + 106) * 4] ! AWR18 +// OBSOLETE st %r19, [%sp + (24 + 107) * 4] ! AWR19 +// OBSOLETE st %r20, [%sp + (24 + 108) * 4] ! AWR20 +// OBSOLETE st %r21, [%sp + (24 + 109) * 4] ! AWR21 +// OBSOLETE st %r22, [%sp + (24 + 110) * 4] ! AWR22 +// OBSOLETE st %r23, [%sp + (24 + 111) * 4] ! AWR23 +// OBSOLETE st %r24, [%sp + (24 + 112) * 4] ! AWR24 +// OBSOLETE st %r25, [%sp + (24 + 113) * 4] ! AWR25 +// OBSOLETE st %r26, [%sp + (24 + 114) * 4] ! AWR26 +// OBSOLETE st %r27, [%sp + (24 + 115) * 4] ! AWR27 +// OBSOLETE st %r28, [%sp + (24 + 116) * 4] ! AWR28 +// OBSOLETE st %r29, [%sp + (24 + 117) * 4] ! AWR29 +// OBSOLETE st %r30, [%sp + (24 + 118) * 4] ! AWR30 +// OBSOLETE st %r31, [%sp + (24 + 119) * 4] ! AWR21 +// OBSOLETE +// OBSOLETE ! Get the Alternate PSR (I hope...) +// OBSOLETE +// OBSOLETE rd %psr, %l2 +// OBSOLETE st %l2, [%sp + (24 + 120) * 4] ! APSR +// OBSOLETE +// OBSOLETE ! Don't forget the alternate stack pointer +// OBSOLETE +// OBSOLETE rd %y, %l3 +// OBSOLETE st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP) +// OBSOLETE +// OBSOLETE ! 6) Restore the Alternate SP (saved in Y) +// OBSOLETE +// OBSOLETE rd %y, %o6 +// OBSOLETE +// OBSOLETE +// OBSOLETE ! 7) Swap the registers back: +// OBSOLETE +// OBSOLETE mov %psr, %l1 +// OBSOLETE sethi %hi(0x10000), %l2 +// OBSOLETE xor %l1, %l2, %l1 +// OBSOLETE mov %l1, %psr +// OBSOLETE nop ! 3 nops after write to %psr (needed?) +// OBSOLETE nop +// OBSOLETE nop +// OBSOLETE "); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct serial; + void load_srec (struct serial *desc, const char *file, bfd_vma load_offset, int maxrecsize, int flags, int hashmark, int (*waitack) (void)); diff --git a/gdb/stabsread.h b/gdb/stabsread.h index 62fd776..b70f162 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct objfile; + /* Definitions, prototypes, etc for stabs debugging format support functions. diff --git a/gdb/stack.c b/gdb/stack.c index d8ac980..d0dbc59 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -217,7 +217,7 @@ print_frame_info (struct frame_info *fi, int level, int source, int args) if (ui_out_is_mi_like_p (uiout)) { annotate_frame_address (); - ui_out_field_core_addr (uiout, "addr", fi->pc); + ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi)); annotate_frame_address_end (); } @@ -601,16 +601,6 @@ parse_frame_specification (char *frame_exp) /* NOTREACHED */ } -/* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except - that if it is unsure about the answer, it returns 0 - instead of guessing (this happens on the VAX and i960, for example). - - On most machines, we never have to guess about the args address, - so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */ -#if !defined (FRAME_ARGS_ADDRESS_CORRECT) -#define FRAME_ARGS_ADDRESS_CORRECT FRAME_ARGS_ADDRESS -#endif - /* Print verbosely the selected frame or the frame at address ADDR. This means absolutely all information in the frame is printed. */ @@ -744,7 +734,7 @@ frame_info (char *addr_exp, int from_tty) { /* Address of the argument list for this frame, or 0. */ - CORE_ADDR arg_list = FRAME_ARGS_ADDRESS_CORRECT (fi); + CORE_ADDR arg_list = get_frame_args_address (fi); /* Number of args for this frame, or -1 if unknown. */ int numargs; @@ -771,7 +761,7 @@ frame_info (char *addr_exp, int from_tty) } { /* Address of the local variables for this frame, or 0. */ - CORE_ADDR arg_list = FRAME_LOCALS_ADDRESS (fi); + CORE_ADDR arg_list = get_frame_locals_address (fi); if (arg_list == 0) printf_filtered (" Locals at unknown address,"); @@ -1641,9 +1631,13 @@ return_command (char *retval_exp, int from_tty) that. */ /* Do the real work. Pop until the specified frame is current. We - use this method because the deprecated_selected_frame is not valid after - a POP_FRAME. The pc comparison makes this work even if the - selected frame shares its fp with another frame. */ + use this method because the deprecated_selected_frame is not + valid after a frame_pop(). The pc comparison makes this work + even if the selected frame shares its fp with another frame. */ + + /* FIXME: cagney/32003-03-12: This code should use frame_id_eq(). + Unfortunatly, that function doesn't yet include the PC in any + frame ID comparison. */ while (selected_frame_addr != get_frame_base (frame = get_current_frame ()) || selected_frame_pc != get_frame_pc (frame)) diff --git a/gdb/symfile.c b/gdb/symfile.c index 69c07f0..aa831fb 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3550,7 +3550,7 @@ symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf) all sections begin at 0. */ bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL); - return bfd_simple_get_relocated_section_contents (abfd, sectp, buf); + return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL); } void diff --git a/gdb/symfile.h b/gdb/symfile.h index 3c055c0..06dfd7d 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -26,7 +26,7 @@ /* This file requires that you first include "bfd.h" and "symtab.h". */ /* Opaque declarations. */ - +struct objfile; struct obstack; struct block; diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c index 79caf5a..c4b2c9a 100644 --- a/gdb/symm-nat.c +++ b/gdb/symm-nat.c @@ -1,902 +1,902 @@ -/* Sequent Symmetry host interface, for GDB when running under Unix. - - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999, - 2000, 2001, 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. */ - -/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be - merged back in. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" -#include "target.h" -#include "regcache.h" - -/* FIXME: What is the _INKERNEL define for? */ -#define _INKERNEL -#include <signal.h> -#undef _INKERNEL -#include "gdb_wait.h" -#include <sys/param.h> -#include <sys/user.h> -#include <sys/proc.h> -#include <sys/dir.h> -#include <sys/ioctl.h> -#include "gdb_stat.h" -#ifdef _SEQUENT_ -#include <sys/ptrace.h> -#else -/* Dynix has only machine/ptrace.h, which is already included by sys/user.h */ -/* Dynix has no mptrace call */ -#define mptrace ptrace -#endif -#include "gdbcore.h" -#include <fcntl.h> -#include <sgtty.h> -#define TERMINAL struct sgttyb - -#include "gdbcore.h" - -void -store_inferior_registers (int regno) -{ - struct pt_regset regs; - int i; - - /* FIXME: Fetching the registers is a kludge to initialize all elements - in the fpu and fpa status. This works for normal debugging, but - might cause problems when calling functions in the inferior. - At least fpu_control and fpa_pcr (probably more) should be added - to the registers array to solve this properly. */ - mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); - - regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)]; - regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)]; - regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)]; - regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)]; - regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)]; - regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)]; - regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)]; - regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)]; - regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)]; - regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)]; - for (i = 0; i < 31; i++) - { - regs.pr_fpa.fpa_regs[i] = - *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)]; - } - memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10); - memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10); - mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); -} - -void -fetch_inferior_registers (int regno) -{ - int i; - struct pt_regset regs; - - deprecated_registers_fetched (); - - mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); - *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax; - *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx; - *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx; - *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx; - *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi; - *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi; - *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp; - *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp; - *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip; - *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags; - for (i = 0; i < FPA_NREGS; i++) - { - *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] = - regs.pr_fpa.fpa_regs[i]; - } - memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); - memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); -} - -/* FIXME: This should be merged with i387-tdep.c as well. */ -static -print_fpu_status (struct pt_regset ep) -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - printf_unfiltered ("80387:"); - if (ep.pr_fpu.fpu_ip == 0) - { - printf_unfiltered (" not in use.\n"); - return; - } - else - { - printf_unfiltered ("\n"); - } - if (ep.pr_fpu.fpu_status != 0) - { - print_387_status_word (ep.pr_fpu.fpu_status); - } - print_387_control_word (ep.pr_fpu.fpu_control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4); - printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip); - printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel); - - top = (ep.pr_fpu.fpu_status >> 11) & 7; - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3) - { - case 0: - printf_unfiltered ("valid "); - break; - case 1: - printf_unfiltered ("zero "); - break; - case 2: - printf_unfiltered ("trap "); - break; - case 3: - printf_unfiltered ("empty "); - break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]); - - i387_to_double ((char *) ep.pr_fpu.fpu_stack[fpreg], (char *) &val); - printf_unfiltered (" %g\n", val); - } - if (ep.pr_fpu.fpu_rsvd1) - warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1); - if (ep.pr_fpu.fpu_rsvd2) - warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2); - if (ep.pr_fpu.fpu_rsvd3) - warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3); - if (ep.pr_fpu.fpu_rsvd5) - warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5); -} - - -print_1167_control_word (unsigned int pcr) -{ - int pcr_tmp; - - pcr_tmp = pcr & FPA_PCR_MODE; - printf_unfiltered ("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12); - switch (pcr_tmp & 12) - { - case 0: - printf_unfiltered ("RN (Nearest Value)"); - break; - case 1: - printf_unfiltered ("RZ (Zero)"); - break; - case 2: - printf_unfiltered ("RP (Positive Infinity)"); - break; - case 3: - printf_unfiltered ("RM (Negative Infinity)"); - break; - } - printf_unfiltered ("; IRND= %d ", pcr_tmp & 2); - if (0 == pcr_tmp & 2) - { - printf_unfiltered ("(same as RND)\n"); - } - else - { - printf_unfiltered ("(toward zero)\n"); - } - pcr_tmp = pcr & FPA_PCR_EM; - printf_unfiltered ("\tEM= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_EM_DM) - printf_unfiltered (" DM"); - if (pcr_tmp & FPA_PCR_EM_UOM) - printf_unfiltered (" UOM"); - if (pcr_tmp & FPA_PCR_EM_PM) - printf_unfiltered (" PM"); - if (pcr_tmp & FPA_PCR_EM_UM) - printf_unfiltered (" UM"); - if (pcr_tmp & FPA_PCR_EM_OM) - printf_unfiltered (" OM"); - if (pcr_tmp & FPA_PCR_EM_ZM) - printf_unfiltered (" ZM"); - if (pcr_tmp & FPA_PCR_EM_IM) - printf_unfiltered (" IM"); - printf_unfiltered ("\n"); - pcr_tmp = FPA_PCR_CC; - printf_unfiltered ("\tCC= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_20MHZ) - printf_unfiltered (" 20MHZ"); - if (pcr_tmp & FPA_PCR_CC_Z) - printf_unfiltered (" Z"); - if (pcr_tmp & FPA_PCR_CC_C2) - printf_unfiltered (" C2"); - - /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines - FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume - the OS knows what it is doing. */ -#ifdef FPA_PCR_CC_C1 - if (pcr_tmp & FPA_PCR_CC_C1) - printf_unfiltered (" C1"); -#else - if (pcr_tmp & FPA_PCR_CC_C0) - printf_unfiltered (" C0"); -#endif - - switch (pcr_tmp) - { - case FPA_PCR_CC_Z: - printf_unfiltered (" (Equal)"); - break; -#ifdef FPA_PCR_CC_C1 - case FPA_PCR_CC_C1: -#else - case FPA_PCR_CC_C0: -#endif - printf_unfiltered (" (Less than)"); - break; - case 0: - printf_unfiltered (" (Greater than)"); - break; - case FPA_PCR_CC_Z | -#ifdef FPA_PCR_CC_C1 - FPA_PCR_CC_C1 -#else - FPA_PCR_CC_C0 -#endif - | FPA_PCR_CC_C2: - printf_unfiltered (" (Unordered)"); - break; - default: - printf_unfiltered (" (Undefined)"); - break; - } - printf_unfiltered ("\n"); - pcr_tmp = pcr & FPA_PCR_AE; - printf_unfiltered ("\tAE= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_AE_DE) - printf_unfiltered (" DE"); - if (pcr_tmp & FPA_PCR_AE_UOE) - printf_unfiltered (" UOE"); - if (pcr_tmp & FPA_PCR_AE_PE) - printf_unfiltered (" PE"); - if (pcr_tmp & FPA_PCR_AE_UE) - printf_unfiltered (" UE"); - if (pcr_tmp & FPA_PCR_AE_OE) - printf_unfiltered (" OE"); - if (pcr_tmp & FPA_PCR_AE_ZE) - printf_unfiltered (" ZE"); - if (pcr_tmp & FPA_PCR_AE_EE) - printf_unfiltered (" EE"); - if (pcr_tmp & FPA_PCR_AE_IE) - printf_unfiltered (" IE"); - printf_unfiltered ("\n"); -} - -print_1167_regs (long regs[FPA_NREGS]) -{ - int i; - - union - { - double d; - long l[2]; - } - xd; - union - { - float f; - long l; - } - xf; - - - for (i = 0; i < FPA_NREGS; i++) - { - xf.l = regs[i]; - printf_unfiltered ("%%fp%d: raw= %#x, single= %f", i + 1, regs[i], xf.f); - if (!(i & 1)) - { - printf_unfiltered ("\n"); - } - else - { - xd.l[1] = regs[i]; - xd.l[0] = regs[i + 1]; - printf_unfiltered (", double= %f\n", xd.d); - } - } -} - -print_fpa_status (struct pt_regset ep) -{ - - printf_unfiltered ("WTL 1167:"); - if (ep.pr_fpa.fpa_pcr != 0) - { - printf_unfiltered ("\n"); - print_1167_control_word (ep.pr_fpa.fpa_pcr); - print_1167_regs (ep.pr_fpa.fpa_regs); - } - else - { - printf_unfiltered (" not in use.\n"); - } -} - -#if 0 /* disabled because it doesn't go through the target vector. */ -i386_float_info (void) -{ - char ubuf[UPAGES * NBPG]; - struct pt_regset regset; - - if (have_inferior_p ()) - { - PTRACE_READ_REGS (PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regset); - } - else - { - int corechan = bfd_cache_lookup (core_bfd); - if (lseek (corechan, 0, 0) < 0) - { - perror ("seek on core file"); - } - if (myread (corechan, ubuf, UPAGES * NBPG) < 0) - { - perror ("read on core file"); - } - /* only interested in the floating point registers */ - regset.pr_fpu = ((struct user *) ubuf)->u_fpusave; - regset.pr_fpa = ((struct user *) ubuf)->u_fpasave; - } - print_fpu_status (regset); - print_fpa_status (regset); -} -#endif - -static volatile int got_sigchld; - -/*ARGSUSED */ -/* This will eventually be more interesting. */ -void -sigchld_handler (int signo) -{ - got_sigchld++; -} - -/* - * Signals for which the default action does not cause the process - * to die. See <sys/signal.h> for where this came from (alas, we - * can't use those macros directly) - */ -#ifndef sigmask -#define sigmask(s) (1 << ((s) - 1)) -#endif -#define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ - sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \ - sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \ - sigmask(SIGURG) | sigmask(SIGPOLL) - -#ifdef ATTACH_DETACH -/* - * Thanks to XPT_MPDEBUGGER, we have to mange child_wait(). - */ -ptid_t -child_wait (ptid_t ptid, struct target_waitstatus *status) -{ - int save_errno, rv, xvaloff, saoff, sa_hand; - struct pt_stop pt; - struct user u; - sigset_t set; - /* Host signal number for a signal which the inferior terminates with, or - 0 if it hasn't terminated due to a signal. */ - static int death_by_signal = 0; -#ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */ - prstatus_t pstatus; -#endif - int pid = PIDGET (ptid); - - do - { - set_sigint_trap (); /* Causes SIGINT to be passed on to the - attached process. */ - save_errno = errno; - - got_sigchld = 0; - - sigemptyset (&set); - - while (got_sigchld == 0) - { - sigsuspend (&set); - } - - clear_sigint_trap (); - - rv = mptrace (XPT_STOPSTAT, 0, (char *) &pt, 0); - if (-1 == rv) - { - printf ("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */ - continue; - } - - pid = pt.ps_pid; - - if (pid != PIDGET (inferior_ptid)) - { - /* NOTE: the mystery fork in csh/tcsh needs to be ignored. - * We should not return new children for the initial run - * of a process until it has done the exec. - */ - /* inferior probably forked; send it on its way */ - rv = mptrace (XPT_UNDEBUG, pid, 0, 0); - if (-1 == rv) - { - printf ("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid, - safe_strerror (errno)); - } - continue; - } - /* FIXME: Do we deal with fork notification correctly? */ - switch (pt.ps_reason) - { - case PTS_FORK: - /* multi proc: treat like PTS_EXEC */ - /* - * Pretend this didn't happen, since gdb isn't set up - * to deal with stops on fork. - */ - rv = ptrace (PT_CONTSIG, pid, 1, 0); - if (-1 == rv) - { - printf ("PTS_FORK: PT_CONTSIG: error %d\n", errno); - } - continue; - case PTS_EXEC: - /* - * Pretend this is a SIGTRAP. - */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - break; - case PTS_EXIT: - /* - * Note: we stop before the exit actually occurs. Extract - * the exit code from the uarea. If we're stopped in the - * exit() system call, the exit code will be in - * u.u_ap[0]. An exit due to an uncaught signal will have - * something else in here, see the comment in the default: - * case, below. Finally,let the process exit. - */ - if (death_by_signal) - { - status->kind = TARGET_WAITKIND_SIGNALED; - status->value.sig = target_signal_from_host (death_by_signal); - death_by_signal = 0; - break; - } - xvaloff = (unsigned long) &u.u_ap[0] - (unsigned long) &u; - errno = 0; - rv = ptrace (PT_RUSER, pid, (char *) xvaloff, 0); - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = rv; - /* - * addr & data to mptrace() don't matter here, since - * the process is already dead. - */ - rv = mptrace (XPT_UNDEBUG, pid, 0, 0); - if (-1 == rv) - { - printf ("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid, - errno); - } - break; - case PTS_WATCHPT_HIT: - internal_error (__FILE__, __LINE__, - "PTS_WATCHPT_HIT\n"); - break; - default: - /* stopped by signal */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = target_signal_from_host (pt.ps_reason); - death_by_signal = 0; - - if (0 == (SIGNALS_DFL_SAFE & sigmask (pt.ps_reason))) - { - break; - } - /* else default action of signal is to die */ -#ifdef SVR4_SHARED_LIBS - rv = ptrace (PT_GET_PRSTATUS, pid, (char *) &pstatus, 0); - if (-1 == rv) - error ("child_wait: signal %d PT_GET_PRSTATUS: %s\n", - pt.ps_reason, safe_strerror (errno)); - if (pstatus.pr_cursig != pt.ps_reason) - { - printf ("pstatus signal %d, pt signal %d\n", - pstatus.pr_cursig, pt.ps_reason); - } - sa_hand = (int) pstatus.pr_action.sa_handler; -#else - saoff = (unsigned long) &u.u_sa[0] - (unsigned long) &u; - saoff += sizeof (struct sigaction) * (pt.ps_reason - 1); - errno = 0; - sa_hand = ptrace (PT_RUSER, pid, (char *) saoff, 0); - if (errno) - error ("child_wait: signal %d: RUSER: %s\n", - pt.ps_reason, safe_strerror (errno)); -#endif - if ((int) SIG_DFL == sa_hand) - { - /* we will be dying */ - death_by_signal = pt.ps_reason; - } - break; - } - - } - while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ - - return pid_to_ptid (pid); -} -#else /* !ATTACH_DETACH */ -/* - * Simple child_wait() based on inftarg.c child_wait() for use until - * the MPDEBUGGER child_wait() works properly. This will go away when - * that is fixed. - */ -ptid_t -child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) -{ - int save_errno; - int status; - int pid = PIDGET (ptid); - - do - { - pid = wait (&status); - save_errno = errno; - - if (pid == -1) - { - if (save_errno == EINTR) - continue; - fprintf (stderr, "Child process unexpectedly missing: %s.\n", - safe_strerror (save_errno)); - ourstatus->kind = TARGET_WAITKIND_SIGNALLED; - ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; - return pid_to_ptid (-1); - } - } - while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ - store_waitstatus (ourstatus, status); - return pid_to_ptid (pid); -} -#endif /* ATTACH_DETACH */ - - - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) -{ - return ptrace (request, pid, addr, data); -} - -int -call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) -{ - return mptrace (request, pid, addr, data); -} - -#if defined (DEBUG_PTRACE) -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#define mptrace call_mptrace -#endif - -void -kill_inferior (void) -{ - if (ptid_equal (inferior_ptid, null_ptid)) - return; - - /* For MPDEBUGGER, don't use PT_KILL, since the child will stop - again with a PTS_EXIT. Just hit him with SIGKILL (so he stops) - and detach. */ - - kill (PIDGET (inferior_ptid), SIGKILL); -#ifdef ATTACH_DETACH - detach (SIGKILL); -#else /* ATTACH_DETACH */ - ptrace (PT_KILL, PIDGET (inferior_ptid), 0, 0); - wait ((int *) NULL); -#endif /* ATTACH_DETACH */ - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (ptid_t ptid, int step, enum target_signal signal) -{ - int pid = PIDGET (ptid); - - errno = 0; - - if (pid == -1) - pid = PIDGET (inferior_ptid); - - /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) - - If this system does not support PT_SSTEP, a higher level function will - have called single_step() to transmute the step request into a - continue request (by setting breakpoints on all possible successor - instructions), so we don't have to worry about that here. */ - - if (step) - ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal); - else - ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Start debugging the process whose number is PID. */ -int -attach (int pid) -{ - sigset_t set; - int rv; - - rv = mptrace (XPT_DEBUG, pid, 0, 0); - if (-1 == rv) - { - error ("mptrace(XPT_DEBUG): %s", safe_strerror (errno)); - } - rv = mptrace (XPT_SIGNAL, pid, 0, SIGSTOP); - if (-1 == rv) - { - error ("mptrace(XPT_SIGNAL): %s", safe_strerror (errno)); - } - attach_flag = 1; - return pid; -} - -void -detach (int signo) -{ - int rv; - - rv = mptrace (XPT_UNDEBUG, PIDGET (inferior_ptid), 1, signo); - if (-1 == rv) - { - error ("mptrace(XPT_UNDEBUG): %s", safe_strerror (errno)); - } - attach_flag = 0; -} - -#endif /* ATTACH_DETACH */ - -/* Default the type of the ptrace transfer to int. */ -#ifndef PTRACE_XFER_TYPE -#define PTRACE_XFER_TYPE int -#endif - - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. TARGET is ignored. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, - struct target_ops *target) -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) - / sizeof (PTRACE_XFER_TYPE); - /* Allocate buffer of that many longwords. */ - /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe - because it uses alloca to allocate a buffer of arbitrary size. - For very large xfers, this could crash GDB's stack. */ - register PTRACE_XFER_TYPE *buffer - = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) - { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, - 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_RTEXT, PIDGET (inferior_ptid), - ((PTRACE_ARG3_TYPE) - (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), - 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - myaddr, - len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - ptrace (PT_WDATA, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, - buffer[i]); - if (errno) - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, - buffer[i]); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) - { - errno = 0; - buffer[i] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) addr, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - memcpy (myaddr, - (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), - len); - } - return len; -} - - -void -_initialize_symm_nat (void) -{ -#ifdef ATTACH_DETACH -/* - * the MPDEBUGGER is necessary for process tree debugging and attach - * to work, but it alters the behavior of debugged processes, so other - * things (at least child_wait()) will have to change to accomodate - * that. - * - * Note that attach is not implemented in dynix 3, and not in ptx - * until version 2.1 of the OS. - */ - int rv; - sigset_t set; - struct sigaction sact; - - rv = mptrace (XPT_MPDEBUGGER, 0, 0, 0); - if (-1 == rv) - { - internal_error (__FILE__, __LINE__, - "_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s", - safe_strerror (errno)); - } - - /* - * Under MPDEBUGGER, we get SIGCLHD when a traced process does - * anything of interest. - */ - - /* - * Block SIGCHLD. We leave it blocked all the time, and then - * call sigsuspend() in child_wait() to wait for the child - * to do something. None of these ought to fail, but check anyway. - */ - sigemptyset (&set); - rv = sigaddset (&set, SIGCHLD); - if (-1 == rv) - { - internal_error (__FILE__, __LINE__, - "_initialize_symm_nat(): sigaddset(SIGCHLD): %s", - safe_strerror (errno)); - } - rv = sigprocmask (SIG_BLOCK, &set, (sigset_t *) NULL); - if (-1 == rv) - { - internal_error (__FILE__, __LINE__, - "_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s", - safe_strerror (errno)); - } - - sact.sa_handler = sigchld_handler; - sigemptyset (&sact.sa_mask); - sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */ - rv = sigaction (SIGCHLD, &sact, (struct sigaction *) NULL); - if (-1 == rv) - { - internal_error (__FILE__, __LINE__, - "_initialize_symm_nat(): sigaction(SIGCHLD): %s", - safe_strerror (errno)); - } -#endif -} +// OBSOLETE /* Sequent Symmetry host interface, for GDB when running under Unix. +// OBSOLETE +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999, +// OBSOLETE 2000, 2001, 2003 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be +// OBSOLETE merged back in. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "frame.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* FIXME: What is the _INKERNEL define for? */ +// OBSOLETE #define _INKERNEL +// OBSOLETE #include <signal.h> +// OBSOLETE #undef _INKERNEL +// OBSOLETE #include "gdb_wait.h" +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/user.h> +// OBSOLETE #include <sys/proc.h> +// OBSOLETE #include <sys/dir.h> +// OBSOLETE #include <sys/ioctl.h> +// OBSOLETE #include "gdb_stat.h" +// OBSOLETE #ifdef _SEQUENT_ +// OBSOLETE #include <sys/ptrace.h> +// OBSOLETE #else +// OBSOLETE /* Dynix has only machine/ptrace.h, which is already included by sys/user.h */ +// OBSOLETE /* Dynix has no mptrace call */ +// OBSOLETE #define mptrace ptrace +// OBSOLETE #endif +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include <fcntl.h> +// OBSOLETE #include <sgtty.h> +// OBSOLETE #define TERMINAL struct sgttyb +// OBSOLETE +// OBSOLETE #include "gdbcore.h" +// OBSOLETE +// OBSOLETE void +// OBSOLETE store_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE struct pt_regset regs; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE /* FIXME: Fetching the registers is a kludge to initialize all elements +// OBSOLETE in the fpu and fpa status. This works for normal debugging, but +// OBSOLETE might cause problems when calling functions in the inferior. +// OBSOLETE At least fpu_control and fpa_pcr (probably more) should be added +// OBSOLETE to the registers array to solve this properly. */ +// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); +// OBSOLETE +// OBSOLETE regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)]; +// OBSOLETE regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)]; +// OBSOLETE regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)]; +// OBSOLETE regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)]; +// OBSOLETE regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)]; +// OBSOLETE regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)]; +// OBSOLETE regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)]; +// OBSOLETE regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)]; +// OBSOLETE regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)]; +// OBSOLETE regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)]; +// OBSOLETE for (i = 0; i < 31; i++) +// OBSOLETE { +// OBSOLETE regs.pr_fpa.fpa_regs[i] = +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)]; +// OBSOLETE } +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10); +// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10); +// OBSOLETE mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE fetch_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE struct pt_regset regs; +// OBSOLETE +// OBSOLETE deprecated_registers_fetched (); +// OBSOLETE +// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0); +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax; +// OBSOLETE *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip; +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags; +// OBSOLETE for (i = 0; i < FPA_NREGS; i++) +// OBSOLETE { +// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] = +// OBSOLETE regs.pr_fpa.fpa_regs[i]; +// OBSOLETE } +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10); +// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* FIXME: This should be merged with i387-tdep.c as well. */ +// OBSOLETE static +// OBSOLETE print_fpu_status (struct pt_regset ep) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE int bothstatus; +// OBSOLETE int top; +// OBSOLETE int fpreg; +// OBSOLETE unsigned char *p; +// OBSOLETE +// OBSOLETE printf_unfiltered ("80387:"); +// OBSOLETE if (ep.pr_fpu.fpu_ip == 0) +// OBSOLETE { +// OBSOLETE printf_unfiltered (" not in use.\n"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE } +// OBSOLETE if (ep.pr_fpu.fpu_status != 0) +// OBSOLETE { +// OBSOLETE print_387_status_word (ep.pr_fpu.fpu_status); +// OBSOLETE } +// OBSOLETE print_387_control_word (ep.pr_fpu.fpu_control); +// OBSOLETE printf_unfiltered ("last exception: "); +// OBSOLETE printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4); +// OBSOLETE printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip); +// OBSOLETE printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel); +// OBSOLETE +// OBSOLETE top = (ep.pr_fpu.fpu_status >> 11) & 7; +// OBSOLETE +// OBSOLETE printf_unfiltered ("regno tag msb lsb value\n"); +// OBSOLETE for (fpreg = 7; fpreg >= 0; fpreg--) +// OBSOLETE { +// OBSOLETE double val; +// OBSOLETE +// OBSOLETE printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); +// OBSOLETE +// OBSOLETE switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3) +// OBSOLETE { +// OBSOLETE case 0: +// OBSOLETE printf_unfiltered ("valid "); +// OBSOLETE break; +// OBSOLETE case 1: +// OBSOLETE printf_unfiltered ("zero "); +// OBSOLETE break; +// OBSOLETE case 2: +// OBSOLETE printf_unfiltered ("trap "); +// OBSOLETE break; +// OBSOLETE case 3: +// OBSOLETE printf_unfiltered ("empty "); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE for (i = 9; i >= 0; i--) +// OBSOLETE printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]); +// OBSOLETE +// OBSOLETE i387_to_double ((char *) ep.pr_fpu.fpu_stack[fpreg], (char *) &val); +// OBSOLETE printf_unfiltered (" %g\n", val); +// OBSOLETE } +// OBSOLETE if (ep.pr_fpu.fpu_rsvd1) +// OBSOLETE warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1); +// OBSOLETE if (ep.pr_fpu.fpu_rsvd2) +// OBSOLETE warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2); +// OBSOLETE if (ep.pr_fpu.fpu_rsvd3) +// OBSOLETE warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3); +// OBSOLETE if (ep.pr_fpu.fpu_rsvd5) +// OBSOLETE warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE print_1167_control_word (unsigned int pcr) +// OBSOLETE { +// OBSOLETE int pcr_tmp; +// OBSOLETE +// OBSOLETE pcr_tmp = pcr & FPA_PCR_MODE; +// OBSOLETE printf_unfiltered ("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12); +// OBSOLETE switch (pcr_tmp & 12) +// OBSOLETE { +// OBSOLETE case 0: +// OBSOLETE printf_unfiltered ("RN (Nearest Value)"); +// OBSOLETE break; +// OBSOLETE case 1: +// OBSOLETE printf_unfiltered ("RZ (Zero)"); +// OBSOLETE break; +// OBSOLETE case 2: +// OBSOLETE printf_unfiltered ("RP (Positive Infinity)"); +// OBSOLETE break; +// OBSOLETE case 3: +// OBSOLETE printf_unfiltered ("RM (Negative Infinity)"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE printf_unfiltered ("; IRND= %d ", pcr_tmp & 2); +// OBSOLETE if (0 == pcr_tmp & 2) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("(same as RND)\n"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE printf_unfiltered ("(toward zero)\n"); +// OBSOLETE } +// OBSOLETE pcr_tmp = pcr & FPA_PCR_EM; +// OBSOLETE printf_unfiltered ("\tEM= %#x", pcr_tmp); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_DM) +// OBSOLETE printf_unfiltered (" DM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UOM) +// OBSOLETE printf_unfiltered (" UOM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_PM) +// OBSOLETE printf_unfiltered (" PM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UM) +// OBSOLETE printf_unfiltered (" UM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_OM) +// OBSOLETE printf_unfiltered (" OM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_ZM) +// OBSOLETE printf_unfiltered (" ZM"); +// OBSOLETE if (pcr_tmp & FPA_PCR_EM_IM) +// OBSOLETE printf_unfiltered (" IM"); +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE pcr_tmp = FPA_PCR_CC; +// OBSOLETE printf_unfiltered ("\tCC= %#x", pcr_tmp); +// OBSOLETE if (pcr_tmp & FPA_PCR_20MHZ) +// OBSOLETE printf_unfiltered (" 20MHZ"); +// OBSOLETE if (pcr_tmp & FPA_PCR_CC_Z) +// OBSOLETE printf_unfiltered (" Z"); +// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C2) +// OBSOLETE printf_unfiltered (" C2"); +// OBSOLETE +// OBSOLETE /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines +// OBSOLETE FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume +// OBSOLETE the OS knows what it is doing. */ +// OBSOLETE #ifdef FPA_PCR_CC_C1 +// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C1) +// OBSOLETE printf_unfiltered (" C1"); +// OBSOLETE #else +// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C0) +// OBSOLETE printf_unfiltered (" C0"); +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE switch (pcr_tmp) +// OBSOLETE { +// OBSOLETE case FPA_PCR_CC_Z: +// OBSOLETE printf_unfiltered (" (Equal)"); +// OBSOLETE break; +// OBSOLETE #ifdef FPA_PCR_CC_C1 +// OBSOLETE case FPA_PCR_CC_C1: +// OBSOLETE #else +// OBSOLETE case FPA_PCR_CC_C0: +// OBSOLETE #endif +// OBSOLETE printf_unfiltered (" (Less than)"); +// OBSOLETE break; +// OBSOLETE case 0: +// OBSOLETE printf_unfiltered (" (Greater than)"); +// OBSOLETE break; +// OBSOLETE case FPA_PCR_CC_Z | +// OBSOLETE #ifdef FPA_PCR_CC_C1 +// OBSOLETE FPA_PCR_CC_C1 +// OBSOLETE #else +// OBSOLETE FPA_PCR_CC_C0 +// OBSOLETE #endif +// OBSOLETE | FPA_PCR_CC_C2: +// OBSOLETE printf_unfiltered (" (Unordered)"); +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE printf_unfiltered (" (Undefined)"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE pcr_tmp = pcr & FPA_PCR_AE; +// OBSOLETE printf_unfiltered ("\tAE= %#x", pcr_tmp); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_DE) +// OBSOLETE printf_unfiltered (" DE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UOE) +// OBSOLETE printf_unfiltered (" UOE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_PE) +// OBSOLETE printf_unfiltered (" PE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UE) +// OBSOLETE printf_unfiltered (" UE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_OE) +// OBSOLETE printf_unfiltered (" OE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_ZE) +// OBSOLETE printf_unfiltered (" ZE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_EE) +// OBSOLETE printf_unfiltered (" EE"); +// OBSOLETE if (pcr_tmp & FPA_PCR_AE_IE) +// OBSOLETE printf_unfiltered (" IE"); +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE print_1167_regs (long regs[FPA_NREGS]) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE union +// OBSOLETE { +// OBSOLETE double d; +// OBSOLETE long l[2]; +// OBSOLETE } +// OBSOLETE xd; +// OBSOLETE union +// OBSOLETE { +// OBSOLETE float f; +// OBSOLETE long l; +// OBSOLETE } +// OBSOLETE xf; +// OBSOLETE +// OBSOLETE +// OBSOLETE for (i = 0; i < FPA_NREGS; i++) +// OBSOLETE { +// OBSOLETE xf.l = regs[i]; +// OBSOLETE printf_unfiltered ("%%fp%d: raw= %#x, single= %f", i + 1, regs[i], xf.f); +// OBSOLETE if (!(i & 1)) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE xd.l[1] = regs[i]; +// OBSOLETE xd.l[0] = regs[i + 1]; +// OBSOLETE printf_unfiltered (", double= %f\n", xd.d); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE print_fpa_status (struct pt_regset ep) +// OBSOLETE { +// OBSOLETE +// OBSOLETE printf_unfiltered ("WTL 1167:"); +// OBSOLETE if (ep.pr_fpa.fpa_pcr != 0) +// OBSOLETE { +// OBSOLETE printf_unfiltered ("\n"); +// OBSOLETE print_1167_control_word (ep.pr_fpa.fpa_pcr); +// OBSOLETE print_1167_regs (ep.pr_fpa.fpa_regs); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE printf_unfiltered (" not in use.\n"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 /* disabled because it doesn't go through the target vector. */ +// OBSOLETE i386_float_info (void) +// OBSOLETE { +// OBSOLETE char ubuf[UPAGES * NBPG]; +// OBSOLETE struct pt_regset regset; +// OBSOLETE +// OBSOLETE if (have_inferior_p ()) +// OBSOLETE { +// OBSOLETE PTRACE_READ_REGS (PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regset); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE int corechan = bfd_cache_lookup (core_bfd); +// OBSOLETE if (lseek (corechan, 0, 0) < 0) +// OBSOLETE { +// OBSOLETE perror ("seek on core file"); +// OBSOLETE } +// OBSOLETE if (myread (corechan, ubuf, UPAGES * NBPG) < 0) +// OBSOLETE { +// OBSOLETE perror ("read on core file"); +// OBSOLETE } +// OBSOLETE /* only interested in the floating point registers */ +// OBSOLETE regset.pr_fpu = ((struct user *) ubuf)->u_fpusave; +// OBSOLETE regset.pr_fpa = ((struct user *) ubuf)->u_fpasave; +// OBSOLETE } +// OBSOLETE print_fpu_status (regset); +// OBSOLETE print_fpa_status (regset); +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE static volatile int got_sigchld; +// OBSOLETE +// OBSOLETE /*ARGSUSED */ +// OBSOLETE /* This will eventually be more interesting. */ +// OBSOLETE void +// OBSOLETE sigchld_handler (int signo) +// OBSOLETE { +// OBSOLETE got_sigchld++; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Signals for which the default action does not cause the process +// OBSOLETE * to die. See <sys/signal.h> for where this came from (alas, we +// OBSOLETE * can't use those macros directly) +// OBSOLETE */ +// OBSOLETE #ifndef sigmask +// OBSOLETE #define sigmask(s) (1 << ((s) - 1)) +// OBSOLETE #endif +// OBSOLETE #define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ +// OBSOLETE sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \ +// OBSOLETE sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \ +// OBSOLETE sigmask(SIGURG) | sigmask(SIGPOLL) +// OBSOLETE +// OBSOLETE #ifdef ATTACH_DETACH +// OBSOLETE /* +// OBSOLETE * Thanks to XPT_MPDEBUGGER, we have to mange child_wait(). +// OBSOLETE */ +// OBSOLETE ptid_t +// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *status) +// OBSOLETE { +// OBSOLETE int save_errno, rv, xvaloff, saoff, sa_hand; +// OBSOLETE struct pt_stop pt; +// OBSOLETE struct user u; +// OBSOLETE sigset_t set; +// OBSOLETE /* Host signal number for a signal which the inferior terminates with, or +// OBSOLETE 0 if it hasn't terminated due to a signal. */ +// OBSOLETE static int death_by_signal = 0; +// OBSOLETE #ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */ +// OBSOLETE prstatus_t pstatus; +// OBSOLETE #endif +// OBSOLETE int pid = PIDGET (ptid); +// OBSOLETE +// OBSOLETE do +// OBSOLETE { +// OBSOLETE set_sigint_trap (); /* Causes SIGINT to be passed on to the +// OBSOLETE attached process. */ +// OBSOLETE save_errno = errno; +// OBSOLETE +// OBSOLETE got_sigchld = 0; +// OBSOLETE +// OBSOLETE sigemptyset (&set); +// OBSOLETE +// OBSOLETE while (got_sigchld == 0) +// OBSOLETE { +// OBSOLETE sigsuspend (&set); +// OBSOLETE } +// OBSOLETE +// OBSOLETE clear_sigint_trap (); +// OBSOLETE +// OBSOLETE rv = mptrace (XPT_STOPSTAT, 0, (char *) &pt, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE printf ("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */ +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE pid = pt.ps_pid; +// OBSOLETE +// OBSOLETE if (pid != PIDGET (inferior_ptid)) +// OBSOLETE { +// OBSOLETE /* NOTE: the mystery fork in csh/tcsh needs to be ignored. +// OBSOLETE * We should not return new children for the initial run +// OBSOLETE * of a process until it has done the exec. +// OBSOLETE */ +// OBSOLETE /* inferior probably forked; send it on its way */ +// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE printf ("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid, +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE /* FIXME: Do we deal with fork notification correctly? */ +// OBSOLETE switch (pt.ps_reason) +// OBSOLETE { +// OBSOLETE case PTS_FORK: +// OBSOLETE /* multi proc: treat like PTS_EXEC */ +// OBSOLETE /* +// OBSOLETE * Pretend this didn't happen, since gdb isn't set up +// OBSOLETE * to deal with stops on fork. +// OBSOLETE */ +// OBSOLETE rv = ptrace (PT_CONTSIG, pid, 1, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE printf ("PTS_FORK: PT_CONTSIG: error %d\n", errno); +// OBSOLETE } +// OBSOLETE continue; +// OBSOLETE case PTS_EXEC: +// OBSOLETE /* +// OBSOLETE * Pretend this is a SIGTRAP. +// OBSOLETE */ +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; +// OBSOLETE break; +// OBSOLETE case PTS_EXIT: +// OBSOLETE /* +// OBSOLETE * Note: we stop before the exit actually occurs. Extract +// OBSOLETE * the exit code from the uarea. If we're stopped in the +// OBSOLETE * exit() system call, the exit code will be in +// OBSOLETE * u.u_ap[0]. An exit due to an uncaught signal will have +// OBSOLETE * something else in here, see the comment in the default: +// OBSOLETE * case, below. Finally,let the process exit. +// OBSOLETE */ +// OBSOLETE if (death_by_signal) +// OBSOLETE { +// OBSOLETE status->kind = TARGET_WAITKIND_SIGNALED; +// OBSOLETE status->value.sig = target_signal_from_host (death_by_signal); +// OBSOLETE death_by_signal = 0; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE xvaloff = (unsigned long) &u.u_ap[0] - (unsigned long) &u; +// OBSOLETE errno = 0; +// OBSOLETE rv = ptrace (PT_RUSER, pid, (char *) xvaloff, 0); +// OBSOLETE status->kind = TARGET_WAITKIND_EXITED; +// OBSOLETE status->value.integer = rv; +// OBSOLETE /* +// OBSOLETE * addr & data to mptrace() don't matter here, since +// OBSOLETE * the process is already dead. +// OBSOLETE */ +// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE printf ("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid, +// OBSOLETE errno); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE case PTS_WATCHPT_HIT: +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "PTS_WATCHPT_HIT\n"); +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE /* stopped by signal */ +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = target_signal_from_host (pt.ps_reason); +// OBSOLETE death_by_signal = 0; +// OBSOLETE +// OBSOLETE if (0 == (SIGNALS_DFL_SAFE & sigmask (pt.ps_reason))) +// OBSOLETE { +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE /* else default action of signal is to die */ +// OBSOLETE #ifdef SVR4_SHARED_LIBS +// OBSOLETE rv = ptrace (PT_GET_PRSTATUS, pid, (char *) &pstatus, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE error ("child_wait: signal %d PT_GET_PRSTATUS: %s\n", +// OBSOLETE pt.ps_reason, safe_strerror (errno)); +// OBSOLETE if (pstatus.pr_cursig != pt.ps_reason) +// OBSOLETE { +// OBSOLETE printf ("pstatus signal %d, pt signal %d\n", +// OBSOLETE pstatus.pr_cursig, pt.ps_reason); +// OBSOLETE } +// OBSOLETE sa_hand = (int) pstatus.pr_action.sa_handler; +// OBSOLETE #else +// OBSOLETE saoff = (unsigned long) &u.u_sa[0] - (unsigned long) &u; +// OBSOLETE saoff += sizeof (struct sigaction) * (pt.ps_reason - 1); +// OBSOLETE errno = 0; +// OBSOLETE sa_hand = ptrace (PT_RUSER, pid, (char *) saoff, 0); +// OBSOLETE if (errno) +// OBSOLETE error ("child_wait: signal %d: RUSER: %s\n", +// OBSOLETE pt.ps_reason, safe_strerror (errno)); +// OBSOLETE #endif +// OBSOLETE if ((int) SIG_DFL == sa_hand) +// OBSOLETE { +// OBSOLETE /* we will be dying */ +// OBSOLETE death_by_signal = pt.ps_reason; +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE } +// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ +// OBSOLETE +// OBSOLETE return pid_to_ptid (pid); +// OBSOLETE } +// OBSOLETE #else /* !ATTACH_DETACH */ +// OBSOLETE /* +// OBSOLETE * Simple child_wait() based on inftarg.c child_wait() for use until +// OBSOLETE * the MPDEBUGGER child_wait() works properly. This will go away when +// OBSOLETE * that is fixed. +// OBSOLETE */ +// OBSOLETE ptid_t +// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) +// OBSOLETE { +// OBSOLETE int save_errno; +// OBSOLETE int status; +// OBSOLETE int pid = PIDGET (ptid); +// OBSOLETE +// OBSOLETE do +// OBSOLETE { +// OBSOLETE pid = wait (&status); +// OBSOLETE save_errno = errno; +// OBSOLETE +// OBSOLETE if (pid == -1) +// OBSOLETE { +// OBSOLETE if (save_errno == EINTR) +// OBSOLETE continue; +// OBSOLETE fprintf (stderr, "Child process unexpectedly missing: %s.\n", +// OBSOLETE safe_strerror (save_errno)); +// OBSOLETE ourstatus->kind = TARGET_WAITKIND_SIGNALLED; +// OBSOLETE ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; +// OBSOLETE return pid_to_ptid (-1); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */ +// OBSOLETE store_waitstatus (ourstatus, status); +// OBSOLETE return pid_to_ptid (pid); +// OBSOLETE } +// OBSOLETE #endif /* ATTACH_DETACH */ +// OBSOLETE +// OBSOLETE +// OBSOLETE +// OBSOLETE /* This function simply calls ptrace with the given arguments. +// OBSOLETE It exists so that all calls to ptrace are isolated in this +// OBSOLETE machine-dependent file. */ +// OBSOLETE int +// OBSOLETE call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) +// OBSOLETE { +// OBSOLETE return ptrace (request, pid, addr, data); +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data) +// OBSOLETE { +// OBSOLETE return mptrace (request, pid, addr, data); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if defined (DEBUG_PTRACE) +// OBSOLETE /* For the rest of the file, use an extra level of indirection */ +// OBSOLETE /* This lets us breakpoint usefully on call_ptrace. */ +// OBSOLETE #define ptrace call_ptrace +// OBSOLETE #define mptrace call_mptrace +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE void +// OBSOLETE kill_inferior (void) +// OBSOLETE { +// OBSOLETE if (ptid_equal (inferior_ptid, null_ptid)) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE /* For MPDEBUGGER, don't use PT_KILL, since the child will stop +// OBSOLETE again with a PTS_EXIT. Just hit him with SIGKILL (so he stops) +// OBSOLETE and detach. */ +// OBSOLETE +// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL); +// OBSOLETE #ifdef ATTACH_DETACH +// OBSOLETE detach (SIGKILL); +// OBSOLETE #else /* ATTACH_DETACH */ +// OBSOLETE ptrace (PT_KILL, PIDGET (inferior_ptid), 0, 0); +// OBSOLETE wait ((int *) NULL); +// OBSOLETE #endif /* ATTACH_DETACH */ +// OBSOLETE target_mourn_inferior (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Resume execution of the inferior process. +// OBSOLETE If STEP is nonzero, single-step it. +// OBSOLETE If SIGNAL is nonzero, give it that signal. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE child_resume (ptid_t ptid, int step, enum target_signal signal) +// OBSOLETE { +// OBSOLETE int pid = PIDGET (ptid); +// OBSOLETE +// OBSOLETE errno = 0; +// OBSOLETE +// OBSOLETE if (pid == -1) +// OBSOLETE pid = PIDGET (inferior_ptid); +// OBSOLETE +// OBSOLETE /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where +// OBSOLETE it was. (If GDB wanted it to start some other way, we have already +// OBSOLETE written a new PC value to the child.) +// OBSOLETE +// OBSOLETE If this system does not support PT_SSTEP, a higher level function will +// OBSOLETE have called single_step() to transmute the step request into a +// OBSOLETE continue request (by setting breakpoints on all possible successor +// OBSOLETE instructions), so we don't have to worry about that here. */ +// OBSOLETE +// OBSOLETE if (step) +// OBSOLETE ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal); +// OBSOLETE else +// OBSOLETE ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal); +// OBSOLETE +// OBSOLETE if (errno) +// OBSOLETE perror_with_name ("ptrace"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef ATTACH_DETACH +// OBSOLETE /* Start debugging the process whose number is PID. */ +// OBSOLETE int +// OBSOLETE attach (int pid) +// OBSOLETE { +// OBSOLETE sigset_t set; +// OBSOLETE int rv; +// OBSOLETE +// OBSOLETE rv = mptrace (XPT_DEBUG, pid, 0, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE error ("mptrace(XPT_DEBUG): %s", safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE rv = mptrace (XPT_SIGNAL, pid, 0, SIGSTOP); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE error ("mptrace(XPT_SIGNAL): %s", safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE attach_flag = 1; +// OBSOLETE return pid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE detach (int signo) +// OBSOLETE { +// OBSOLETE int rv; +// OBSOLETE +// OBSOLETE rv = mptrace (XPT_UNDEBUG, PIDGET (inferior_ptid), 1, signo); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE error ("mptrace(XPT_UNDEBUG): %s", safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE attach_flag = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* ATTACH_DETACH */ +// OBSOLETE +// OBSOLETE /* Default the type of the ptrace transfer to int. */ +// OBSOLETE #ifndef PTRACE_XFER_TYPE +// OBSOLETE #define PTRACE_XFER_TYPE int +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE +// OBSOLETE /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory +// OBSOLETE in the NEW_SUN_PTRACE case. +// OBSOLETE It ought to be straightforward. But it appears that writing did +// OBSOLETE not write the data that I specified. I cannot understand where +// OBSOLETE it got the data that it actually did write. */ +// OBSOLETE +// OBSOLETE /* Copy LEN bytes to or from inferior's memory starting at MEMADDR +// OBSOLETE to debugger memory starting at MYADDR. Copy to inferior if +// OBSOLETE WRITE is nonzero. TARGET is ignored. +// OBSOLETE +// OBSOLETE Returns the length copied, which is either the LEN argument or zero. +// OBSOLETE This xfer function does not do partial moves, since child_ops +// OBSOLETE doesn't allow memory operations to cross below us in the target stack +// OBSOLETE anyway. */ +// OBSOLETE +// OBSOLETE int +// OBSOLETE child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, +// OBSOLETE struct mem_attrib *attrib, +// OBSOLETE struct target_ops *target) +// OBSOLETE { +// OBSOLETE register int i; +// OBSOLETE /* Round starting address down to longword boundary. */ +// OBSOLETE register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE); +// OBSOLETE /* Round ending address up; get number of longwords that makes. */ +// OBSOLETE register int count +// OBSOLETE = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1) +// OBSOLETE / sizeof (PTRACE_XFER_TYPE); +// OBSOLETE /* Allocate buffer of that many longwords. */ +// OBSOLETE /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe +// OBSOLETE because it uses alloca to allocate a buffer of arbitrary size. +// OBSOLETE For very large xfers, this could crash GDB's stack. */ +// OBSOLETE register PTRACE_XFER_TYPE *buffer +// OBSOLETE = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); +// OBSOLETE +// OBSOLETE if (write) +// OBSOLETE { +// OBSOLETE /* Fill start and end extra bytes of buffer with existing memory data. */ +// OBSOLETE +// OBSOLETE if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) +// OBSOLETE { +// OBSOLETE /* Need part of initial word -- fetch it. */ +// OBSOLETE buffer[0] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, +// OBSOLETE 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (count > 1) /* FIXME, avoid if even boundary */ +// OBSOLETE { +// OBSOLETE buffer[count - 1] +// OBSOLETE = ptrace (PT_RTEXT, PIDGET (inferior_ptid), +// OBSOLETE ((PTRACE_ARG3_TYPE) +// OBSOLETE (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))), +// OBSOLETE 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Copy data to be written over corresponding part of buffer */ +// OBSOLETE +// OBSOLETE memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), +// OBSOLETE myaddr, +// OBSOLETE len); +// OBSOLETE +// OBSOLETE /* Write the entire buffer. */ +// OBSOLETE +// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) +// OBSOLETE { +// OBSOLETE errno = 0; +// OBSOLETE ptrace (PT_WDATA, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, +// OBSOLETE buffer[i]); +// OBSOLETE if (errno) +// OBSOLETE { +// OBSOLETE /* Using the appropriate one (I or D) is necessary for +// OBSOLETE Gould NP1, at least. */ +// OBSOLETE errno = 0; +// OBSOLETE ptrace (PT_WTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr, +// OBSOLETE buffer[i]); +// OBSOLETE } +// OBSOLETE if (errno) +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* Read all the longwords */ +// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE)) +// OBSOLETE { +// OBSOLETE errno = 0; +// OBSOLETE buffer[i] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) addr, 0); +// OBSOLETE if (errno) +// OBSOLETE return 0; +// OBSOLETE QUIT; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Copy appropriate bytes out of the buffer. */ +// OBSOLETE memcpy (myaddr, +// OBSOLETE (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), +// OBSOLETE len); +// OBSOLETE } +// OBSOLETE return len; +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_symm_nat (void) +// OBSOLETE { +// OBSOLETE #ifdef ATTACH_DETACH +// OBSOLETE /* +// OBSOLETE * the MPDEBUGGER is necessary for process tree debugging and attach +// OBSOLETE * to work, but it alters the behavior of debugged processes, so other +// OBSOLETE * things (at least child_wait()) will have to change to accomodate +// OBSOLETE * that. +// OBSOLETE * +// OBSOLETE * Note that attach is not implemented in dynix 3, and not in ptx +// OBSOLETE * until version 2.1 of the OS. +// OBSOLETE */ +// OBSOLETE int rv; +// OBSOLETE sigset_t set; +// OBSOLETE struct sigaction sact; +// OBSOLETE +// OBSOLETE rv = mptrace (XPT_MPDEBUGGER, 0, 0, 0); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Under MPDEBUGGER, we get SIGCLHD when a traced process does +// OBSOLETE * anything of interest. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Block SIGCHLD. We leave it blocked all the time, and then +// OBSOLETE * call sigsuspend() in child_wait() to wait for the child +// OBSOLETE * to do something. None of these ought to fail, but check anyway. +// OBSOLETE */ +// OBSOLETE sigemptyset (&set); +// OBSOLETE rv = sigaddset (&set, SIGCHLD); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "_initialize_symm_nat(): sigaddset(SIGCHLD): %s", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE rv = sigprocmask (SIG_BLOCK, &set, (sigset_t *) NULL); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE sact.sa_handler = sigchld_handler; +// OBSOLETE sigemptyset (&sact.sa_mask); +// OBSOLETE sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */ +// OBSOLETE rv = sigaction (SIGCHLD, &sact, (struct sigaction *) NULL); +// OBSOLETE if (-1 == rv) +// OBSOLETE { +// OBSOLETE internal_error (__FILE__, __LINE__, +// OBSOLETE "_initialize_symm_nat(): sigaction(SIGCHLD): %s", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE } diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c index 37a2f51..21c8436 100644 --- a/gdb/symm-tdep.c +++ b/gdb/symm-tdep.c @@ -1,102 +1,102 @@ -/* Sequent Symmetry target interface, for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* many 387-specific items of use taken from i386-dep.c */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" - -#include <signal.h> -#include <sys/param.h> -#include <sys/user.h> -#include <sys/dir.h> -#include <sys/ioctl.h> -#include "gdb_stat.h" -#include "gdbcore.h" -#include <fcntl.h> - -void -symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf) -{ - union - { - double d; - int l[2]; - } - xd; - struct minimal_symbol *msymbol; - float f; - - if (TYPE_CODE_FLT == TYPE_CODE (type)) - { - msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL); - if (msymbol != NULL) - { - /* found "1167_flt" means 1167, %fp2-%fp3 */ - /* float & double; 19= %fp2, 20= %fp3 */ - /* no single precision on 1167 */ - xd.l[1] = *((int *) ®buf[REGISTER_BYTE (19)]); - xd.l[0] = *((int *) ®buf[REGISTER_BYTE (20)]); - switch (TYPE_LENGTH (type)) - { - case 4: - /* FIXME: broken for cross-debugging. */ - f = (float) xd.d; - memcpy (valbuf, &f, TYPE_LENGTH (type)); - break; - case 8: - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &xd.d, TYPE_LENGTH (type)); - break; - default: - error ("Unknown floating point size"); - break; - } - } - else - { - /* 387 %st(0), gcc uses this */ - i387_to_double (((int *) ®buf[REGISTER_BYTE (3)]), - &xd.d); - switch (TYPE_LENGTH (type)) - { - case 4: /* float */ - f = (float) xd.d; - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &f, 4); - break; - case 8: /* double */ - /* FIXME: broken for cross-debugging. */ - memcpy (valbuf, &xd.d, 8); - break; - default: - error ("Unknown floating point size"); - break; - } - } - } - else - { - memcpy (valbuf, regbuf, TYPE_LENGTH (type)); - } -} +// OBSOLETE /* Sequent Symmetry target interface, for GDB. +// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE /* many 387-specific items of use taken from i386-dep.c */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "frame.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE +// OBSOLETE #include <signal.h> +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/user.h> +// OBSOLETE #include <sys/dir.h> +// OBSOLETE #include <sys/ioctl.h> +// OBSOLETE #include "gdb_stat.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include <fcntl.h> +// OBSOLETE +// OBSOLETE void +// OBSOLETE symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf) +// OBSOLETE { +// OBSOLETE union +// OBSOLETE { +// OBSOLETE double d; +// OBSOLETE int l[2]; +// OBSOLETE } +// OBSOLETE xd; +// OBSOLETE struct minimal_symbol *msymbol; +// OBSOLETE float f; +// OBSOLETE +// OBSOLETE if (TYPE_CODE_FLT == TYPE_CODE (type)) +// OBSOLETE { +// OBSOLETE msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL); +// OBSOLETE if (msymbol != NULL) +// OBSOLETE { +// OBSOLETE /* found "1167_flt" means 1167, %fp2-%fp3 */ +// OBSOLETE /* float & double; 19= %fp2, 20= %fp3 */ +// OBSOLETE /* no single precision on 1167 */ +// OBSOLETE xd.l[1] = *((int *) ®buf[REGISTER_BYTE (19)]); +// OBSOLETE xd.l[0] = *((int *) ®buf[REGISTER_BYTE (20)]); +// OBSOLETE switch (TYPE_LENGTH (type)) +// OBSOLETE { +// OBSOLETE case 4: +// OBSOLETE /* FIXME: broken for cross-debugging. */ +// OBSOLETE f = (float) xd.d; +// OBSOLETE memcpy (valbuf, &f, TYPE_LENGTH (type)); +// OBSOLETE break; +// OBSOLETE case 8: +// OBSOLETE /* FIXME: broken for cross-debugging. */ +// OBSOLETE memcpy (valbuf, &xd.d, TYPE_LENGTH (type)); +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE error ("Unknown floating point size"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* 387 %st(0), gcc uses this */ +// OBSOLETE i387_to_double (((int *) ®buf[REGISTER_BYTE (3)]), +// OBSOLETE &xd.d); +// OBSOLETE switch (TYPE_LENGTH (type)) +// OBSOLETE { +// OBSOLETE case 4: /* float */ +// OBSOLETE f = (float) xd.d; +// OBSOLETE /* FIXME: broken for cross-debugging. */ +// OBSOLETE memcpy (valbuf, &f, 4); +// OBSOLETE break; +// OBSOLETE case 8: /* double */ +// OBSOLETE /* FIXME: broken for cross-debugging. */ +// OBSOLETE memcpy (valbuf, &xd.d, 8); +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE error ("Unknown floating point size"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE memcpy (valbuf, regbuf, TYPE_LENGTH (type)); +// OBSOLETE } +// OBSOLETE } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 1712c90..acd83b4 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -33,6 +33,7 @@ #include "language.h" #include "bcache.h" #include "block.h" +#include "gdb_regex.h" #include "dictionary.h" #include "gdb_string.h" @@ -1002,6 +1003,145 @@ maintenance_print_objfiles (char *ignore, int from_tty) immediate_quit--; } + +/* List all the symbol tables. */ +void +maintenance_list_symtabs (char *regexp, int from_tty) +{ + struct objfile *objfile; + + if (regexp) + re_comp (regexp); + + ALL_OBJFILES (objfile) + { + struct symtab *symtab; + + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; + + ALL_OBJFILE_SYMTABS (objfile, symtab) + if (! regexp + || re_exec (symtab->filename)) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile->name); + wrap_here (" "); + printf_filtered ("((struct objfile *) %p)\n", objfile); + printed_objfile_start = 1; + } + + printf_filtered (" { symtab %s ", symtab->filename); + wrap_here (" "); + printf_filtered ("((struct symtab *) %p)\n", symtab); + printf_filtered (" dirname %s\n", + symtab->dirname ? symtab->dirname : "(null)"); + printf_filtered (" fullname %s\n", + symtab->fullname ? symtab->fullname : "(null)"); + printf_filtered (" blockvector ((struct blockvector *) %p)%s\n", + symtab->blockvector, + symtab->primary ? " (primary)" : ""); + printf_filtered (" debugformat %s\n", symtab->debugformat); + printf_filtered (" }\n"); + } + + if (printed_objfile_start) + printf_filtered ("}\n"); + } +} + + +/* List all the partial symbol tables. */ +void +maintenance_list_psymtabs (char *regexp, int from_tty) +{ + struct objfile *objfile; + + if (regexp) + re_comp (regexp); + + ALL_OBJFILES (objfile) + { + struct partial_symtab *psymtab; + + /* We don't want to print anything for this objfile until we + actually find a symtab whose name matches. */ + int printed_objfile_start = 0; + + ALL_OBJFILE_PSYMTABS (objfile, psymtab) + if (! regexp + || re_exec (psymtab->filename)) + { + if (! printed_objfile_start) + { + printf_filtered ("{ objfile %s ", objfile->name); + wrap_here (" "); + printf_filtered ("((struct objfile *) %p)\n", objfile); + printed_objfile_start = 1; + } + + printf_filtered (" { psymtab %s ", psymtab->filename); + wrap_here (" "); + printf_filtered ("((struct partial_symtab *) %p)\n", psymtab); + printf_filtered (" readin %s\n", + psymtab->readin ? "yes" : "no"); + printf_filtered (" fullname %s\n", + psymtab->fullname ? psymtab->fullname : "(null)"); + printf_filtered (" text addresses "); + print_address_numeric (psymtab->textlow, 1, gdb_stdout); + printf_filtered (" -- "); + print_address_numeric (psymtab->texthigh, 1, gdb_stdout); + printf_filtered ("\n"); + printf_filtered (" globals "); + if (psymtab->n_global_syms) + { + printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n", + (psymtab->objfile->global_psymbols.list + + psymtab->globals_offset), + psymtab->n_global_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" statics "); + if (psymtab->n_static_syms) + { + printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n", + (psymtab->objfile->static_psymbols.list + + psymtab->statics_offset), + psymtab->n_static_syms); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" dependencies "); + if (psymtab->number_of_dependencies) + { + int i; + + printf_filtered ("{\n"); + for (i = 0; i < psymtab->number_of_dependencies; i++) + { + struct partial_symtab *dep = psymtab->dependencies[i]; + + /* Note the string concatenation there --- no comma. */ + printf_filtered (" psymtab %s " + "((struct partial_symtab *) %p)\n", + dep->filename, dep); + } + printf_filtered (" }\n"); + } + else + printf_filtered ("(none)\n"); + printf_filtered (" }\n"); + } + + if (printed_objfile_start) + printf_filtered ("}\n"); + } +} + + /* Check consistency of psymtabs and symtabs. */ void diff --git a/gdb/symtab.c b/gdb/symtab.c index b134f02..de2cc56 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -513,61 +513,111 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, return NULL; } -/* Set both the mangled and demangled (if any) names for GSYMBOL based on - NAME and LEN. The hash table corresponding to OBJFILE is used, and the - memory comes from that objfile's symbol_obstack. NAME is copied, so the - pointer can be discarded after calling this function. */ +/* Set both the mangled and demangled (if any) names for GSYMBOL based + on LINKAGE_NAME and LEN. The hash table corresponding to OBJFILE + is used, and the memory comes from that objfile's symbol_obstack. + LINKAGE_NAME is copied, so the pointer can be discarded after + calling this function. */ + +/* We have to be careful when dealing with Java names: when we run + into a Java minimal symbol, we don't know it's a Java symbol, so it + gets demangled as a C++ name. This is unfortunate, but there's not + much we can do about it: but when demangling partial symbols and + regular symbols, we'd better not reuse the wrong demangled name. + (See PR gdb/1039.) We solve this by putting a distinctive prefix + on Java names when storing them in the hash table. */ + +/* FIXME: carlton/2003-03-13: This is an unfortunate situation. I + don't mind the Java prefix so much: different languages have + different demangling requirements, so it's only natural that we + need to keep language data around in our demangling cache. But + it's not good that the minimal symbol has the wrong demangled name. + Unfortunately, I can't think of any easy solution to that + problem. */ + +#define JAVA_PREFIX "##JAVA$$" +#define JAVA_PREFIX_LEN 8 void symbol_set_names (struct general_symbol_info *gsymbol, - const char *name, int len, struct objfile *objfile) + const char *linkage_name, int len, struct objfile *objfile) { char **slot; - const char *tmpname; + /* A 0-terminated copy of the linkage name. */ + const char *linkage_name_copy; + /* A copy of the linkage name that might have a special Java prefix + added to it, for use when looking names up in the hash table. */ + const char *lookup_name; + /* The length of lookup_name. */ + int lookup_len; if (objfile->demangled_names_hash == NULL) create_demangled_names_hash (objfile); - /* The stabs reader generally provides names that are not NULL-terminated; - most of the other readers don't do this, so we can just use the given - copy. */ - if (name[len] != 0) + /* The stabs reader generally provides names that are not + NUL-terminated; most of the other readers don't do this, so we + can just use the given copy, unless we're in the Java case. */ + if (gsymbol->language == language_java) + { + char *alloc_name; + lookup_len = len + JAVA_PREFIX_LEN; + + alloc_name = alloca (lookup_len + 1); + memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN); + memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len); + alloc_name[lookup_len] = '\0'; + + lookup_name = alloc_name; + linkage_name_copy = alloc_name + JAVA_PREFIX_LEN; + } + else if (linkage_name[len] != '\0') { - char *alloc_name = alloca (len + 1); - memcpy (alloc_name, name, len); - alloc_name[len] = 0; - tmpname = alloc_name; + char *alloc_name; + lookup_len = len; + + alloc_name = alloca (lookup_len + 1); + memcpy (alloc_name, linkage_name, len); + alloc_name[lookup_len] = '\0'; + + lookup_name = alloc_name; + linkage_name_copy = alloc_name; } else - tmpname = name; + { + lookup_len = len; + lookup_name = linkage_name; + linkage_name_copy = linkage_name; + } - slot = (char **) htab_find_slot (objfile->demangled_names_hash, tmpname, INSERT); + slot = (char **) htab_find_slot (objfile->demangled_names_hash, + lookup_name, INSERT); /* If this name is not in the hash table, add it. */ if (*slot == NULL) { - char *demangled_name = symbol_find_demangled_name (gsymbol, tmpname); + char *demangled_name = symbol_find_demangled_name (gsymbol, + linkage_name_copy); int demangled_len = demangled_name ? strlen (demangled_name) : 0; /* If there is a demangled name, place it right after the mangled name. Otherwise, just place a second zero byte after the end of the mangled name. */ *slot = obstack_alloc (&objfile->symbol_obstack, - len + demangled_len + 2); - memcpy (*slot, tmpname, len + 1); - if (demangled_name) + lookup_len + demangled_len + 2); + memcpy (*slot, lookup_name, lookup_len + 1); + if (demangled_name != NULL) { - memcpy (*slot + len + 1, demangled_name, demangled_len + 1); + memcpy (*slot + lookup_len + 1, demangled_name, demangled_len + 1); xfree (demangled_name); } else - (*slot)[len + 1] = 0; + (*slot)[lookup_len + 1] = '\0'; } - gsymbol->name = *slot; - if ((*slot)[len + 1]) + gsymbol->name = *slot + lookup_len - len; + if ((*slot)[lookup_len + 1] != '\0') gsymbol->language_specific.cplus_specific.demangled_name - = &(*slot)[len + 1]; + = &(*slot)[lookup_len + 1]; else gsymbol->language_specific.cplus_specific.demangled_name = NULL; } diff --git a/gdb/symtab.h b/gdb/symtab.h index e0ce92f..a893890 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -25,7 +25,9 @@ #define SYMTAB_H 1 /* Opaque declarations. */ - +struct ui_file; +struct frame_info; +struct symbol; struct obstack; struct objfile; struct block; @@ -156,10 +158,10 @@ extern void symbol_init_language_specific (struct general_symbol_info *symbol, extern void symbol_init_demangled_name (struct general_symbol_info *symbol, struct obstack *obstack); -#define SYMBOL_SET_NAMES(symbol,name,len,objfile) \ - symbol_set_names (&(symbol)->ginfo, name, len, objfile) +#define SYMBOL_SET_NAMES(symbol,linkage_name,len,objfile) \ + symbol_set_names (&(symbol)->ginfo, linkage_name, len, objfile) extern void symbol_set_names (struct general_symbol_info *symbol, - const char *name, int len, + const char *linkage_name, int len, struct objfile *objfile); /* Now come lots of name accessor macros. Short version as to when to @@ -1244,6 +1246,10 @@ void maintenance_print_msymbols (char *, int); void maintenance_print_objfiles (char *, int); +void maintenance_list_symtabs (char *, int); + +void maintenance_list_psymtabs (char *, int); + void maintenance_check_symtabs (char *, int); /* maint.c */ diff --git a/gdb/target.h b/gdb/target.h index f081bd3..b3f43fc 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -23,6 +23,10 @@ #if !defined (TARGET_H) #define TARGET_H +struct objfile; +struct ui_file; +struct mem_attrib; + /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or specific to the communications interface between us and the diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1bc95db..f9364cc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,152 @@ +2003-04-15 David Carlton <carlton@math.stanford.edu> + + * gdb.c++/maint.exp: New file. + +2003-04-14 Elena Zannoni <ezannoni@redhat.com> + + * gdb.threads/schedlock.c: Change type of thread function argument + to long, to avoid warnings on 64-bit platforms. + +2003-04-14 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/attach.exp: Add new message from ptrace in case of + attaching to nonexistent process. + +2003-04-11 Jim Blandy <jimb@redhat.com> + + * gdb.c++/derivation.exp, gdb.c++/overload.exp, + gdb.c++/userdef.cc: Place comments on the lines to which the + marker function might return. + * gdb.c++/derivation.exp, gdb.c++/overload.exp, + gdb.c++/userdef.exp: Look for those comments to check that we've + returned to the right place, instead of checking line numbers. + +2003-04-11 Elena Zannoni <ezannoni@redhat.com> + + * gdb.threads/pthreads.exp (test_startup): When setting a breakpoint + match on sourcefile name, instead of directory name. + +2003-04-10 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/completion.exp: Use string_to_regexp to match the + working directory name. + +2003-04-09 Jim Blandy <jimb@redhat.com> + + * gdb.c++/derivation.exp, gdb.c++/overload.exp, + gdb.c++/userdef.exp: If GDB fails to restore the selected frame + after an inferior function call, report the failure, but allow the + test to continue. + +2003-04-05 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + +2003-04-05 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: Revert last patch. + +2003-04-04 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.base/break.exp: marker4() is defined at line 46 when compiled + with -DPROTOTYPES. + +2003-04-02 Andrew Cagney <cagney@redhat.com> + + * gdb.base/callfuncs.exp: Make "print add" messages unique. + * gdb.base/ending-run.exp: Put spaces around "breakpoint" to stop + matching directories by the name breakpoint. + * gdb.base/pointers.exp: Make "ptype pppC" message consistent. + Make "continue to marker1" consistent. + * gdb.base/call-rt-st.exp: Make "finish out from loop_count" + message consistent. + * lib/gdb.exp: Put "the program is no longer running", and "the + program exited" in parenthesis. + * lib/mi-support.exp: Ditto. + +2003-04-02 Bob Rossi <bob_rossi@cox.net> + + * gdb.mi/mi-file.exp: New file for -file-list-exec-source-file. + +2003-03-29 Andrew Cagney <cagney@redhat.com> + + * gdb.base/sizeof.c (main): Print the value of '\377'. + * gdb.base/sizeof.exp: Check the sign of '\377'. + +2003-03-27 Michael Chastain <mec@shout.net> + + * gdb.base/gdb1090.exp: New file. + * gdb.base/gdb1090.cc: New file. + +2003-03-27 J. Brobecker <brobecker@gnat.com> + + * gdb.gdb/observer.exp: New regression test. + +2003-03-27 Michael Chastain <mec@shout.net> + + * gdb.base/list.exp: Remove setup_xfail_format for DWARF 1. + * gdb.base/ptype.exp: Likewise. + +2003-03-27 Corinna Vinschen <vinschen@redhat.com> + + * gdb.c++/casts.exp: Fix startup to run also on embedded targets. + +2003-03-26 Michael Chastain <mec@shout.net> + + * gdb.base/ptype.exp: Actually use some typedef'd types. + +2003-03-21 Stephane Carrez <stcarrez@nerim.fr> + + * gdb.asm/asm-source.exp: Set asm-arch for m6811 and m6812. + * gdb.asm/m68hc11.inc: New file for HC11/HC12 macros. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/default.exp: Fix regular expression. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/args.exp: Fix regular expression. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/help.exp: Allow Win32 child process. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/ending-run.exp: Check for Cygwin specific wrapper function + when stepping out of main(). + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/default.exp: Check for win32 specific message when calling + "run" without executable. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.base/args.exp: Expect .exe in output. + +2003-03-20 Corinna Vinschen <vinschen@redhat.com> + + * gdb.asm/asm-source.exp: Add appropriate --entry linker flag for + Cygwin native. + +2003-03-17 Andrew Cagney <cagney@redhat.com> + + From Elena Zannoni <ezannoni@redhat.com>. Test e500 abi and + vector registes. + * gdb.arch/e500-regs.c, gdb.arch/e500-regs.exp: New files. + * gdb.arch/e500-abi.c, gdb.arch/e500-abi.exp: New files. + +2003-03-17 David Carlton <carlton@math.stanford.edu> + + * gdb.base/watchpoint.exp (test_watchpoint_and_breakpoint): New + test, for PR breakpoints/38. + Call test_watchpoint_and_breakpoint. + * gdb.base/watchpoint.c (func3): New function. + (main): Call func3. + 2003-03-06 David Carlton <carlton@math.stanford.edu> * gdb.c++/templates.exp (do_tests): Make expressions for 'ptype diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index a42c61a..ac1bcd2 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -53,10 +53,21 @@ if [istarget "x86_64-*-*"] then { } if [istarget "i\[3456\]86-*-*"] then { set asm-arch i386 + if [istarget "*-*-cygwin*"] then { + set link-flags "--entry _start" + } } if [istarget "m32r*-*"] then { set asm-arch m32r } +if [istarget "m6811-*-*"] then { + set asm-arch m68hc11 + set asm-flags "-mshort-double -m68hc11 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}" +} +if [istarget "m6812-*-*"] then { + set asm-arch m68hc11 + set asm-flags "-mshort-double -m68hc12 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}" +} if [istarget "mips*-*"] then { set asm-arch mips } diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp index ff7ccab..e481ecb 100644 --- a/gdb/testsuite/gdb.base/args.exp +++ b/gdb/testsuite/gdb.base/args.exp @@ -48,7 +48,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_test "run" \ - "Starting program.*args 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \ + "Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \ "correct args printed" # @@ -59,7 +59,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_test "run" \ - "Starting program.*args 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \ + "Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \ "correct args printed, one empty" # @@ -70,7 +70,7 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_test "run" \ - "Starting program.*args 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \ + "Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \ "correct args printed, two empty" set GDBFLAGS $old_gdbflags diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index 4019fea..c561080 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -123,6 +123,8 @@ proc do_attach_tests {} { } -re "Attaching to.*, process 0.*denied.*$gdb_prompt $"\ {pass "attach to nonexistent process is prohibited"} + -re "Attaching to.*, process 0.*Operation not permitted.*$gdb_prompt $"\ + {pass "attach to nonexistent process is prohibited"} -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\ { # Response expected from /proc-based systems. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index fbc0e11..38820ec 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -914,6 +914,10 @@ gdb_expect { -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" { pass "run until breakpoint set at small function, optimized file" } + -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:46\[\r\n\]+46\[\t \]+void marker4.*" { + # marker4() is defined at line 46 when compiled with -DPROTOTYPES + pass "run until breakpoint set at small function, optimized file (line 46)" + } -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" } diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 115dcb3..0acd139 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -128,12 +128,18 @@ gdb_expect { send_gdb "finish\n" gdb_expect { - -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" { - pass "finish out from loop_count (line 617)"} - -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" { - pass "finish out from loop_count (line 615)"} - -re ".*$gdb_prompt $" { fail "finish out from loop_count"} - timeout { fail "(timeout)finish out from loop_count"} + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" { + pass "finish out from loop_count (line 617)" + } + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" { + pass "finish out from loop_count (line 615)" + } + -re ".*$gdb_prompt $" { + fail "finish out from loop_count" + } + timeout { + fail "finish out from loop_count (timeout)" + } } # Ask GDB to print the value of EXPR, and expect to see the regexp diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 9183fe4..7a5f143 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -342,7 +342,8 @@ if ![gdb_test "bt 2" \ # Call function (causing a breakpoint hit in the call dummy) and do a finish, # make sure we are back at main and still have the same register contents. -gdb_test "print add(4,5)" "The program being debugged stopped while.*" "" +gdb_test "print add(4,5)" "The program being debugged stopped while.*" \ + "call function causing a breakpoint then do a finish" gdb_test "finish" \ "Value returned is .* = 9" \ "finish from call dummy breakpoint returns correct value" @@ -360,7 +361,8 @@ if ![gdb_test "bt 2" \ # Call function (causing a breakpoint hit in the call dummy) and do a return # with a value, make sure we are back at main with the same register contents. -gdb_test "print add(4,5)" "The program being debugged stopped while.*" "" +gdb_test "print add(4,5)" "The program being debugged stopped while.*" \ + "call function causing a breakpoint and then do a return" if ![gdb_test "return 7" \ "#0 main.*" \ "back at main after return from call dummy breakpoint" \ diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 512bbdb..38bbd4b 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -669,7 +669,14 @@ cd ${srcdir} set fullsrcdir [pwd] cd ${mydir} -gdb_test "cd ${fullsrcdir}" "Working directory ${fullsrcdir}.*" "cd to \${srcdir}" +# If the directory name contains a '+' we must escape it, adding a backslash. +# If not, the test below will fail because it will interpret the '+' as a +# regexp operator. We use string_to_regexp for this purpose. + +gdb_test "cd ${fullsrcdir}" \ + "Working directory [string_to_regexp ${fullsrcdir}].*" \ + "cd to \${srcdir}" + send_gdb "file ./gdb.base/compl\t" sleep 1 gdb_expect { diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 7e3ed44..9179a53 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -428,6 +428,9 @@ No executable file specified.* Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\ { pass "run \"r\" abbreviation" } -re "Starting program: .* +No executable specified, use .target exec.\\..*$gdb_prompt $"\ + { pass "run \"r\" abbreviation" } + -re "Starting program: .* No image loaded into target.*$gdb_prompt $"\ { pass "run \"r\" abbreviation" } -re "Starting program: .* @@ -457,6 +460,9 @@ No executable file specified.* Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\ { pass "run" } -re "Starting program: .* +No executable specified, use .target exec.\\..*$gdb_prompt $"\ + { pass "run" } + -re "Starting program: .* No image loaded into target.*$gdb_prompt $"\ { pass "run" } -re "Starting program: .* diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index f7e954f..3960f06 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -74,7 +74,7 @@ if [target_info exists use_gdb_stub] { gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { - -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { + -re ".* breakpoint .* breakpoint .*$gdb_prompt $" { fail "cleared bp at line before routine" } -re ".*3.*main.*31.*$gdb_prompt $" { @@ -120,7 +120,7 @@ gdb_expect { send_gdb "i b\n" gdb_expect { - -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { + -re ".* breakpoint .* breakpoint .*$gdb_prompt $" { fail "all set to continue (didn't clear bps)" } -re ".*3.*main.*31.*$gdb_prompt $" { @@ -171,6 +171,10 @@ gdb_expect { # This is what happens on sparc64-elf ultra. pass "step out of main" } + -re ".*in.*dll_crt0_1.*$gdb_prompt $" { + # This is what happens on Cygwin. + pass "step out of main" + } -re ".*Program exited normally.*$gdb_prompt $" { # This is what happens on Linux i86 (and I would expect others) set program_exited 1 diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index 69cf40d..2eed1dc 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -547,7 +547,7 @@ gdb_test "help support" "Support facilities\.\[\r\n\]+List of commands:.*\[\r\n\ # test help symbol-file gdb_test "help symbol-file" "Load symbol table from executable file FILE\.\[\r\n\]+The `file' command can also load symbol tables, as well as setting the file\[\r\n\]+to execute\." "help symbol-file" # test help target child -gdb_test "help target child" "Unix child process \\(started by the \"run\" command\\)\.|Undefined target command: \"child\"\. Try \"help target\"\." "help target child" +gdb_test "help target child" "(Unix|Win32) child process \\(started by the \"run\" command\\)\.|Undefined target command: \"child\"\. Try \"help target\"\." "help target child" # test help target procfs gdb_test "help target procfs" "Unix /proc child process \\(started by the \"run\" command\\)\.|Undefined target command: \"procfs\"\. Try \"help target\"\." "help target procfs (procfs version)" # test help target core diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index dee9152..84a15cf 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -164,11 +164,9 @@ proc test_listsize {} { proc test_list_include_file {} { global gdb_prompt - setup_xfail_format "DWARF 1" setup_xfail_format "COFF" gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file" - setup_xfail_format "DWARF 1" setup_xfail_format "COFF" gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF" } @@ -239,7 +237,6 @@ proc test_list_function {} { # Ultrix gdb is the second case, still correct. # SunPRO cc is the third case. setup_xfail "powerpc-*-*" - setup_xfail_format "DWARF 1" gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file" } @@ -427,7 +424,6 @@ proc test_list_filename_and_function {} { # SunPRO cc is the third case. setup_xfail "rs6000-*-*" 1804 setup_xfail "powerpc-*-*" 1804 - setup_xfail_format "DWARF 1" setup_xfail_format "COFF" send_gdb "list list0.h:foo\n" gdb_expect { @@ -496,7 +492,6 @@ proc test_list_filename_and_function {} { gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file" - setup_xfail_format "DWARF 1" gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function" } diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index 5f406ad..a10a7f3 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -366,23 +366,28 @@ gdb_expect { send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" - send_gdb "cont\n" - gdb_expect { - -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { - send_gdb "up\n" - gdb_expect { - -re ".*more_code.*$gdb_prompt $" { - pass "up from marker1" - } - -re ".*$gdb_prompt $" { - fail "up from marker1" - } - timeout { fail "up from marker1 (timeout)" } - } - } - -re "$gdb_prompt $" { fail "continue to marker1" } - timeout { fail "(timeout) continue to marker1" } +send_gdb "cont\n" +gdb_expect { + -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { + pass "continue to marker1" + send_gdb "up\n" + gdb_expect { + -re ".*more_code.*$gdb_prompt $" { + pass "up from marker1" + } + -re ".*$gdb_prompt $" { + fail "up from marker1" + } + timeout { fail "up from marker1 (timeout)" } + } + } + -re "$gdb_prompt $" { + fail "continue to marker1" } + timeout { + fail "continue to marker1 (timeout)" + } +} send_gdb "print *pUC\n" @@ -568,7 +573,7 @@ gdb_expect { send_gdb "ptype pppC\n" gdb_expect { - -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" } + -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" } -re ".*$gdb_prompt $" { fail "ptype pppC" } timeout { fail "(timeout) ptype pppC" } } diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c index 2c85c7c..397a714 100644 --- a/gdb/testsuite/gdb.base/ptype.c +++ b/gdb/testsuite/gdb.base/ptype.c @@ -59,6 +59,7 @@ double v_double_array[2]; /* PR 3742 */ typedef char t_char_array[]; +t_char_array *pv_char_array; /**** pointers *******/ @@ -237,6 +238,8 @@ int (*xptr) (int (*) (), int (*) (void), int); int (*(*ffptr) (char)) (short); int (*(*(*fffptr) (char)) (short)) (long); +func_type v_func_type; + /* Here are the sort of stabs we expect to see for the above: .stabs "func_type:t(0,100)=*(0,101)=g(0,1)(0,102)=*(0,103)=g(0,1)(0,1)(0,14)#(0,14)#",128,0,234,0 diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 6e33d85..6580b43 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -1,5 +1,5 @@ # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, -# 2000, 2002 Free Software Foundation, Inc. +# 2000, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -137,7 +137,6 @@ if {!$gcc_compiled && !$hp_aCC_compiler} { # For get_debug_format to do its job, we need to have a current source file. gdb_test "list main" "" get_debug_format -setup_xfail_format "DWARF 1" gdb_test "whatis v_boolean" "type = (enum |)boolean" \ "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)" @@ -370,7 +369,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" # if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } -setup_xfail_format "DWARF 1" if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c index 95d379e..c32231f 100644 --- a/gdb/testsuite/gdb.base/sizeof.c +++ b/gdb/testsuite/gdb.base/sizeof.c @@ -114,6 +114,7 @@ main () printf ("sizeof (long double) == %d\n", sizeof (long double)); /* Signed char? */ + printf ("valueof ('\\377') == %d\n", '\377'); printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1); printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1); printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1); diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index 7c03905..7fcbe0e 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -154,10 +154,12 @@ proc check_valueof { exp val } { # Check that GDB and the target agree over the sign of a character. +set signof_byte [get_valueof "/d" "'\\377'" -1] set signof_char [get_valueof "/d" "(int) (char) -1" -1] set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1] set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1] +check_valueof "'\\\\377'" ${signof_byte} check_valueof "(int) (char) -1" ${signof_char} check_valueof "(int) (signed char) -1" ${signof_signed_char} check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char} diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index 14ccecd..1a61ba1 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -83,6 +83,18 @@ func2 () static_b = local_a; } +void +func3 () +{ + int x; + int y; + + x = 0; + x = 1; /* second x assignment */ + y = 1; + y = 2; +} + int func1 () { @@ -170,5 +182,8 @@ int main () recurser (2); marker6 (); + + func3 (); + return 0; } diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index f10955f..c5e37d4 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -648,6 +648,27 @@ proc test_complex_watchpoint {} { } } +proc test_watchpoint_and_breakpoint {} { + global gdb_prompt + + # This is a test for PR gdb/38, which involves setting a + # watchpoint right after you've reached a breakpoint. + + if [runto func3] then { + gdb_breakpoint [gdb_get_line_number "second x assignment"] + gdb_continue_to_breakpoint "second x assignment" + gdb_test "watch x" ".*atchpoint \[0-9\]+: x" + gdb_test_multiple "next" "next after watch x" { + -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" { + pass "next after watch x" + } + -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" { + kfail "gdb/38" "next after watch x" + } + } + } +} + # Start with a fresh gdb. gdb_exit @@ -799,6 +820,17 @@ if [initialize] then { timeout {fail "(timeout) access watches disallowed"} } } + + # See above. + if [istarget "mips-idt-*"] then { + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + initialize + } + + test_watchpoint_and_breakpoint } # Restore old timeout diff --git a/gdb/testsuite/gdb.c++/casts.exp b/gdb/testsuite/gdb.c++/casts.exp index 859755f..5b6cabe 100644 --- a/gdb/testsuite/gdb.c++/casts.exp +++ b/gdb/testsuite/gdb.c++/casts.exp @@ -55,11 +55,16 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \ "Breakpoint.*at.* file .*" \ "" -gdb_test "run" "Breakpoint .* at .*casts.cc.*" "" +gdb_test "continue" "Breakpoint .* at .*casts.cc.*" "" # Casting a pointer to a base class to a pointer to a derived class # should yield the entire derived class. Until August 2002, GDB got diff --git a/gdb/testsuite/gdb.c++/derivation.cc b/gdb/testsuite/gdb.c++/derivation.cc index 99efa76..f6d42e7 100644 --- a/gdb/testsuite/gdb.c++/derivation.cc +++ b/gdb/testsuite/gdb.c++/derivation.cc @@ -214,9 +214,9 @@ int main(void) #endif - marker1(); + marker1(); // marker1-returns-here - a_instance.a = 20; + a_instance.a = 20; // marker1-returns-here a_instance.aa = 21; b_instance.b = 22; b_instance.bb = 23; diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp index 9128730..38a46a2 100644 --- a/gdb/testsuite/gdb.c++/derivation.exp +++ b/gdb/testsuite/gdb.c++/derivation.exp @@ -300,6 +300,24 @@ gdb_expect { timeout { fail "(timeout) print value of g_instance.afoo()" } } + +# If GDB fails to restore the selected frame properly after the +# inferior function call above (see GDB PR 1155 for an explanation of +# why this might happen), all the subsequent tests will fail. We +# should detect report that failure, but let the marker call finish so +# that the rest of the tests can run undisturbed. +gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { + -re "#0 marker1.*$gdb_prompt $" { + setup_kfail "gdb/1155" s390-*-linux-gnu + fail "re-selected 'main' frame after inferior call" + gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.*" \ + "finish call to marker1" + } + -re "#1 ($hex in )?main.*$gdb_prompt $" { + pass "re-selected 'main' frame after inferior call" + } +} + send_gdb "print g_instance.bfoo()\n" gdb_expect { -re ".\[0-9\]* = 2.*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc index 9ac0d22..a41e14d 100644 --- a/gdb/testsuite/gdb.c++/overload.cc +++ b/gdb/testsuite/gdb.c++/overload.cc @@ -105,9 +105,9 @@ int main () // Verify that intToChar should work: intToChar(1); - marker1(); - XXX::marker2(); - return 0; + marker1(); // marker1-returns-here + XXX::marker2(); // marker1-returns-here + return 0; } foo::foo (int i) { ifoo = i; ccpfoo = NULL; } diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp index c41e3f2..7a2ecb4 100644 --- a/gdb/testsuite/gdb.c++/overload.exp +++ b/gdb/testsuite/gdb.c++/overload.exp @@ -120,6 +120,24 @@ gdb_expect { } +# If GDB fails to restore the selected frame properly after the +# inferior function call above (see GDB PR 1155 for an explanation of +# why this might happen), all the subsequent tests will fail. We +# should detect and report that failure, but let the marker call +# finish so that the rest of the tests can run undisturbed. +gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { + -re "#0 marker1.*$gdb_prompt $" { + setup_kfail "gdb/1155" s390-*-linux-gnu + fail "re-selected 'main' frame after inferior call" + gdb_test "finish" ".*main.*at .*overload.cc:.*// marker1-returns-here.*" \ + "finish call to marker1" + } + -re "#1 ($hex in )?main.*$gdb_prompt $" { + pass "re-selected 'main' frame after inferior call" + } +} + + send_gdb "print foo_instance1.overloadargs(1, 2)\n" gdb_expect { -re ".\[0-9\]* = 2\r\n$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.c++/userdef.cc b/gdb/testsuite/gdb.c++/userdef.cc index 95a4055..0bb88a2 100644 --- a/gdb/testsuite/gdb.c++/userdef.cc +++ b/gdb/testsuite/gdb.c++/userdef.cc @@ -273,8 +273,8 @@ int main (void) A1 three(0,0); int val; - marker1(); - cout << one; + marker1(); // marker1-returns-here + cout << one; // marker1-returns-here cout << two; three = one + two; cout << "+ " << three; diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp index a46aba6..4575249 100644 --- a/gdb/testsuite/gdb.c++/userdef.exp +++ b/gdb/testsuite/gdb.c++/userdef.exp @@ -66,6 +66,23 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}" +# If GDB fails to restore the selected frame properly after the +# inferior function call above (see GDB PR 1155 for an explanation of +# why this might happen), all the subsequent tests will fail. We +# should detect report that failure, but let the marker call finish so +# that the rest of the tests can run undisturbed. +gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" { + -re "#0 marker1.*$gdb_prompt $" { + setup_kfail "gdb/1155" s390-*-linux-gnu + fail "re-selected 'main' frame after inferior call" + gdb_test "finish" ".*main.*at .*userdef.cc:.*// marker1-returns-here.*" \ + "finish call to marker1" + } + -re "#1 ($hex in )?main.*$gdb_prompt $" { + pass "re-selected 'main' frame after inferior call" + } +} + gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}" gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}" diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog index d089462..d2aae78 100644 --- a/gdb/testsuite/gdb.mi/ChangeLog +++ b/gdb/testsuite/gdb.mi/ChangeLog @@ -1,3 +1,7 @@ +2003-04-08 Andrew Cagney <cagney@redhat.com> + + * gdb792.exp: Skip when C++. + 2003-02-23 Stephane Carrez <stcarrez@nerim.fr> * mi-syn-frame.exp: Don't run this test when gdb,nosignals is set. diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp index 3fc6df0..8196464 100644 --- a/gdb/testsuite/gdb.mi/gdb792.exp +++ b/gdb/testsuite/gdb.mi/gdb792.exp @@ -21,6 +21,8 @@ # test gdb/792 # +if { [skip_cplus_tests] } { continue } + load_lib mi-support.exp set MIFLAGS "-i=mi" diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp index 1ab019b..5dbe1a8 100644 --- a/gdb/testsuite/gdb.threads/pthreads.exp +++ b/gdb/testsuite/gdb.threads/pthreads.exp @@ -186,7 +186,7 @@ proc test_startup {} { set main_id $expect_out(1,string) # Check that we can continue and create the first thread. - gdb_test "break thread1" "Breakpoint .* file .*$srcdir.*" + gdb_test "break thread1" "Breakpoint .* file .*$srcfile.*" gdb_test "continue" \ "Continuing.*Breakpoint .*, thread1 \\(arg=0xfeedface\\).*at.*$srcfile.*" \ "Continue to creation of first thread" @@ -199,7 +199,7 @@ proc test_startup {} { # Check that we can continue and create the second thread, # ignoring the first thread for the moment. - gdb_test "break thread2" "Breakpoint .* file .*$srcdir.*" + gdb_test "break thread2" "Breakpoint .* file .*$srcfile.*" gdb_test "continue" \ "Continuing.*Breakpoint .*, thread2 \\(arg=0xdeadbeef\\).*at.*$srcfile.*" \ "Continue to creation of second thread" diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c index 033131c..13f9e75 100644 --- a/gdb/testsuite/gdb.threads/schedlock.c +++ b/gdb/testsuite/gdb.threads/schedlock.c @@ -13,12 +13,15 @@ int main() { int res; pthread_t threads[NUM]; void *thread_result; - int i; + long i; for (i = 0; i < NUM; i++) { args[i] = 1; - res = pthread_create(&threads[i], NULL, thread_function, (void *)i); + res = pthread_create(&threads[i], + NULL, + thread_function, + (void *) i); } /* schedlock.exp: last thread start. */ @@ -29,7 +32,7 @@ int main() { } void *thread_function(void *arg) { - int my_number = (int) arg; + int my_number = (long) arg; int *myp = &args[my_number]; /* Don't run forever. Run just short of it :) */ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index d2b6fbd..4dfbf76 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -541,27 +541,27 @@ proc gdb_test_multiple { command message user_code } { } -re "Program exited with code \[0-9\]+.*$gdb_prompt $" { if ![string match "" $message] then { - set errmsg "$message: the program exited" + set errmsg "$message (the program exited)" } else { - set errmsg "$command: the program exited" + set errmsg "$command (the program exited)" } fail "$errmsg" set result -1 } -re "EXIT code \[0-9\r\n\]+Program exited normally.*$gdb_prompt $" { if ![string match "" $message] then { - set errmsg "$message: the program exited" + set errmsg "$message (the program exited)" } else { - set errmsg "$command: the program exited" + set errmsg "$command (the program exited)" } fail "$errmsg" set result -1 } -re "The program is not being run.*$gdb_prompt $" { if ![string match "" $message] then { - set errmsg "$message: the program is no longer running" + set errmsg "$message (the program is no longer running)" } else { - set errmsg "$command: the program is no longer running" + set errmsg "$command (the program is no longer running)" } fail "$errmsg" set result -1 diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 4b057d4..5907628 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -549,18 +549,18 @@ proc mi_gdb_test { args } { } -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" { if ![string match "" $message] then { - set errmsg "$message: the program exited" + set errmsg "$message (the program exited)" } else { - set errmsg "$command: the program exited" + set errmsg "$command (the program exited)" } fail "$errmsg" return -1 } -re "The program is not being run.*$mi_gdb_prompt\[ \]*$" { if ![string match "" $message] then { - set errmsg "$message: the program is no longer running" + set errmsg "$message (the program is no longer running)" } else { - set errmsg "$command: the program is no longer running" + set errmsg "$command (the program is no longer running)" } fail "$errmsg" return -1 diff --git a/gdb/thread.c b/gdb/thread.c index 2c70ee5..53a2d4f 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -255,9 +255,8 @@ in_thread_list (ptid_t ptid) /* Print a list of thread ids currently known, and the total number of threads. To be used from within catch_errors. */ -static int -do_captured_list_thread_ids (struct ui_out *uiout, - void *arg) +static int +do_captured_list_thread_ids (struct ui_out *uiout, void *arg) { struct thread_info *tp; int num = 0; @@ -291,24 +290,22 @@ gdb_list_thread_ids (struct ui_out *uiout) /* Load infrun state for the thread PID. */ void -load_infrun_state (ptid_t ptid, - CORE_ADDR *prev_pc, - CORE_ADDR *prev_func_start, - char **prev_func_name, +load_infrun_state (ptid_t ptid, + CORE_ADDR *prev_pc, + char **prev_func_name, int *trap_expected, struct breakpoint **step_resume_breakpoint, struct breakpoint **through_sigtramp_breakpoint, - CORE_ADDR *step_range_start, + CORE_ADDR *step_range_start, CORE_ADDR *step_range_end, - struct frame_id *step_frame_id, + struct frame_id *step_frame_id, int *handling_longjmp, - int *another_trap, + int *another_trap, int *stepping_through_solib_after_catch, bpstat *stepping_through_solib_catchpoints, int *stepping_through_sigtramp, - int *current_line, - struct symtab **current_symtab, - CORE_ADDR *step_sp) + int *current_line, + struct symtab **current_symtab, CORE_ADDR *step_sp) { struct thread_info *tp; @@ -319,7 +316,6 @@ load_infrun_state (ptid_t ptid, return; *prev_pc = tp->prev_pc; - *prev_func_start = tp->prev_func_start; *prev_func_name = tp->prev_func_name; *trap_expected = tp->trap_expected; *step_resume_breakpoint = tp->step_resume_breakpoint; @@ -329,8 +325,10 @@ load_infrun_state (ptid_t ptid, *step_frame_id = tp->step_frame_id; *handling_longjmp = tp->handling_longjmp; *another_trap = tp->another_trap; - *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch; - *stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints; + *stepping_through_solib_after_catch = + tp->stepping_through_solib_after_catch; + *stepping_through_solib_catchpoints = + tp->stepping_through_solib_catchpoints; *stepping_through_sigtramp = tp->stepping_through_sigtramp; *current_line = tp->current_line; *current_symtab = tp->current_symtab; @@ -340,24 +338,22 @@ load_infrun_state (ptid_t ptid, /* Save infrun state for the thread PID. */ void -save_infrun_state (ptid_t ptid, - CORE_ADDR prev_pc, - CORE_ADDR prev_func_start, - char *prev_func_name, +save_infrun_state (ptid_t ptid, + CORE_ADDR prev_pc, + char *prev_func_name, int trap_expected, struct breakpoint *step_resume_breakpoint, struct breakpoint *through_sigtramp_breakpoint, - CORE_ADDR step_range_start, + CORE_ADDR step_range_start, CORE_ADDR step_range_end, - const struct frame_id *step_frame_id, + const struct frame_id *step_frame_id, int handling_longjmp, - int another_trap, + int another_trap, int stepping_through_solib_after_catch, bpstat stepping_through_solib_catchpoints, - int stepping_through_sigtramp, + int stepping_through_sigtramp, int current_line, - struct symtab *current_symtab, - CORE_ADDR step_sp) + struct symtab *current_symtab, CORE_ADDR step_sp) { struct thread_info *tp; @@ -368,7 +364,6 @@ save_infrun_state (ptid_t ptid, return; tp->prev_pc = prev_pc; - tp->prev_func_start = prev_func_start; tp->prev_func_name = prev_func_name; tp->trap_expected = trap_expected; tp->step_resume_breakpoint = step_resume_breakpoint; @@ -506,7 +501,7 @@ switch_to_thread (ptid_t ptid) static void restore_current_thread (ptid_t ptid) { - if (! ptid_equal (ptid, inferior_ptid)) + if (!ptid_equal (ptid, inferior_ptid)) { switch_to_thread (ptid); print_stack_frame (get_current_frame (), 0, -1); @@ -571,14 +566,13 @@ thread_apply_all_command (char *cmd, int from_tty) switch_to_thread (tp->ptid); #ifdef HPUXHPPA printf_filtered ("\nThread %d (%s):\n", - tp->num, - target_tid_to_str (inferior_ptid)); + tp->num, target_tid_to_str (inferior_ptid)); #else printf_filtered ("\nThread %d (%s):\n", tp->num, target_pid_to_str (inferior_ptid)); #endif execute_command (cmd, from_tty); - strcpy (cmd, saved_cmd); /* Restore exact command used previously */ + strcpy (cmd, saved_cmd); /* Restore exact command used previously */ } do_cleanups (saved_cmd_cleanup_chain); @@ -690,8 +684,7 @@ thread_command (char *tidstr, int from_tty) } static int -do_captured_thread_select (struct ui_out *uiout, - void *tidstr) +do_captured_thread_select (struct ui_out *uiout, void *tidstr) { int num; struct thread_info *tp; @@ -724,8 +717,7 @@ do_captured_thread_select (struct ui_out *uiout, } enum gdb_rc -gdb_thread_select (struct ui_out *uiout, - char *tidstr) +gdb_thread_select (struct ui_out *uiout, char *tidstr) { return catch_exceptions (uiout, do_captured_thread_select, tidstr, NULL, RETURN_MASK_ALL); @@ -744,16 +736,14 @@ _initialize_thread (void) add_prefix_cmd ("thread", class_run, thread_command, "Use this command to switch between threads.\n\ -The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1, - &cmdlist); +The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1, &cmdlist); add_prefix_cmd ("apply", class_run, thread_apply_command, "Apply a command to a list of threads.", &thread_apply_list, "apply ", 1, &thread_cmd_list); add_cmd ("all", class_run, thread_apply_all_command, - "Apply a command to all threads.", - &thread_apply_list); + "Apply a command to all threads.", &thread_apply_list); if (!xdb_commands) add_com_alias ("t", "thread", class_run, 1); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index c3e659d..7069f96 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,17 @@ +2003-03-14 Andrew Cagney <cagney@redhat.com> + + * tuiRegs.c (_tuiGetRegisterRawValue): Use frame_read_register, + instead of get_saved_register. + +2003-03-13 Stephane Carrez <stcarrez@nerim.fr> + + * tui-out.c (tui_out_data): Fix typedef. + +2003-03-08 Andrew Cagney <cagney@redhat.com> + + * tui-out.c: Update copyright. + (tui_out_data): Define typedef. Use instead of ui_out_data. + 2003-02-14 Andrew Cagney <ac131313@redhat.com> * tui.c (tui_enable, tui_disable): Don't modify tui_version. diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 71ce5e0..94fda09 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -1,6 +1,7 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, + Inc. Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -35,6 +36,7 @@ struct ui_out_data int line; int start_of_line; }; +typedef struct ui_out_data tui_out_data; /* These are the CLI output functions */ @@ -112,7 +114,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols, int nr_rows, const char *tblid) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (nr_rows == 0) data->suppress_output = 1; else @@ -126,7 +128,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols, void tui_table_body (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; /* first, close the table header line */ @@ -138,7 +140,7 @@ tui_table_body (struct ui_out *uiout) void tui_table_end (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); data->suppress_output = 0; } @@ -149,7 +151,7 @@ tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; tui_field_string (uiout, 0, width, alignment, 0, colhdr); @@ -163,7 +165,7 @@ tui_begin (struct ui_out *uiout, int level, const char *id) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -175,7 +177,7 @@ tui_end (struct ui_out *uiout, enum ui_out_type type, int level) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; } @@ -189,7 +191,7 @@ tui_field_int (struct ui_out *uiout, int fldno, int width, { char buffer[20]; /* FIXME: how many chars long a %d can become? */ - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -212,7 +214,7 @@ tui_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; tui_field_string (uiout, fldno, width, alignment, fldname, ""); @@ -232,7 +234,7 @@ tui_field_string (struct ui_out *uiout, int before = 0; int after = 0; - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -290,7 +292,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; @@ -304,7 +306,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno, void tui_spaces (struct ui_out *uiout, int numspaces) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; print_spaces_filtered (numspaces, data->stream); @@ -313,7 +315,7 @@ tui_spaces (struct ui_out *uiout, int numspaces) void tui_text (struct ui_out *uiout, const char *string) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; data->start_of_line ++; @@ -335,7 +337,7 @@ void tui_message (struct ui_out *uiout, int verbosity, const char *format, va_list args) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; if (ui_out_get_verblvl (uiout) >= verbosity) @@ -345,7 +347,7 @@ tui_message (struct ui_out *uiout, int verbosity, void tui_wrap_hint (struct ui_out *uiout, char *identstring) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); if (data->suppress_output) return; wrap_here (identstring); @@ -354,7 +356,7 @@ tui_wrap_hint (struct ui_out *uiout, char *identstring) void tui_flush (struct ui_out *uiout) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); gdb_flush (data->stream); } @@ -369,7 +371,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, const char *fldname, const char *format,...) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); va_list args; va_start (args, format); @@ -383,7 +385,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, static void field_separator (void) { - struct ui_out_data *data = ui_out_data (uiout); + tui_out_data *data = ui_out_data (uiout); fputc_filtered (' ', data->stream); } @@ -394,7 +396,7 @@ tui_out_new (struct ui_file *stream) { int flags = 0; - struct ui_out_data *data = XMALLOC (struct ui_out_data); + tui_out_data *data = XMALLOC (tui_out_data); data->stream = stream; data->suppress_output = 0; data->line = -1; diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 6fc63d9..6920d80 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -799,10 +799,10 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) if (target_has_registers) { - int opt; - - get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame, - regNum, (enum lval_type*) NULL); + frame_read_register (frame, regNum, regValue); + /* NOTE: cagney/2003-03-13: This is bogus. It is refering to + the register cache and not the frame which could have pulled + the register value off the stack. */ if (register_cached (regNum) >= 0) ret = TUI_SUCCESS; } diff --git a/gdb/typeprint.h b/gdb/typeprint.h index c57cc58..f2de1c5 100644 --- a/gdb/typeprint.h +++ b/gdb/typeprint.h @@ -22,6 +22,8 @@ #ifndef TYPEPRINT_H #define TYPEPRINT_H +struct ui_file; + void print_type_scalar (struct type * type, LONGEST, struct ui_file *); void c_type_print_varspec_suffix (struct type *, struct ui_file *, int, diff --git a/gdb/utils.c b/gdb/utils.c index d0f2edd..6d62f1c 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1073,16 +1073,15 @@ xmmalloc (void *md, size_t size) { void *val; + /* See libiberty/xmalloc.c. This function need's to match that's + semantics. It never returns NULL. */ if (size == 0) - { - val = NULL; - } - else - { - val = mmalloc (md, size); - if (val == NULL) - nomem (size); - } + size = 1; + + val = mmalloc (md, size); + if (val == NULL) + nomem (size); + return (val); } @@ -1091,27 +1090,18 @@ xmrealloc (void *md, void *ptr, size_t size) { void *val; + /* See libiberty/xmalloc.c. This function need's to match that's + semantics. It never returns NULL. */ if (size == 0) - { - if (ptr != NULL) - mfree (md, ptr); - val = NULL; - } + size = 1; + + if (ptr != NULL) + val = mrealloc (md, ptr, size); else - { - if (ptr != NULL) - { - val = mrealloc (md, ptr, size); - } - else - { - val = mmalloc (md, size); - } - if (val == NULL) - { - nomem (size); - } - } + val = mmalloc (md, size); + if (val == NULL) + nomem (size); + return (val); } @@ -1119,14 +1109,19 @@ void * xmcalloc (void *md, size_t number, size_t size) { void *mem; + + /* See libiberty/xmalloc.c. This function need's to match that's + semantics. It never returns NULL. */ if (number == 0 || size == 0) - mem = NULL; - else { - mem = mcalloc (md, number, size); - if (mem == NULL) - nomem (number * size); + number = 1; + size = 1; } + + mem = mcalloc (md, number, size); + if (mem == NULL) + nomem (number * size); + return mem; } @@ -2299,22 +2294,7 @@ fprintf_symbol_filtered (struct ui_file *stream, const char *name, } else { - switch (lang) - { - case language_cplus: - demangled = cplus_demangle (name, arg_mode); - break; - case language_java: - demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); - break; - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /*demangled = objc_demangle (name); */ - /*break; */ - default: - demangled = NULL; - break; - } + demangled = language_demangle (language_def (lang), name, arg_mode); fputs_filtered (demangled ? demangled : name, stream); if (demangled != NULL) { diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 0894a8f..de81056 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -826,7 +826,7 @@ v850_frame_chain (struct frame_info *fi) CORE_ADDR callers_pc, fp; /* First, find out who called us */ - callers_pc = FRAME_SAVED_PC (fi); + callers_pc = DEPRECATED_FRAME_SAVED_PC (fi); /* If caller is a call-dummy, then our FP bears no relation to his FP! */ fp = v850_find_callers_reg (fi, E_FP_RAW_REGNUM); if (DEPRECATED_PC_IN_CALL_DUMMY (callers_pc, fp, fp)) @@ -892,7 +892,7 @@ v850_pop_frame (void) generic_pop_dummy_frame (); else { - write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (E_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame)); for (regnum = 0; regnum < E_NUM_REGS; regnum++) if (get_frame_saved_regs (frame)[regnum] != 0) @@ -1165,7 +1165,7 @@ v850_init_extra_frame_info (int fromleaf, struct frame_info *fi) struct prologue_info pi; if (get_next_frame (fi)) - deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi))); + deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi))); v850_frame_init_saved_regs (fi); } @@ -1244,9 +1244,9 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) */ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs); set_gdbarch_deprecated_init_extra_frame_info (gdbarch, v850_init_extra_frame_info); - set_gdbarch_frame_chain (gdbarch, v850_frame_chain); - set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, v850_frame_chain); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, v850_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, v850_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue); /* @@ -1268,24 +1268,16 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * Call Dummies * * These values and methods are used when gdb calls a target function. */ - set_gdbarch_push_return_address (gdbarch, v850_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, v850_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value); - set_gdbarch_push_arguments (gdbarch, v850_push_arguments); - set_gdbarch_pop_frame (gdbarch, v850_pop_frame); - set_gdbarch_store_struct_return (gdbarch, v850_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, v850_push_arguments); + set_gdbarch_deprecated_pop_frame (gdbarch, v850_pop_frame); + set_gdbarch_deprecated_store_struct_return (gdbarch, v850_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, v850_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, v850_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, v850_use_struct_convention); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - /* set_gdbarch_call_dummy_stack_adjust */ set_gdbarch_fix_call_dummy (gdbarch, v850_fix_call_dummy); set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc); @@ -1294,7 +1286,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); return gdbarch; } diff --git a/gdb/valarith.c b/gdb/valarith.c index e1b4426..97b3370 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -276,6 +276,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound else VALUE_LVAL (v) = VALUE_LVAL (array); VALUE_ADDRESS (v) = VALUE_ADDRESS (array); + VALUE_REGNO (v) = VALUE_REGNO (array); VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs; return v; } diff --git a/gdb/valops.c b/gdb/valops.c index 647a7fc..1b7f174 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1126,8 +1126,8 @@ value_push (register CORE_ADDR sp, struct value *arg) } CORE_ADDR -default_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) +legacy_push_arguments (int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) { /* ASSERT ( !struct_return); */ int i; @@ -1287,8 +1287,8 @@ find_function_addr (struct value *function, struct type **retval_type) ARGS is modified to contain coerced values. */ -static struct value * -hand_function_call (struct value *function, int nargs, struct value **args) +struct value * +call_function_by_hand (struct value *function, int nargs, struct value **args) { register CORE_ADDR sp; register int i; @@ -1311,6 +1311,7 @@ hand_function_call (struct value *function, int nargs, struct value **args) static ULONGEST *dummy; int sizeof_dummy1; char *dummy1; + CORE_ADDR dummy_addr; CORE_ADDR old_sp; struct type *value_type; unsigned char struct_return; @@ -1350,7 +1351,7 @@ hand_function_call (struct value *function, int nargs, struct value **args) if (DEPRECATED_PUSH_DUMMY_FRAME_P ()) { /* DEPRECATED_PUSH_DUMMY_FRAME is responsible for saving the - inferior registers (and POP_FRAME for restoring them). (At + 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; @@ -1421,9 +1422,9 @@ hand_function_call (struct value *function, int nargs, struct value **args) 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 FRAME_CHAIN so that - when the next outer frame is a generic dummy, it returns the - current frame's base. */ + 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)) @@ -1470,26 +1471,34 @@ hand_function_call (struct value *function, int nargs, struct value **args) real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type, using_gcc); #else - FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, - value_type, using_gcc); + if (FIX_CALL_DUMMY_P ()) + { + /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true? */ + FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type, + using_gcc); + } real_pc = start_sp; #endif - if (CALL_DUMMY_LOCATION == ON_STACK) + switch (CALL_DUMMY_LOCATION) { + case ON_STACK: + dummy_addr = start_sp; write_memory (start_sp, (char *) dummy1, sizeof_dummy1); if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1); - } - - if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT) - { + break; + case AT_ENTRY_POINT: real_pc = funaddr; + dummy_addr = CALL_DUMMY_ADDRESS (); if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES) /* NOTE: cagney/2002-04-13: The entry point is going to be modified with a single breakpoint. */ generic_save_call_dummy_addr (CALL_DUMMY_ADDRESS (), CALL_DUMMY_ADDRESS () + 1); + break; + default: + internal_error (__FILE__, __LINE__, "bad switch"); } #ifdef lint @@ -1616,9 +1625,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name); { int len = TYPE_LENGTH (value_type); if (STACK_ALIGN_P ()) - /* MVS 11/22/96: I think at least some of this stack_align - code is really broken. Better to let PUSH_ARGUMENTS adjust - the stack in a target-defined manner. */ + /* NOTE: cagney/2003-03-22: Should rely on frame align, rather + than stack align to force the alignment of the stack. */ len = STACK_ALIGN (len); if (INNER_THAN (1, 2)) { @@ -1646,10 +1654,13 @@ You must use a pointer to function type variable. Command ignored.", arg_name); 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 */ - if (EXTRA_STACK_ALIGNMENT_NEEDED) + /* 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_ARGUMENTS adjust the + is really broken. Better to let push_dummy_call() adjust the stack in a target-defined manner. */ if (STACK_ALIGN_P () && INNER_THAN (1, 2)) { @@ -1658,15 +1669,30 @@ You must use a pointer to function type variable. Command ignored.", arg_name); for (i = nargs - 1; i >= 0; i--) len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i])); - if (CALL_DUMMY_STACK_ADJUST_P) - len += CALL_DUMMY_STACK_ADJUST; + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) + len += DEPRECATED_CALL_DUMMY_STACK_ADJUST; sp -= STACK_ALIGN (len) - len; } } - sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr); + /* Create the dummy stack frame. Pass in the call dummy address as, + presumably, the ABI code knows where, in the call dummy, the + return address should be pointed. */ + if (gdbarch_push_dummy_call_p (current_gdbarch)) + /* When there is no push_dummy_call method, should this code + simply error out. That would the implementation of this method + for all ABIs (which is probably a good thing). */ + sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache, + dummy_addr, nargs, args, sp, struct_return, + struct_addr); + else if (DEPRECATED_PUSH_ARGUMENTS_P ()) + /* Keep old targets working. */ + sp = DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, + struct_addr); + else + sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr); - if (PUSH_RETURN_ADDRESS_P ()) + if (DEPRECATED_PUSH_RETURN_ADDRESS_P ()) /* for targets that use no CALL_DUMMY */ /* There are a number of targets now which actually don't write any CALL_DUMMY instructions into the target, but instead just @@ -1677,14 +1703,19 @@ You must use a pointer to function type variable. Command ignored.", arg_name); return-address register as appropriate. Formerly this has been done in PUSH_ARGUMENTS, but that's overloading its functionality a bit, so I'm making it explicit to do it here. */ - sp = PUSH_RETURN_ADDRESS (real_pc, sp); + sp = DEPRECATED_PUSH_RETURN_ADDRESS (real_pc, sp); - if (STACK_ALIGN_P () && !INNER_THAN (1, 2)) + /* NOTE: cagney/2003-03-23: Diable this code when there is a + push_dummy_call() method. Since that method will have already + handled any alignment issues, the code below is entirely + redundant. */ + if (!gdbarch_push_dummy_call_p (current_gdbarch) + && STACK_ALIGN_P () && !INNER_THAN (1, 2)) { /* If stack grows up, we must leave a hole at the bottom, note that sp already has been advanced for the arguments! */ - if (CALL_DUMMY_STACK_ADJUST_P) - sp += CALL_DUMMY_STACK_ADJUST; + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) + sp += DEPRECATED_CALL_DUMMY_STACK_ADJUST; sp = STACK_ALIGN (sp); } @@ -1693,30 +1724,31 @@ You must use a pointer to function type variable. Command ignored.", arg_name); /* 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 (CALL_DUMMY_STACK_ADJUST_P) + if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()) if (INNER_THAN (1, 2)) { /* stack grows downward */ - sp -= CALL_DUMMY_STACK_ADJUST; + sp -= DEPRECATED_CALL_DUMMY_STACK_ADJUST; } /* Store the address at which the structure is supposed to be - written. Note that this (and the code which reserved the space - above) assumes that gcc was used to compile this function. Since - it doesn't cost us anything but space and if the function is pcc - it will ignore this value, we will make that assumption. - - Also note that on some machines (like the sparc) pcc uses a - convention like gcc's. */ - - if (struct_return) - STORE_STRUCT_RETURN (struct_addr, sp); + 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.) */ - write_sp (sp); + /* NOTE: cagney/2003-03-23: Disable this code when there is a + push_dummy_call() method. Since that method will have already + stored the stack pointer (as part of creating the fake call + frame), and none of the code following that code adjusts the + stack-pointer value, the below call is entirely redundant. */ + if (DEPRECATED_DUMMY_WRITE_SP_P ()) + DEPRECATED_DUMMY_WRITE_SP (sp); if (SAVE_DUMMY_FRAME_TOS_P ()) SAVE_DUMMY_FRAME_TOS (sp); @@ -1874,21 +1906,6 @@ the function call).", name); } } -struct value * -call_function_by_hand (struct value *function, int nargs, struct value **args) -{ - if (CALL_DUMMY_P) - { - return hand_function_call (function, nargs, args); - } - else - { - error ("Cannot invoke functions on this machine."); - } -} - - - /* Create a value for an array by allocating space in the inferior, copying the data into that space, and then setting up an array value. diff --git a/gdb/valprint.c b/gdb/valprint.c index b1c47a1..d4b8bf5 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -205,12 +205,8 @@ val_print_type_code_int (struct type *type, char *valaddr, } else { -#ifdef PRINT_TYPELESS_INTEGER - PRINT_TYPELESS_INTEGER (stream, type, unpack_long (type, valaddr)); -#else print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0, unpack_long (type, valaddr)); -#endif } } diff --git a/gdb/valprint.h b/gdb/valprint.h index 52314aa..4e2d166 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -33,6 +33,12 @@ extern int objectprint; /* Controls looking up an object's derived type extern unsigned int print_max; /* Max # of chars for strings/vectors */ +/* Flag to low-level print routines that this value is being printed + in an epoch window. We'd like to pass this as a parameter, but + every routine would need to take it. Perhaps we can encapsulate + this in the I/O stream once we have GNU stdio. */ +extern int inspect_it; + /* Print repeat counts if there are more than this many repetitions of an element in an array. Referenced by the low level language dependent print routines. */ diff --git a/gdb/value.h b/gdb/value.h index 928f940..102b709 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -23,6 +23,10 @@ #if !defined (VALUE_H) #define VALUE_H 1 +struct ui_file; +struct expression; +struct symbol; +struct type; struct regcache; struct block; @@ -128,9 +132,7 @@ struct value list. */ struct value *next; - /* Register number if the value is from a register. Is not kept - if you take a field of a structure that is stored in a - register. Shouldn't it be? */ + /* Register number if the value is from a register. */ short regno; /* If zero, contents of this value are in the contents field. If nonzero, contents are in inferior memory at address @@ -560,9 +562,9 @@ extern struct value *find_function_in_inferior (const char *); extern struct value *value_allocate_space_in_inferior (int); -extern CORE_ADDR default_push_arguments (int nargs, struct value ** args, - CORE_ADDR sp, int struct_return, - CORE_ADDR struct_addr); +extern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args, + CORE_ADDR sp, int struct_return, + CORE_ADDR struct_addr); extern struct value *value_of_local (const char *name, int complain); diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index ab968b6..859e2b3 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -40,20 +40,16 @@ static gdbarch_register_virtual_size_ftype vax_register_virtual_size; static gdbarch_register_virtual_type_ftype vax_register_virtual_type; static gdbarch_skip_prologue_ftype vax_skip_prologue; -static gdbarch_saved_pc_after_call_ftype vax_saved_pc_after_call; static gdbarch_frame_num_args_ftype vax_frame_num_args; -static gdbarch_frame_chain_ftype vax_frame_chain; -static gdbarch_frame_saved_pc_ftype vax_frame_saved_pc; +static gdbarch_deprecated_frame_chain_ftype vax_frame_chain; static gdbarch_frame_args_address_ftype vax_frame_args_address; static gdbarch_frame_locals_address_ftype vax_frame_locals_address; -static gdbarch_store_struct_return_ftype vax_store_struct_return; static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value; static gdbarch_deprecated_extract_struct_value_address_ftype vax_extract_struct_value_address; static gdbarch_deprecated_push_dummy_frame_ftype vax_push_dummy_frame; -static gdbarch_pop_frame_ftype vax_pop_frame; static gdbarch_fix_call_dummy_ftype vax_fix_call_dummy; /* Return 1 if P points to an invalid floating point value. @@ -375,7 +371,7 @@ vax_skip_prologue (CORE_ADDR pc) static CORE_ADDR vax_saved_pc_after_call (struct frame_info *frame) { - return (FRAME_SAVED_PC(frame)); + return (DEPRECATED_FRAME_SAVED_PC(frame)); } /* Print the vax instruction at address MEMADDR in debugged memory, @@ -643,14 +639,14 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Frame and stack info */ set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue); - set_gdbarch_saved_pc_after_call (gdbarch, vax_saved_pc_after_call); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, vax_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args); set_gdbarch_frameless_function_invocation (gdbarch, generic_frameless_function_invocation_not); - set_gdbarch_frame_chain (gdbarch, vax_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, vax_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, vax_frame_chain); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, vax_frame_saved_pc); set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address); set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address); @@ -662,25 +658,21 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); /* Return value info */ - set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return); + set_gdbarch_deprecated_store_struct_return (gdbarch, vax_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value); set_gdbarch_deprecated_store_return_value (gdbarch, vax_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address); /* Call dummy info */ set_gdbarch_deprecated_push_dummy_frame (gdbarch, vax_push_dummy_frame); - set_gdbarch_pop_frame (gdbarch, vax_pop_frame); + set_gdbarch_deprecated_pop_frame (gdbarch, vax_pop_frame); set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, vax_call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_vax_call_dummy_words); set_gdbarch_fix_call_dummy (gdbarch, vax_fix_call_dummy); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 7); set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); /* Breakpoint info */ set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc); @@ -690,6 +682,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_function_start_offset (gdbarch, 2); set_gdbarch_believe_pcc_promotion (gdbarch, 1); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/version.in b/gdb/version.in index 8a8ed14..6665297 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-03-05-cvs +2003-04-16-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 5ba1da2..f3c08e3 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -240,17 +240,6 @@ x86_64_dwarf2_reg_to_regnum (int dw_reg) return x86_64_dwarf2gdb_regno_map[dw_reg]; } -/* This is the variable that is set with "set disassembly-flavour", and - its legitimate values. */ -static const char att_flavour[] = "att"; -static const char intel_flavour[] = "intel"; -static const char *valid_flavours[] = { - att_flavour, - intel_flavour, - NULL -}; -static const char *disassembly_flavour = att_flavour; - /* Push the return address (pointing to the call dummy) onto the stack and return the new value for the stack pointer. */ @@ -471,6 +460,8 @@ classify_argument (struct type *type, return 2; } break; + case TYPE_CODE_ENUM: + case TYPE_CODE_REF: case TYPE_CODE_INT: case TYPE_CODE_PTR: switch (bytes) @@ -700,11 +691,17 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp, intreg += 2; break; case X86_64_INTEGERSI_CLASS: - deprecated_write_register_gen (int_parameter_registers[intreg / 2], - VALUE_CONTENTS_ALL (args[i]) + offset); - offset += 8; - intreg++; - break; + { + LONGEST num + = extract_signed_integer (VALUE_CONTENTS_ALL (args[i]) + + offset, 4); + regcache_raw_write_signed (current_regcache, + int_parameter_registers[intreg / 2], num); + + offset += 8; + intreg++; + break; + } case X86_64_SSEDF_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSE_CLASS: @@ -773,7 +770,7 @@ x86_64_store_return_value (struct type *type, struct regcache *regcache, floating point format used by the FPU. This is probably not exactly how it would happen on the target itself, but it is the best we can do. */ - val = extract_floating (valbuf, TYPE_LENGTH (type)); + val = deprecated_extract_floating (valbuf, TYPE_LENGTH (type)); floatformat_from_doublest (&floatformat_i387_ext, &val, buf); regcache_cooked_write_part (regcache, FP0_REGNUM, 0, FPU_REG_RAW_SIZE, buf); @@ -820,23 +817,6 @@ x86_64_register_number (const char *name) } - -/* We have two flavours of disassembly. The machinery on this page - deals with switching between those. */ - -static int -gdb_print_insn_x86_64 (bfd_vma memaddr, disassemble_info * info) -{ - if (disassembly_flavour == att_flavour) - return print_insn_i386_att (memaddr, info); - else if (disassembly_flavour == intel_flavour) - return print_insn_i386_intel (memaddr, info); - /* Never reached -- disassembly_flavour is always either att_flavour - or intel_flavour. */ - internal_error (__FILE__, __LINE__, "failed internal consistency check"); -} - - /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. */ void @@ -851,11 +831,34 @@ x86_64_frameless_function_invocation (struct frame_info *frame) return 0; } +/* We will handle only functions beginning with: + 55 pushq %rbp + 48 89 e5 movq %rsp,%rbp + Any function that doesn't start with this sequence + will be assumed to have no prologue and thus no valid + frame pointer in %rbp. */ +#define PROLOG_BUFSIZE 4 +int +x86_64_function_has_prologue (CORE_ADDR pc) +{ + int i; + unsigned char prolog_expect[PROLOG_BUFSIZE] = { 0x55, 0x48, 0x89, 0xe5 }, + prolog_buf[PROLOG_BUFSIZE]; + + read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE); + + /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */ + for (i = 0; i < PROLOG_BUFSIZE; i++) + if (prolog_expect[i] != prolog_buf[i]) + return 0; /* ... no, it doesn't. Nothing to skip. */ + + return 1; +} + /* If a function with debugging information and known beginning is detected, we will return pc of the next line in the source code. With this approach we effectively skip the prolog. */ -#define PROLOG_BUFSIZE 4 CORE_ADDR x86_64_skip_prologue (CORE_ADDR pc) { @@ -863,21 +866,9 @@ x86_64_skip_prologue (CORE_ADDR pc) struct symtab_and_line v_sal; struct symbol *v_function; CORE_ADDR endaddr; - unsigned char prolog_buf[PROLOG_BUFSIZE]; - - /* We will handle only functions starting with: */ - static unsigned char prolog_expect[PROLOG_BUFSIZE] = - { - 0x55, /* pushq %rbp */ - 0x48, 0x89, 0xe5 /* movq %rsp, %rbp */ - }; - read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE); - - /* First check, whether pc points to pushq %rbp, movq %rsp, %rbp. */ - for (i = 0; i < PROLOG_BUFSIZE; i++) - if (prolog_expect[i] != prolog_buf[i]) - return pc; /* ... no, it doesn't. Nothing to skip. */ + if (! x86_64_function_has_prologue (pc)) + return pc; /* OK, we have found the prologue and want PC of the first non-prologue instruction. */ @@ -904,13 +895,21 @@ x86_64_skip_prologue (CORE_ADDR pc) return pc; } -/* Sequence of bytes for breakpoint instruction. */ -static const unsigned char * -x86_64_breakpoint_from_pc (CORE_ADDR *pc, int *lenptr) +static void +x86_64_save_dummy_frame_tos (CORE_ADDR sp) +{ + /* We must add the size of the return address that is already + put on the stack. */ + generic_save_dummy_frame_tos (sp + + TYPE_LENGTH (builtin_type_void_func_ptr)); +} + +static struct frame_id +x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame) { - static unsigned char breakpoint[] = { 0xcc }; - *lenptr = 1; - return breakpoint; + CORE_ADDR base; + frame_unwind_unsigned_register (frame, SP_REGNUM, &base); + return frame_id_build (base, frame_pc_unwind (frame)); } void @@ -975,17 +974,17 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) x86_64_register_convert_to_raw); /* Getting saved registers is handled by unwind information. */ - set_gdbarch_get_saved_register (gdbarch, cfi_get_saved_register); + 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_extract_return_value (gdbarch, x86_64_extract_return_value); - set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments); - set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address); - set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame); - set_gdbarch_store_struct_return (gdbarch, x86_64_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, x86_64_push_arguments); + set_gdbarch_deprecated_push_return_address (gdbarch, x86_64_push_return_address); + set_gdbarch_deprecated_pop_frame (gdbarch, x86_64_pop_frame); + set_gdbarch_deprecated_store_struct_return (gdbarch, x86_64_store_struct_return); set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value); /* Override, since this is handled by x86_64_extract_return_value. */ set_gdbarch_extract_struct_value_address (gdbarch, NULL); @@ -994,13 +993,13 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs); set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue); - set_gdbarch_frame_chain (gdbarch, x86_64_linux_frame_chain); + set_gdbarch_deprecated_frame_chain (gdbarch, x86_64_linux_frame_chain); set_gdbarch_frameless_function_invocation (gdbarch, x86_64_frameless_function_invocation); /* FIXME: kettenis/20021026: These two are GNU/Linux-specific and should be moved elsewhere. */ - set_gdbarch_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc); - set_gdbarch_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* FIXME: kettenis/20021026: This one is GNU/Linux-specific too. */ set_gdbarch_pc_in_sigtramp (gdbarch, x86_64_linux_in_sigtramp); @@ -1023,6 +1022,10 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) since all supported x86-64 targets are ELF, but that might change in the future. */ set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); + + /* Dummy frame helper functions. */ + set_gdbarch_save_dummy_frame_tos (gdbarch, x86_64_save_dummy_frame_tos); + set_gdbarch_unwind_dummy_id (gdbarch, x86_64_unwind_dummy_id); } void diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index 6977f9b..6885a7c 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -23,6 +23,9 @@ #ifndef X86_64_TDEP_H #define X86_64_TDEP_H +struct gdbarch; +struct frame_info; + #include "i386-tdep.h" extern int x86_64_num_regs; @@ -31,11 +34,12 @@ extern int x86_64_num_gregs; int x86_64_register_number (const char *name); const char *x86_64_register_name (int reg_nr); -gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; -gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; +gdbarch_deprecated_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; +gdbarch_deprecated_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; gdbarch_pc_in_sigtramp_ftype x86_64_linux_in_sigtramp; CORE_ADDR x86_64_linux_frame_chain (struct frame_info *fi); CORE_ADDR x86_64_init_frame_pc (int fromleaf, struct frame_info *fi); +int x86_64_function_has_prologue (CORE_ADDR pc); void x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); diff --git a/gdb/xmodem.h b/gdb/xmodem.h index 86c5008..83aa24f 100644 --- a/gdb/xmodem.h +++ b/gdb/xmodem.h @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +struct serial; + int xmodem_init_xfer (struct serial *desc); void send_xmodem_packet (struct serial *desc, unsigned char *packet, int len, int hashmark); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 2bbd402..2d3b7af 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -354,7 +354,7 @@ xstormy16_pop_frame (void) xstormy16_reg_size)); } /* Restore the PC */ - write_register (PC_REGNUM, FRAME_SAVED_PC (fi)); + write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi)); flush_cached_frames (); } return; @@ -723,11 +723,10 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) actual value of the previous frame's stack register. This function may be called in any context where the saved register - values may be needed (backtrace, frame_info, get_saved_register). - On many targets, it is called directly by init_extra_frame_info, - in part because the information may be needed immediately by - frame_chain. -*/ + values may be needed (backtrace, frame_info, frame_register). On + many targets, it is called directly by init_extra_frame_info, in + part because the information may be needed immediately by + frame_chain. */ static void xstormy16_frame_init_saved_regs (struct frame_info *fi) @@ -749,9 +748,8 @@ xstormy16_frame_init_saved_regs (struct frame_info *fi) /* Function: xstormy16_frame_saved_pc Returns the return address for the selected frame. - Called by frame_info, frame_chain_valid, and sometimes by - get_prev_frame. -*/ + Called by frame_info, legacy_frame_chain_valid, and sometimes by + get_prev_frame. */ static CORE_ADDR xstormy16_frame_saved_pc (struct frame_info *fi) @@ -836,17 +834,16 @@ xstormy16_frame_chain (struct frame_info *fi) static int xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) { - return chain < 0x8000 && FRAME_SAVED_PC (thisframe) >= 0x8000 && + return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 && (get_frame_extra_info (thisframe)->frameless_p || get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain); } -/* Function: xstormy16_saved_pc_after_call - Returns the previous PC immediately after a function call. - This function is meant to bypass the regular get_saved_register - mechanism, ie. it is meant to work even if the frame isn't complete. - Called by step_over_function, and sometimes by get_prev_frame. -*/ +/* Function: xstormy16_saved_pc_after_call Returns the previous PC + immediately after a function call. This function is meant to + bypass the regular frame_register() mechanism, ie. it is meant to + work even if the frame isn't complete. Called by + step_over_function, and sometimes by get_prev_frame. */ static CORE_ADDR xstormy16_saved_pc_after_call (struct frame_info *ignore) @@ -1057,12 +1054,12 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) xstormy16_init_extra_frame_info); set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, xstormy16_frame_init_saved_regs); - set_gdbarch_frame_chain (gdbarch, xstormy16_frame_chain); - set_gdbarch_get_saved_register (gdbarch, xstormy16_get_saved_register); - set_gdbarch_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call); - set_gdbarch_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc); + set_gdbarch_deprecated_frame_chain (gdbarch, xstormy16_frame_chain); + set_gdbarch_deprecated_get_saved_register (gdbarch, xstormy16_get_saved_register); + set_gdbarch_deprecated_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call); + set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc); set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue); - set_gdbarch_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid); + set_gdbarch_deprecated_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid); set_gdbarch_in_function_epilogue_p (gdbarch, xstormy16_in_function_epilogue_p); @@ -1086,28 +1083,20 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) * Call Dummies * * These values and methods are used when gdb calls a target function. */ - set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address); set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value); - set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments); - set_gdbarch_pop_frame (gdbarch, xstormy16_pop_frame); - set_gdbarch_store_struct_return (gdbarch, xstormy16_store_struct_return); + set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments); + set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame); + set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value); set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, xstormy16_use_struct_convention); - set_gdbarch_call_dummy_address (gdbarch, entry_point_address); - set_gdbarch_call_dummy_start_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); - set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); - set_gdbarch_call_dummy_length (gdbarch, 0); - set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_words (gdbarch, call_dummy_words); set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); - set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); - /* set_gdbarch_call_dummy_stack_adjust */ - set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc); + set_gdbarch_char_signed (gdbarch, 0); set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -1117,7 +1106,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address); set_gdbarch_stack_align (gdbarch, xstormy16_stack_align); - set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); set_gdbarch_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos); @@ -1126,6 +1114,9 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_in_solib_call_trampoline (gdbarch, xstormy16_in_solib_call_trampoline); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/include/ChangeLog b/include/ChangeLog index c98e61e..37bf713 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,34 @@ +2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com> + + * coff/tic4x.h: Namespace cleanup. Replace s/c4x/tic4x + and s/c3x/tic3x/ + * coff/tc-tic4x.h: Ditto + * opcode/tic4x.h: Ditto + +2003-04-02 Bob Wilson <bob.wilson@acm.org> + + * xtensa-config.h: Remove comment indicating that this is a + generated file. + +2003-04-01 Bob Wilson <bob.wilson@acm.org> + + * dis-asm.h (print_insn_xtensa): Declare. + * xtensa-config.h: New file. + * xtensa-isa-internal.h: Likewise. + * xtensa-isa.h: Likewise. + +2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * ansidecl.h (ATTRIBUTE_NONNULL, ATTRIBUTE_NULL_PRINTF, + ATTRIBUTE_NULL_PRINTF_1, ATTRIBUTE_NULL_PRINTF_2, + ATTRIBUTE_NULL_PRINTF_3, ATTRIBUTE_NULL_PRINTF_4, + ATTRIBUTE_NULL_PRINTF_5): New. + (ATTRIBUTE_PRINTF): Add ATTRIBUTE_NONNULL. + +2003-03-17 Jan Hubicka <jh@suse.cz> + + * hashtab.h (htab_traverse_noresize): Declare. + 2003-02-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * libiberty.h: Document return value of physmem routines. diff --git a/include/ansidecl.h b/include/ansidecl.h index d169b4f..f8f2d73 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -268,8 +268,21 @@ So instead we use the macro below and test it against specific values. */ #define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) #endif /* ATTRIBUTE_NORETURN */ +/* Attribute `nonnull' was valid as of gcc 3.3. */ +#ifndef ATTRIBUTE_NONNULL +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) +# else +# define ATTRIBUTE_NONNULL(m) +# endif /* GNUC >= 3.3 */ +#endif /* ATTRIBUTE_NONNULL */ + +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL. + This was the case for the `printf' format attribute by itself + before GCC 3.3, but as of 3.3 we need to add the `nonnull' + attribute to retain this behavior. */ #ifndef ATTRIBUTE_PRINTF -#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) #define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) #define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) #define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) @@ -277,6 +290,21 @@ So instead we use the macro below and test it against specific values. */ #define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) #endif /* ATTRIBUTE_PRINTF */ +/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A + NULL format specifier was allowed as of gcc 3.3. */ +#ifndef ATTRIBUTE_NULL_PRINTF +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# else +# define ATTRIBUTE_NULL_PRINTF(m, n) +# endif /* GNUC >= 3.3 */ +# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2) +# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3) +# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4) +# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5) +# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6) +#endif /* ATTRIBUTE_NULL_PRINTF */ + /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ diff --git a/include/aout/ChangeLog b/include/aout/ChangeLog index d215c59..0d054ea 100644 --- a/include/aout/ChangeLog +++ b/include/aout/ChangeLog @@ -1,3 +1,7 @@ +2003-03-06 Elias Athanasopoulos <elathan@phys.uoa.gr> + + * aout64.h (BYTES_IN_WORD): Define if necessary. + 2001-09-18 Alan Modra <amodra@bigpond.net.au> * aout64.h: Formatting fixes. @@ -6,7 +10,7 @@ * hp300hpux.h: Formatting fixes. (N_DATADDR): Avoid negative unsigned warning. -Mon Apr 3 13:29:08 2000 Hans-Peter Nilsson <hp@axis.com> +2000-04-03 Hans-Peter Nilsson <hp@axis.com> * aout64.h (RELOC_EXT_BITS_EXTERN_BIG): Wrap definition in #ifndef. (RELOC_EXT_BITS_EXTERN_LITTLE): Ditto. @@ -20,97 +24,97 @@ Mon Apr 3 13:29:08 2000 Hans-Peter Nilsson <hp@axis.com> * aout64.h (N_SHARED_LIB): Define as 0 if TEXT_START_ADDR is defined as 0. -Sun Jun 28 11:33:48 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> +1998-06-28 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> * stab.def: Add N_ALIAS from SunPro F77. -Mon Mar 11 12:15:52 1996 Ian Lance Taylor <ian@cygnus.com> +1996-03-11 Ian Lance Taylor <ian@cygnus.com> * stab.def: Use __define_stab_duplicate rather than __define_stab for duplicate entries N_BROWS and N_MOD2. * stab_gnu.h (__define_stab_duplicate): Define before including stab.def. -Fri Oct 27 17:47:16 1995 Niklas Hallqvist <niklas@appli.se> +1995-10-27 Niklas Hallqvist <niklas@appli.se> * aout64.h, host.h, hp300hpux.h, sun4.h: Changed PAGE_SIZE to TARGET_PAGE_SIZE. -Tue Sep 12 12:07:02 1995 Ian Lance Taylor <ian@cygnus.com> +1995-09-12 Ian Lance Taylor <ian@cygnus.com> * sun4.h (struct internal_sun4_dynamic_link): Change all fields from long to unsigned long. -Wed Jul 12 00:15:13 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com> +1995-07-12 Ken Raeburn <raeburn@kr-pc.cygnus.com> * sun4.h (PAGE_SIZE): Undefine before defining. -Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) +1994-09-04 Richard Earnshaw (rwe@pegasus.esprit.ec.org) * aout64.h: Only define QMAGIC if it isn't already defined. -Thu Jun 16 14:22:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) +1994-06-16 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * aout64.h (BMAGIC): Define. -Sat Jun 11 16:16:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) +1994-06-11 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Add weak symbols as an extension to a.out. * aout64.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB): Define. * stab.def: Update symbol value table. -Thu Jun 2 17:13:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) +1994-06-02 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * sun4.h (EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE): Correct from 28 to 24. Fix up ld_got comment. -Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) +1994-03-30 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * dynix3.h: Cleanup, adapt to current bfd version. -Sat Feb 26 10:25:53 1994 Ian Lance Taylor (ian@cygnus.com) +1994-02-26 Ian Lance Taylor (ian@cygnus.com) * aout64.h: Add casts to avoid warnings from SVR4 cc. -Fri Feb 11 12:56:04 1994 Stan Shebs (shebs@andros.cygnus.com) +1994-02-11 Stan Shebs (shebs@andros.cygnus.com) * ar.h (ARMAG, ARMAGB, ARFMAG): Change '\n' to '\012', for greater portability. -Fri Jan 21 00:59:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) +1994-01-21 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * sun4.h: Added information about SunOS shared libraries. -Fri Jan 7 08:20:13 1994 Jim Kingdon (kingdon@deneb.cygnus.com) +1994-01-07 Jim Kingdon (kingdon@deneb.cygnus.com) * aout64.h (N_TXTADDR): Add comment regarding OMAGIC and NMAGIC. -Sat Dec 25 14:55:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) +1993-12-25 Jim Kingdon (kingdon@lioth.cygnus.com) * aout64.h (N_DATOFF): Don't pad (revert change of 8 Jul 1993). -Tue Nov 16 15:43:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) +1993-11-16 Jim Kingdon (kingdon@lioth.cygnus.com) * aout64.h: New macros ZMAGIC_DISK_BLOCK_SIZE and N_DISK_BLOCK_SIZE for Linux ZMAGIC. (N_TXTOFF, N_DATOFF): Use them. -Thu Nov 4 00:33:48 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) +1993-11-04 Ken Raeburn (raeburn@kr-pc.cygnus.com) * aout64.h (RELOC_STD_BITS_RELATIVE_LITTLE): Fixed value to match sun3 system; used to overlap other fields. (RELOC_STD_BITS_JMPTABLE_LITTLE): Likewise. -Wed Nov 3 13:48:27 1993 David J. Mackenzie (djm@thepub.cygnus.com) +1993-11-03 David J. Mackenzie (djm@thepub.cygnus.com) * aout64.h (RELOC_STD_BITS_BASEREL_LITTLE): Make it 0x10 (Ken's suggestion) to avoid conflict with RELOC_STD_BITS_EXTERN_LITTLE. -Fri Oct 29 15:09:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) +1993-10-29 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * hp300hpux.h (N_SHARED_LIB): Define to be 0. -Mon Sep 13 21:00:56 1993 John Gilmore (gnu@cygnus.com) +1993-09-13 John Gilmore (gnu@cygnus.com) * ar.h (ARMAP_TIME_OFFSET): Add and describe. @@ -118,30 +122,30 @@ Mon Aug 23 Sean Fagan (sef@cygnus.com) * aout64.h [ARCH_SIZE != 64]: Allow N_BADMAG to be overridden. -Mon Aug 16 14:30:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) +1993-08-16 Jim Kingdon (kingdon@lioth.cygnus.com) * stab_gnu.h: Include aout/stab.def not just stab.def. -Sun Jul 18 21:41:47 1993 Jim Kingdon (kingdon@rtl.cygnus.com) +1993-07-18 Jim Kingdon (kingdon@rtl.cygnus.com) * dynix3.h: New, for symmetry running dynix. -Thu Jul 8 12:52:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) +1993-07-08 Jim Kingdon (kingdon@lioth.cygnus.com) * aout64.h (N_BADMAG): Recognize QMAGIC. N_TXTOFF, N_TXTADDR, N_TXTSIZE: Special code for QMAGIC. N_DATOFF: Pad text size if we need to. -Fri Jun 18 19:19:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) +1993-06-18 Jim Kingdon (kingdon@lioth.cygnus.com) * stab.def (N_ECOML): Fix comment. -Mon May 31 09:21:30 1993 Jim Kingdon (kingdon@cygnus.com) +1993-05-31 Jim Kingdon (kingdon@cygnus.com) * stab.def: Remove Solaris information on N_FUN stabstring grammar; I've transferred it to gdb/doc/stabs.texinfo, where it belongs. -Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) +1993-05-10 Ken Raeburn (raeburn@kr-pc.cygnus.com) * hp300hpux.h: Patch from Glenn Engel for linker problem and compatibility fix: @@ -151,11 +155,11 @@ Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) (_N_BADMAG): Adjusted. (N_HEADER_IN_TEXT, N_DATADDR): New macros. -Thu Apr 29 12:07:37 1993 Ken Raeburn (raeburn@deneb.cygnus.com) +1993-04-29 Ken Raeburn (raeburn@deneb.cygnus.com) * hp300hpux.h: New file from Glenn Engel, glenne@lsid.hp.com. -Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) +1993-04-27 Ken Raeburn (raeburn@kr-pc.cygnus.com) * aout64.h (struct external_exec, *MAGIC, N_BADMAG): Don't define if `external_exec' is already defined as a macro. @@ -164,35 +168,35 @@ Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) (struct external_nlist, EXTERNAL_NLIST_SIZE): Don't define if `external_nlist' is already defined as a macro. -Sat Aug 15 04:23:02 1992 John Gilmore (gnu@cygnus.com) +1992-08-15 John Gilmore (gnu@cygnus.com) * adobe.h: Add description of a.out.adobe format. -Fri Jul 3 00:36:52 1992 John Gilmore (gnu at cygnus.com) +1992-07-03 John Gilmore (gnu at cygnus.com) * stab.def: Update more Solaris definitions. * stab_gnu.h: Add N_SO language types, and Solaris basic float types. -Sun Jun 14 10:53:53 1992 John Gilmore (gnu at cygnus.com) +1992-06-14 John Gilmore (gnu at cygnus.com) * stab.def: Update descriptions of Solaris-2 stabs; add N_UNDF. -Thu Jun 11 01:12:07 1992 John Gilmore (gnu at cygnus.com) +1992-06-11 John Gilmore (gnu at cygnus.com) * stab.def: Add N_OBJ and N_OPT from Solaris-2. -Thu Jan 30 18:12:44 1992 John Gilmore (gnu at cygnus.com) +1992-01-30 John Gilmore (gnu at cygnus.com) * aout64.h: N_TXTSIZE needs some more parentheses. I don't trust C precedence. -Wed Dec 18 14:32:01 1991 Per Bothner (bothner at cygnus.com) +1991-12-18 Per Bothner (bothner at cygnus.com) * aout64.h: Move common sunos-specific test to recognize shared libraries into new macro N_SHARED_LIB. Use it to simplify & reformat N_TXTADDR, N_TXTOFF, N_TXTSIZE. -Sat Nov 30 20:34:52 1991 Steve Chamberlain (sac at rtl.cygnus.com) +1991-11-30 Steve Chamberlain (sac at rtl.cygnus.com) * aout64.h, ar.h, encap.h, host.h, hp.h, ranlib.h, reloc.h, stab.def, stab_gnu.h, sun4.h: All moved from the devo/include diff --git a/include/aout/aout64.h b/include/aout/aout64.h index bc96d2a..4843410 100644 --- a/include/aout/aout64.h +++ b/include/aout/aout64.h @@ -1,6 +1,6 @@ /* `a.out' object-file definitions, including extensions to 64-bit fields - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 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 @@ -19,27 +19,31 @@ #ifndef __A_OUT_64_H__ #define __A_OUT_64_H__ -/* This is the layout on disk of the 32-bit or 64-bit exec header. */ +#ifndef BYTES_IN_WORD +#define BYTES_IN_WORD 4 +#endif + +/* This is the layout on disk of the 32-bit or 64-bit exec header. */ #ifndef external_exec struct external_exec { - bfd_byte e_info[4]; /* magic number and stuff */ - bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */ - bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */ - bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */ - bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */ - bfd_byte e_entry[BYTES_IN_WORD]; /* start address */ - bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */ - bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */ + bfd_byte e_info[4]; /* Magic number and stuff. */ + bfd_byte e_text[BYTES_IN_WORD]; /* Length of text section in bytes. */ + bfd_byte e_data[BYTES_IN_WORD]; /* Length of data section in bytes. */ + bfd_byte e_bss[BYTES_IN_WORD]; /* Length of bss area in bytes. */ + bfd_byte e_syms[BYTES_IN_WORD]; /* Length of symbol table in bytes. */ + bfd_byte e_entry[BYTES_IN_WORD]; /* Start address. */ + bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info. */ + bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info. */ }; #define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) -/* Magic numbers for a.out files */ +/* Magic numbers for a.out files. */ #if ARCH_SIZE==64 -#define OMAGIC 0x1001 /* Code indicating object file */ +#define OMAGIC 0x1001 /* Code indicating object file. */ #define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */ #define NMAGIC 0x1003 /* Code indicating pure executable. */ @@ -49,7 +53,7 @@ struct external_exec && N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != ZMAGIC) #else -#define OMAGIC 0407 /* ...object file or impure executable. */ +#define OMAGIC 0407 /* Object file or impure executable. */ #define NMAGIC 0410 /* Code indicating pure executable. */ #define ZMAGIC 0413 /* Code indicating demand-paged executable. */ #define BMAGIC 0415 /* Used by a b.out object. */ @@ -125,8 +129,7 @@ struct external_exec * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true, and for which the starting address is TARGET_PAGE_SIZE (or should this be - SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). - */ + SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). */ /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header in the text. */ @@ -152,12 +155,12 @@ struct external_exec #ifndef N_TXTADDR #define N_TXTADDR(x) \ - (/* The address of a QMAGIC file is always one page in, */ \ - /* with the header in the text. */ \ + (/* The address of a QMAGIC file is always one page in, \ + with the header in the text. */ \ N_IS_QMAGIC (x) \ ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE \ : (N_MAGIC (x) != ZMAGIC \ - ? (bfd_vma) 0 /* object file or NMAGIC */ \ + ? (bfd_vma) 0 /* Object file or NMAGIC. */ \ : (N_SHARED_LIB (x) \ ? (bfd_vma) 0 \ : (N_HEADER_IN_TEXT (x) \ @@ -187,8 +190,8 @@ struct external_exec : (N_SHARED_LIB (x) \ ? 0 \ : (N_HEADER_IN_TEXT (x) \ - ? EXEC_BYTES_SIZE /* no padding */ \ - : ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */))) + ? EXEC_BYTES_SIZE /* No padding. */ \ + : ZMAGIC_DISK_BLOCK_SIZE /* A page of padding. */))) #endif /* Size of the text section. It's always as stated, except that we offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF @@ -203,12 +206,12 @@ struct external_exec : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ ? (x).a_text \ : (N_HEADER_IN_TEXT (x) \ - ? (x).a_text - EXEC_BYTES_SIZE /* no padding */ \ - : (x).a_text /* a page of padding */ ))) + ? (x).a_text - EXEC_BYTES_SIZE /* No padding. */ \ + : (x).a_text /* A page of padding. */ ))) #endif /* The address of the data segment in virtual memory. It is the text segment address, plus text segment size, rounded - up to a N_SEGSIZE boundary for pure or pageable files. */ + up to a N_SEGSIZE boundary for pure or pageable files. */ #ifndef N_DATADDR #define N_DATADDR(x) \ (N_MAGIC (x) == OMAGIC \ @@ -235,57 +238,59 @@ struct external_exec for NMAGIC. */ #ifndef N_DATOFF -#define N_DATOFF(x) ( N_TXTOFF (x) + N_TXTSIZE (x) ) +#define N_DATOFF(x) (N_TXTOFF (x) + N_TXTSIZE (x)) #endif #ifndef N_TRELOFF -#define N_TRELOFF(x) ( N_DATOFF (x) + (x).a_data ) +#define N_TRELOFF(x) (N_DATOFF (x) + (x).a_data) #endif #ifndef N_DRELOFF -#define N_DRELOFF(x) ( N_TRELOFF (x) + (x).a_trsize ) +#define N_DRELOFF(x) (N_TRELOFF (x) + (x).a_trsize) #endif #ifndef N_SYMOFF -#define N_SYMOFF(x) ( N_DRELOFF (x) + (x).a_drsize ) +#define N_SYMOFF(x) (N_DRELOFF (x) + (x).a_drsize) #endif #ifndef N_STROFF -#define N_STROFF(x) ( N_SYMOFF (x) + (x).a_syms ) +#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) #endif /* Symbols */ #ifndef external_nlist -struct external_nlist { - bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ - bfd_byte e_type[1]; /* type of symbol */ - bfd_byte e_other[1]; /* misc info (usually empty) */ - bfd_byte e_desc[2]; /* description field */ - bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ +struct external_nlist +{ + bfd_byte e_strx[BYTES_IN_WORD]; /* Index into string table of name. */ + bfd_byte e_type[1]; /* Type of symbol. */ + bfd_byte e_other[1]; /* Misc info (usually empty). */ + bfd_byte e_desc[2]; /* Description field. */ + bfd_byte e_value[BYTES_IN_WORD]; /* Value of symbol. */ }; #define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) #endif -struct internal_nlist { - unsigned long n_strx; /* index into string table of name */ - unsigned char n_type; /* type of symbol */ - unsigned char n_other; /* misc info (usually empty) */ - unsigned short n_desc; /* description field */ - bfd_vma n_value; /* value of symbol */ +struct internal_nlist +{ + unsigned long n_strx; /* Index into string table of name. */ + unsigned char n_type; /* Type of symbol. */ + unsigned char n_other; /* Misc info (usually empty). */ + unsigned short n_desc; /* Description field. */ + bfd_vma n_value; /* Value of symbol. */ }; /* The n_type field is the symbol type, containing: */ -#define N_UNDF 0 /* Undefined symbol */ -#define N_ABS 2 /* Absolute symbol -- defined at particular addr */ -#define N_TEXT 4 /* Text sym -- defined at offset in text seg */ -#define N_DATA 6 /* Data sym -- defined at offset in data seg */ -#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ -#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ -#define N_FN 0x1f /* File name of .o file */ -#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ +#define N_UNDF 0 /* Undefined symbol. */ +#define N_ABS 2 /* Absolute symbol -- defined at particular addr. */ +#define N_TEXT 4 /* Text sym -- defined at offset in text seg. */ +#define N_DATA 6 /* Data sym -- defined at offset in data seg. */ +#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg. */ +#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink). */ +#define N_FN 0x1f /* File name of .o file. */ +#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh). */ /* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, N_DATA, or N_BSS. When the low-order bit of other types is set, (e.g. N_WARNING versus N_FN), they are two different types. */ -#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ +#define N_EXT 1 /* External symbol (as opposed to local-to-this-file). */ #define N_TYPE 0x1e -#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */ +#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol. */ #define N_INDR 0x0a @@ -301,10 +306,10 @@ struct internal_nlist { in that it can satisfy undefined external references. */ /* These appear as input to LD, in a .o file. */ -#define N_SETA 0x14 /* Absolute set element symbol */ -#define N_SETT 0x16 /* Text set element symbol */ -#define N_SETD 0x18 /* Data set element symbol */ -#define N_SETB 0x1A /* Bss set element symbol */ +#define N_SETA 0x14 /* Absolute set element symbol. */ +#define N_SETT 0x16 /* Text set element symbol. */ +#define N_SETD 0x18 /* Data set element symbol. */ +#define N_SETB 0x1A /* Bss set element symbol. */ /* This is output from LD. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */ @@ -335,18 +340,18 @@ struct internal_nlist { instructions. Eg, on the 68k, each move instruction can reference the target with a displacement of 16 or 32 bits. On the sparc, move instructions use an offset of 14 bits, so the offset is stored in - the reloc field, and the data in the section is ignored. -*/ + the reloc field, and the data in the section is ignored. */ /* This structure describes a single relocation to be performed. The text-relocation section of the file is a vector of these structures, all of which apply to the text section. Likewise, the data-relocation section applies to the data section. */ -struct reloc_std_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ +struct reloc_std_external +{ + bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */ + bfd_byte r_index[3]; /* Symbol table index of symbol. */ + bfd_byte r_type[1]; /* Relocation type. */ }; #define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80) @@ -369,7 +374,7 @@ struct reloc_std_external { #define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02) #define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40) -#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */ +#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry. */ struct reloc_std_internal { @@ -392,21 +397,22 @@ struct reloc_std_internal unsigned int r_extern:1; /* The next three bits are for SunOS shared libraries, and seem to be undocumented. */ - unsigned int r_baserel:1; /* Linkage table relative */ - unsigned int r_jmptable:1; /* pc-relative to jump table */ - unsigned int r_relative:1; /* "relative relocation" */ + unsigned int r_baserel:1; /* Linkage table relative. */ + unsigned int r_jmptable:1; /* pc-relative to jump table. */ + unsigned int r_relative:1; /* "relative relocation". */ /* unused */ - unsigned int r_pad:1; /* Padding -- set to zero */ + unsigned int r_pad:1; /* Padding -- set to zero. */ }; -/* EXTENDED RELOCS */ +/* EXTENDED RELOCS. */ -struct reloc_ext_external { - bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ - bfd_byte r_index[3]; /* symbol table index of symbol */ - bfd_byte r_type[1]; /* relocation type */ - bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ +struct reloc_ext_external +{ + bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */ + bfd_byte r_index[3]; /* Symbol table index of symbol. */ + bfd_byte r_type[1]; /* Relocation type. */ + bfd_byte r_addend[BYTES_IN_WORD]; /* Datum addend. */ }; #ifndef RELOC_EXT_BITS_EXTERN_BIG @@ -433,20 +439,20 @@ struct reloc_ext_external { #define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 #endif -/* Bytes per relocation entry */ +/* Bytes per relocation entry. */ #define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) enum reloc_type { - /* simple relocations */ + /* Simple relocations. */ RELOC_8, /* data[0:7] = addend + sv */ RELOC_16, /* data[0:15] = addend + sv */ RELOC_32, /* data[0:31] = addend + sv */ - /* pc-rel displacement */ + /* PC-rel displacement. */ RELOC_DISP8, /* data[0:7] = addend - pc + sv */ RELOC_DISP16, /* data[0:15] = addend - pc + sv */ RELOC_DISP32, /* data[0:31] = addend - pc + sv */ - /* Special */ + /* Special. */ RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */ @@ -455,16 +461,16 @@ enum reloc_type RELOC_LO10, /* data[0:9] = (addend + sv) */ RELOC_SFA_BASE, RELOC_SFA_OFF13, - /* P.I.C. (base-relative) */ + /* P.I.C. (base-relative). */ RELOC_BASE10, /* Not sure - maybe we can do this the */ RELOC_BASE13, /* right way now */ RELOC_BASE22, - /* for some sort of pc-rel P.I.C. (?) */ + /* For some sort of pc-rel P.I.C. (?) */ RELOC_PC10, RELOC_PC22, - /* P.I.C. jump table */ + /* P.I.C. jump table. */ RELOC_JMP_TBL, - /* reputedly for shared libraries somehow */ + /* Reputedly for shared libraries somehow. */ RELOC_SEGOFF16, RELOC_GLOB_DAT, RELOC_JMP_SLOT, @@ -476,13 +482,12 @@ enum reloc_type RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */ RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ - /* 29K relocation types */ + /* 29K relocation types. */ RELOC_JUMPTARG, RELOC_CONST, RELOC_CONSTH, - /* All the new ones I can think of, for sparc v9 */ - + /* All the new ones I can think of, for sparc v9. */ RELOC_64, /* data[0:63] = addend + sv */ RELOC_DISP64, /* data[0:63] = addend - pc + sv */ RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */ @@ -492,25 +497,23 @@ enum reloc_type What are the other ones, Since this is a clean slate, can we throw away the ones we dont understand ? Should we sort the values ? What about using a - microcode format like the 68k ? - */ + microcode format like the 68k ? */ NO_RELOC }; -struct reloc_internal { - bfd_vma r_address; /* offset of of data to relocate */ - long r_index; /* symbol table index of symbol */ - enum reloc_type r_type; /* relocation type */ - bfd_vma r_addend; /* datum addend */ +struct reloc_internal +{ + bfd_vma r_address; /* Offset of of data to relocate. */ + long r_index; /* Symbol table index of symbol. */ + enum reloc_type r_type; /* Relocation type. */ + bfd_vma r_addend; /* Datum addend. */ }; /* Q. Should the length of the string table be 4 bytes or 8 bytes ? Q. - What about archive indexes ? - - */ + What about archive indexes ? */ #endif /* __A_OUT_64_H__ */ diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index b2eec4c..353eb59 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,16 @@ +2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> + + * sh.h: Replace occurrances of 'Hitachi' with 'Renesas'. + * h8300.h: Likewise. + * h8500.h: Likewise. + +2003-03-25 Stan Cox <scox@redhat.com> + Nick Clifton <nickc@redhat.com> + + Contribute support for Intel's iWMMXt chip - an ARM variant: + + * arm.h (ARM_NOTE_SECTION): Define. + 2002-11-30 Alan Modra <amodra@bigpond.net.au> * ecoff.h: Replace boolean with bfd_boolean. diff --git a/include/coff/arm.h b/include/coff/arm.h index bcfdcbe..8b90228 100644 --- a/include/coff/arm.h +++ b/include/coff/arm.h @@ -124,3 +124,5 @@ struct external_reloc #define RELOC struct external_reloc #define RELSZ 14 #endif + +#define ARM_NOTE_SECTION ".note" diff --git a/include/coff/h8300.h b/include/coff/h8300.h index 3ed5aef..c30dc00 100644 --- a/include/coff/h8300.h +++ b/include/coff/h8300.h @@ -1,6 +1,6 @@ -/* coff information for Hitachi H8/300 and H8/300-H +/* coff information for Renesas H8/300 and H8/300-H - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 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 diff --git a/include/coff/h8500.h b/include/coff/h8500.h index 87e5754..62968ca 100644 --- a/include/coff/h8500.h +++ b/include/coff/h8500.h @@ -1,6 +1,6 @@ -/* coff information for Hitachi H8/500 +/* coff information for Renesas H8/500 - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 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 diff --git a/include/coff/sh.h b/include/coff/sh.h index c77316e..d20834c 100644 --- a/include/coff/sh.h +++ b/include/coff/sh.h @@ -1,6 +1,6 @@ -/* coff information for Hitachi SH +/* coff information for Renesas SH - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 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 diff --git a/include/coff/tic4x.h b/include/coff/tic4x.h index 083cc3b..0d224b2 100644 --- a/include/coff/tic4x.h +++ b/include/coff/tic4x.h @@ -1,7 +1,7 @@ /* TI COFF information for Texas Instruments TMS320C4X/C3X. This file customizes the settings in coff/ti.h. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,12 +31,12 @@ #define TICOFF_DEFAULT_MAGIC TICOFF2MAGIC #define TICOFF_TARGET_MACHINE_GET(FLAGS) \ - (((FLAGS) & F_VERS) ? bfd_mach_c4x : bfd_mach_c3x) + (((FLAGS) & F_VERS) ? bfd_mach_tic4x : bfd_mach_tic3x) #define TICOFF_TARGET_MACHINE_SET(FLAGSP, MACHINE) \ do \ { \ - if ((MACHINE) == bfd_mach_c4x) \ + if ((MACHINE) == bfd_mach_tic4x) \ *(FLAGSP) |= F_VERS; \ } \ while (0) diff --git a/include/dis-asm.h b/include/dis-asm.h index 5e6bdc3..392cbf9 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -237,6 +237,7 @@ extern int print_insn_v850 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_xtensa PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *)); extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *)); extern int print_insn_frv PARAMS ((bfd_vma, disassemble_info *)); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index e87cdd2..b84eac5 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,4 +1,24 @@ -Mon Mar 3 20:35:58 2003 J"orn Rennecke <joern.rennecke@superh.com> +2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> + + * common.h: Replace occurrances of 'Hitachi' with 'Renesas'. + +2003-04-01 Bob Wilson <bob.wilson@acm.org> + + * elf/common.h (EM_XTENSA_OLD): Define. + * elf/xtensa.h: New file. + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * arm.h (ARM_NOTE_SECTION): Include .gnu in the string. + +2003-03-25 Stan Cox <scox@redhat.com> + Nick Clifton <nickc@redhat.com> + + Contribute support for Intel's iWMMXt chip - an ARM variant: + + * arm.h (ARM_NOTE_SECTION): Define. + +2003-03-03 J"orn Rennecke <joern.rennecke@superh.com> * sh.h (EF_SH_MERGE_MACH): Make sure SH2E & SH3/SH3E merge to SH3E, and SH2E & SH4 merge to SH4, not SH2E. diff --git a/include/elf/arm.h b/include/elf/arm.h index 5347017..181a9f0 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -140,4 +140,7 @@ START_RELOC_NUMBERS (elf_arm_reloc_type) RELOC_NUMBER (R_ARM_RBASE, 255) END_RELOC_NUMBERS (R_ARM_max) +/* The name of the note section used to identify arm variants. */ +#define ARM_NOTE_SECTION ".note.gnu.arm.ident" + #endif /* _ELF_ARM_H */ diff --git a/include/elf/common.h b/include/elf/common.h index 2315fa8..02665b7 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -7,32 +7,32 @@ in "UNIX System V Release 4, Programmers Guide: ANSI C and Programming Support Tools". -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file is part of ELF support for BFD, and contains the portions that are common to both the internal and external representations. For example, ELFMAG0 is the byte 0x7F in both the internal (in-memory) - and external (in-file) representations. */ + and external (in-file) representations. */ #ifndef _ELF_COMMON_H #define _ELF_COMMON_H -/* Fields in e_ident[] */ +/* Fields in e_ident[]. */ #define EI_MAG0 0 /* File identification byte 0 index */ #define ELFMAG0 0x7F /* Magic number byte 0 */ @@ -126,14 +126,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define EM_RCE 39 /* Old name for MCore */ #define EM_ARM 40 /* ARM */ #define EM_OLD_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ +#define EM_SH 42 /* Renesas (formerly Hitachi) SH */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_TRICORE 44 /* Siemens Tricore embedded processor */ #define EM_ARC 45 /* ARC Cores */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_H8_300 46 /* Renesas (formerly Hitachi) H8/300 */ +#define EM_H8_300H 47 /* Renesas (formerly Hitachi) H8/300H */ +#define EM_H8S 48 /* Renesas (formerly Hitachi) H8S */ +#define EM_H8_500 49 /* Renesas (formerly Hitachi) H8/500 */ #define EM_IA_64 50 /* Intel IA-64 Processor */ #define EM_MIPS_X 51 /* Stanford MIPS-X */ #define EM_COLDFIRE 52 /* Motorola Coldfire */ @@ -261,6 +261,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Vitesse IQ2000. */ #define EM_IQ2000 0xFEBA + +/* Old, unofficial value for Xtensa. */ +#define EM_XTENSA_OLD 0xabc7 + /* See the above comment before you add a new EM_* value here. */ /* Values for e_version. */ diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index f60f7b1..9a216a0 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-03-27 Nick Clifton <nickc@redhat.com> + + * sim-arm.h (sim_arm_regs): Add iWMMXt registers. + +2003-03-20 Nick Clifton <nickc@redhat.com> + + * sim-arm.h (sim_arm_regs): Add Maverick co-processor + registers. + 2003-02-27 Andrew Cagney <cagney@redhat.com> * remote-sim.h (sim_open, sim_load, sim_create_inferior): Rename diff --git a/include/gdb/sim-arm.h b/include/gdb/sim-arm.h index 6d80700..5598f73 100644 --- a/include/gdb/sim-arm.h +++ b/include/gdb/sim-arm.h @@ -1,6 +1,6 @@ /* This file defines the interface between the Arm simulator and GDB. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by Red Hat. @@ -55,7 +55,56 @@ enum sim_arm_regs SIM_ARM_FP6_REGNUM, SIM_ARM_FP7_REGNUM, SIM_ARM_FPS_REGNUM, - SIM_ARM_PS_REGNUM + SIM_ARM_PS_REGNUM, + SIM_ARM_MAVERIC_COP0R0_REGNUM, + SIM_ARM_MAVERIC_COP0R1_REGNUM, + SIM_ARM_MAVERIC_COP0R2_REGNUM, + SIM_ARM_MAVERIC_COP0R3_REGNUM, + SIM_ARM_MAVERIC_COP0R4_REGNUM, + SIM_ARM_MAVERIC_COP0R5_REGNUM, + SIM_ARM_MAVERIC_COP0R6_REGNUM, + SIM_ARM_MAVERIC_COP0R7_REGNUM, + SIM_ARM_MAVERIC_COP0R8_REGNUM, + SIM_ARM_MAVERIC_COP0R9_REGNUM, + SIM_ARM_MAVERIC_COP0R10_REGNUM, + SIM_ARM_MAVERIC_COP0R11_REGNUM, + SIM_ARM_MAVERIC_COP0R12_REGNUM, + SIM_ARM_MAVERIC_COP0R13_REGNUM, + SIM_ARM_MAVERIC_COP0R14_REGNUM, + SIM_ARM_MAVERIC_COP0R15_REGNUM, + SIM_ARM_MAVERIC_DSPSC_REGNUM, + SIM_ARM_IWMMXT_COP0R0_REGNUM, + SIM_ARM_IWMMXT_COP0R1_REGNUM, + SIM_ARM_IWMMXT_COP0R2_REGNUM, + SIM_ARM_IWMMXT_COP0R3_REGNUM, + SIM_ARM_IWMMXT_COP0R4_REGNUM, + SIM_ARM_IWMMXT_COP0R5_REGNUM, + SIM_ARM_IWMMXT_COP0R6_REGNUM, + SIM_ARM_IWMMXT_COP0R7_REGNUM, + SIM_ARM_IWMMXT_COP0R8_REGNUM, + SIM_ARM_IWMMXT_COP0R9_REGNUM, + SIM_ARM_IWMMXT_COP0R10_REGNUM, + SIM_ARM_IWMMXT_COP0R11_REGNUM, + SIM_ARM_IWMMXT_COP0R12_REGNUM, + SIM_ARM_IWMMXT_COP0R13_REGNUM, + SIM_ARM_IWMMXT_COP0R14_REGNUM, + SIM_ARM_IWMMXT_COP0R15_REGNUM, + SIM_ARM_IWMMXT_COP1R0_REGNUM, + SIM_ARM_IWMMXT_COP1R1_REGNUM, + SIM_ARM_IWMMXT_COP1R2_REGNUM, + SIM_ARM_IWMMXT_COP1R3_REGNUM, + SIM_ARM_IWMMXT_COP1R4_REGNUM, + SIM_ARM_IWMMXT_COP1R5_REGNUM, + SIM_ARM_IWMMXT_COP1R6_REGNUM, + SIM_ARM_IWMMXT_COP1R7_REGNUM, + SIM_ARM_IWMMXT_COP1R8_REGNUM, + SIM_ARM_IWMMXT_COP1R9_REGNUM, + SIM_ARM_IWMMXT_COP1R10_REGNUM, + SIM_ARM_IWMMXT_COP1R11_REGNUM, + SIM_ARM_IWMMXT_COP1R12_REGNUM, + SIM_ARM_IWMMXT_COP1R13_REGNUM, + SIM_ARM_IWMMXT_COP1R14_REGNUM, + SIM_ARM_IWMMXT_COP1R15_REGNUM }; #ifdef __cplusplus diff --git a/include/hashtab.h b/include/hashtab.h index 4995a9a..7acb5eb 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -168,6 +168,7 @@ extern void htab_clear_slot PARAMS ((htab_t, void **)); extern void htab_remove_elt PARAMS ((htab_t, void *)); extern void htab_traverse PARAMS ((htab_t, htab_trav, void *)); +extern void htab_traverse_noresize PARAMS ((htab_t, htab_trav, void *)); extern size_t htab_size PARAMS ((htab_t)); extern size_t htab_elements PARAMS ((htab_t)); diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index f04439c..8080909 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,22 @@ +2003-04-07 Michael Snyder <msnyder@redhat.com> + + * h8300.h (ldc/stc): Fix up src/dst swaps. + +2003-04-09 J. Grant <jg-binutils@jguk.org> + + * mips.h: Correct comment typo. + +2003-03-21 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * s390.h (s390_opcode_arch_val): Rename to s390_opcode_mode_val. + (S390_OPCODE_ESAME): Rename to S390_OPCODE_ZARCH. + (s390_opcode): Remove architecture. Add modes and min_cpu. + +2003-03-17 D.Venkatasubramanian <dvenkat@noida.hcltech.com> + + * h8300.h (O_SYS_CMDLINE): New pseudo opcode for command line + processing. + 2003-02-21 Noida D.Venkatasubramanian <dvenkat@noida.hcltech.com> * h8300.h (ldmac, stmac): Replace MACREG with MS32 and MD32. diff --git a/include/opcode/h8300.h b/include/opcode/h8300.h index 034c7bc..02f415b 100644 --- a/include/opcode/h8300.h +++ b/include/opcode/h8300.h @@ -313,6 +313,8 @@ struct h8_opcode #define O_SYS_CLOSE 105 #define O_SYS_STAT 106 #define O_SYS_FSTAT 107 +/* Space reserved for future file I/O system calls. */ +#define O_SYS_CMDLINE 120 /* End of System Call specific Changes. */ #define SB 0 #define SW 1 @@ -434,7 +436,7 @@ const struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,CCR|DST,E}},{{PREFIXLDC,0x6,0xF,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,CCR|DST,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xD,B30|RSINC,0x0,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR|DST,E}}, {{PREFIXLDC,0x6,0x9,B30|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR|DST,E}}, {{PREFIXLDC,0x6,0x9,B30|RSIND,0x0,E}} EOP, NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP, NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,EXR|DST,E}}, {{ 0x0,0x3,0x1,OR8,E,0,0,0,0}}EOP, @@ -443,7 +445,7 @@ const struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x6,0xf,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xd,B30|RSINC,0x0,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RSIND,0x0,E}} EOP, SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{{ABS|SRC|L_16|MEMRELAX,RD8,E}}, {{ 0x6,0xA,0x0,RD8,SRC|ABS|MEMRELAX|A16LIST,E}}EOP, SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{{ABS|SRC|L_32|MEMRELAX,RD8,E }}, {{ 0x6,0xA,0x2,RD8,SRC|ABS|MEMRELAX|A32LIST,E }}EOP, @@ -554,7 +556,7 @@ const struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{CCR|SRC,RD8,E}},{{ 0x0,0x2,0x0,RD8,E,0,0,0,0}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RSIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RDIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_16,E}},{{PREFIXLDC,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_32,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RDDEC,E}}, {{PREFIXLDC,0x6,0xD,B31|RDDEC,0x0,E}}EOP, @@ -564,7 +566,7 @@ const struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{EXR|SRC,RD8,E}},{{ 0x0,0x2,0x1,RD8,E,0,0,0,0}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RSIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RDIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_16,E}},{{0x0,0x1,0x4,0x1,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_32,E}},{{0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RDDEC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xD,B31|RDDEC,0x0,E}}EOP, diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 1f90cfd..476c8e3 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -197,7 +197,7 @@ struct mips_opcode unsigned long membership; }; -/* These are the characters which may appears in the args field of an +/* These are the characters which may appear in the args field of an instruction. They appear in the order in which the fields appear when the instruction is used. Commas and parentheses in the args string are ignored when assembling, and written into the output diff --git a/include/opcode/s390.h b/include/opcode/s390.h index 1a42be6..6e32723 100644 --- a/include/opcode/s390.h +++ b/include/opcode/s390.h @@ -24,10 +24,17 @@ /* List of instruction sets variations. */ -enum s390_opcode_arch_val +enum s390_opcode_mode_val { S390_OPCODE_ESA = 0, - S390_OPCODE_ESAME + S390_OPCODE_ZARCH + }; + +enum s390_opcode_cpu_val + { + S390_OPCODE_G5 = 0, + S390_OPCODE_G6, + S390_OPCODE_Z900 }; /* The opcode table is an array of struct s390_opcode. */ @@ -55,8 +62,11 @@ struct s390_opcode appear in assembly code, and are terminated by a zero. */ unsigned char operands[6]; - /* Bitmask of architectures this opcode is available for. */ - unsigned int architecture; + /* Bitmask of execution modes this opcode is available for. */ + unsigned int modes; + + /* First cpu this opcode is available for. */ + enum s390_opcode_cpu_val min_cpu; }; /* The table itself is sorted by major opcode number, and is otherwise diff --git a/include/opcode/tic4x.h b/include/opcode/tic4x.h index 214965d..0e6af64 100644 --- a/include/opcode/tic4x.h +++ b/include/opcode/tic4x.h @@ -1,6 +1,6 @@ /* Table of opcodes for the Texas Instruments TMS320C[34]X family. - Copyright (c) 2002 Free Software Foundation. + Copyright (C) 2002, 2003 Free Software Foundation. Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define IS_CPU_C3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33) -#define IS_CPU_C4X(v) ((v) == 0 || (v) == 40 || (v) == 44) +#define IS_CPU_TIC3X(v) ((v) == 30 || (v) == 31 || (v) == 32 || (v) == 33) +#define IS_CPU_TIC4X(v) ((v) == 0 || (v) == 40 || (v) == 44) /* Define some bitfield extraction/insertion macros. */ #define EXTR(inst, m, l) ((inst) << (31 - (m)) >> (31 - ((m) - (l)))) @@ -50,22 +50,22 @@ c4x_reg_t; #define REG_IF REG_IIE /* C3x only */ #define REG_IOF REG_IIF /* C3x only */ -#define C3X_REG_MAX REG_RC -#define C4X_REG_MAX REG_TVTP +#define TIC3X_REG_MAX REG_RC +#define TIC4X_REG_MAX REG_TVTP /* Register table size including C4x expansion regs. */ -#define REG_TABLE_SIZE (C4X_REG_MAX + 1) +#define REG_TABLE_SIZE (TIC4X_REG_MAX + 1) -struct c4x_register +struct tic4x_register { char * name; unsigned long regno; }; -typedef struct c4x_register c4x_register_t; +typedef struct tic4x_register tic4x_register_t; /* We could store register synonyms here. */ -static const c4x_register_t c3x_registers[] = +static const tic4x_register_t tic3x_registers[] = { {"f0", REG_R0}, {"r0", REG_R0}, @@ -106,10 +106,10 @@ static const c4x_register_t c3x_registers[] = {"", 0} }; -const unsigned int c3x_num_registers = (((sizeof c3x_registers) / (sizeof c3x_registers[0])) - 1); +const unsigned int tic3x_num_registers = (((sizeof tic3x_registers) / (sizeof tic3x_registers[0])) - 1); /* Define C4x registers in addition to C3x registers. */ -static const c4x_register_t c4x_registers[] = +static const tic4x_register_t tic4x_registers[] = { {"die", REG_DIE}, /* Clobbers C3x REG_IE */ {"iie", REG_IIE}, /* Clobbers C3x REG_IF */ @@ -127,19 +127,19 @@ static const c4x_register_t c4x_registers[] = {"", 0} }; -const unsigned int c4x_num_registers = (((sizeof c4x_registers) / (sizeof c4x_registers[0])) - 1); +const unsigned int tic4x_num_registers = (((sizeof tic4x_registers) / (sizeof tic4x_registers[0])) - 1); -struct c4x_cond +struct tic4x_cond { char * name; unsigned long cond; }; -typedef struct c4x_cond c4x_cond_t; +typedef struct tic4x_cond tic4x_cond_t; /* Define conditional branch/load suffixes. Put desired form for disassembler last. */ -static const c4x_cond_t c4x_conds[] = +static const tic4x_cond_t tic4x_conds[] = { { "u", 0x00 }, { "c", 0x01 }, { "lo", 0x01 }, @@ -167,22 +167,22 @@ static const c4x_cond_t c4x_conds[] = { "", 0x0} }; -const unsigned int num_conds = (((sizeof c4x_conds) / (sizeof c4x_conds[0])) - 1); +const unsigned int tic4x_num_conds = (((sizeof tic4x_conds) / (sizeof tic4x_conds[0])) - 1); -struct c4x_indirect +struct tic4x_indirect { char * name; unsigned long modn; }; -typedef struct c4x_indirect c4x_indirect_t; +typedef struct tic4x_indirect tic4x_indirect_t; /* Define indirect addressing modes where: d displacement (signed) y ir0 z ir1 */ -static const c4x_indirect_t c4x_indirects[] = +static const tic4x_indirect_t tic4x_indirects[] = { { "*+a(d)", 0x00 }, { "*-a(d)", 0x01 }, @@ -216,12 +216,12 @@ static const c4x_indirect_t c4x_indirects[] = { "", 0x0} }; -#define C3X_MODN_MAX 0x19 +#define TIC3X_MODN_MAX 0x19 -const unsigned int c4x_num_indirects = (((sizeof c4x_indirects) / (sizeof c4x_indirects[0])) - 1); +const unsigned int tic4x_num_indirects = (((sizeof tic4x_indirects) / (sizeof tic4x_indirects[0])) - 1); /* Instruction template. */ -struct c4x_inst +struct tic4x_inst { char * name; unsigned long opcode; @@ -230,7 +230,7 @@ struct c4x_inst unsigned long oplevel; }; -typedef struct c4x_inst c4x_inst_t; +typedef struct tic4x_inst tic4x_inst_t; /* Opcode infix B condition 16--20 U,C,Z,LO,HI, etc. @@ -278,8 +278,8 @@ typedef struct c4x_inst c4x_inst_t; Z expansion reg (C4x) 16--20 [Z] - IVTP, TVTP */ -#define C4X_OPERANDS_MAX 7 /* Max number of operands for an inst. */ -#define C4X_NAME_MAX 16 /* Max number of chars in parallel name. */ +#define TIC4X_OPERANDS_MAX 7 /* Max number of operands for an inst. */ +#define TIC4X_NAME_MAX 16 /* Max number of chars in parallel name. */ /* Define the instruction level */ #define OP_C3X 0x1 /* C30 support - supported by all */ @@ -873,8 +873,8 @@ typedef struct c4x_inst c4x_inst_t; */ -/* Define c3x opcodes for assembler and disassembler. */ -static const c4x_inst_t c4x_insts[] = +/* Define tic4x opcodes for assembler and disassembler. */ +static const tic4x_inst_t tic4x_insts[] = { /* Put synonyms after the desired forms in table so that they get overwritten in the lookup table. The disassembler will thus @@ -1070,10 +1070,10 @@ static const c4x_inst_t c4x_insts[] = TC_CLASS_INSN( "xor", 0x08000000, OP_C3X ), QC_CLASS_INSN( "xor", "sti", 0xee000000, OP_C3X ), - /* Dummy entry, not included in c3x_num_insts. This + /* Dummy entry, not included in tic4x_num_insts. This lets code examine entry i + 1 without checking if we've run off the end of the table. */ { "", 0x0, 0x00, "", 0 } }; -const unsigned int c4x_num_insts = (((sizeof c4x_insts) / (sizeof c4x_insts[0])) - 1); +const unsigned int tic4x_num_insts = (((sizeof tic4x_insts) / (sizeof tic4x_insts[0])) - 1); diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index b3e904f..1e290a5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,102 @@ +2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * mempcpy.c, stpcpy.c, stpncpy.c: New files. + * configure.in (funcs, AC_CHECK_FUNCS): Add mempcpy, stpcpy + and stpncpy. + * Makefile.in (CFILES): Add mempcpy.c, stpcpy.c and stpncpy.c. + (CONFIGURED_OFILES): Add mempcpy.o, stpcpy.o and stpncpy.o. + Regenerate dependencies. + + * functions.texi, configure, config.in: Regenerated. + +2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * argv.c: Fix comments. + * calloc.c: Don't unnecessarily include "libiberty.h". + (bzero): Add prototype. + * floatformat.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES. + * getcwd.c (getcwd): Use standard definition to avoid conflicts + with system headers. + * hashtab.c (htab_traverse): Delete unused variables. + * rename.c: Include "ansidecl.h". + (rename): Use standard definition to avoid conflicts with system + headers. + * strsignal.c: Rely on ANSI_PROTOTYPES. + * strstr.c: Check GNUC >= 2, not GNUC == 2. + * vfprintf.c: Include "ansidecl.h", rely on ANSI_PROTOTYPES. + * vprintf.c: Include "ansidecl.h" earlier, rely on + ANSI_PROTOTYPES. + * vsprintf.c: Include "ansidecl.h" earlier, rely on + ANSI_PROTOTYPES and possibly include <stdarg.h>. + + * Makefile.in: Regenerate dependencies. + +2003-04-15 DJ Delorie <dj@redhat.com> + + * maint-tool (deps): Scan for headers in $srcdir also. + +2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + PR target/10338 + PR bootstrap/10198 + PR bootstrap/10140 + * getopt.c (exchange, _getopt_initialize): Use mempcpy not + __mempcpy. + * regex.c (regerror): Likewise. + +2003-04-14 Roger Sayle <roger@eyesopen.com> + + * argv.c: Use ANSI_PROTOTYPES instead of __STDC__. + * memchr.c: Likewise. + * strcasecmp.c: Likewise. + * strncasecmp.c: Likewise. + * strncmp.c: Likewise. + * xatexit.c: Likewise. + * xmalloc.c: Likewise. + + * copysign.c: Use traditional function declaration instead of DEFUN. + * sigsetmask.c: Likewise. + + * memcmp.c: Both of the above, ANSI_PROTOTYPES and DEFUN. + * memset.c: Likewise. + + * memcpy.c: ANSI_PROTOTYPES, DEFUN and prototype bcopy. + * memmove.c: Likewise. + +2003-04-14 Roger Sayle <roger@eyesopen.com> + + * strdup.c (strdup): Tweak implementation to use memcpy. + +2003-04-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in (HAVE_UINTPTR_T): Always define. + * configure: Regenerated. + +2003-03-23 Alexandre Oliva <aoliva@redhat.com> + + * Makefile.in (MULTIOSDIR): New macro. Use $(CC) $(LIBCFLAGS) + instead of $$CC alone. + (install_to_tooldir): Use it. + +2003-17-03 Jan Hubicka <jh@suse.cz> + + * hashtab.c (htab_traverse_noresize): Break out from ... + * hashtab.c (htab_traverse): ... here. + +2003-12-03 Jan Hubicka <jh@suse.cz> + + * hashtab.c (htab_expand): Fix warning. + + * hashtab.c (htab_expand): Compute the size of hashtable based + on the number of elements actually used. + (htab_traverse): Call htab_expand when table is too empty. + +2003-03-11 Carlo Wood <carlo@gnu.org> + + * cplus-dem.c (demangle_integral_value): Correction to reflect + patch of 2002-01-10 in order to also make negative multi-digits + without leading underscore work. + 2003-03-03 Mark Mitchell <mark@codesourcery.com> * cplus-dem.c: Add license exception to copyright notice. @@ -27,7 +126,7 @@ 2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Richard Earnshaw <rearnsha@arm.com> Geoffrey Keating <geoffk@apple.com> - + * configure.in: Check for sys/sysctl.h and sysctl. * physmem.c: Add support for *bsd and darwin. * Makefile.in: Generate depedency for physmem.o. @@ -46,10 +145,17 @@ 2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + * configure.in: Check for sys/sysmp.h and sysmp. + * physmem.c: Pull upstream copy, add support for irix6. + + * config.in, configure: Regenerated. + +2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + * physmem.c (physmem_total, physmem_available): De-ANSI-fy. * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and pstat_getdynamic. - + 2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * Makefile.in (CFILES): Add physmem.c. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 0641796..af512a2 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -140,7 +140,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ lrealpath.c \ make-relative-prefix.c \ make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \ - memset.c mkstemps.c \ + mempcpy.c memset.c mkstemps.c \ objalloc.c obstack.c \ partition.c \ pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c \ @@ -148,9 +148,9 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ physmem.c putenv.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \ - splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \ - strncasecmp.c strncmp.c strrchr.c strsignal.c strstr.c \ - strtod.c strtol.c strtoul.c \ + splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \ + strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c \ + strstr.c strtod.c strtol.c strtoul.c \ ternary.c tmpnam.c \ vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \ waitpid.c \ @@ -186,14 +186,14 @@ CONFIGURED_OFILES = asprintf.o atexit.o \ ffs.o \ getcwd.o getpagesize.o \ index.o insque.o \ - memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \ + memchr.o memcmp.o memcpy.o memmove.o mempcpy.o memset.o mkstemps.o \ pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o \ pex-unix.o pex-win32.o \ putenv.o \ random.o rename.o rindex.o \ - setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \ - strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \ - strtoul.o \ + setenv.o sigsetmask.o stpcpy.o stpncpy.o strcasecmp.o strchr.o \ + strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o \ + strtol.o strtoul.o \ tmpnam.o \ vasprintf.o vfork.o vfprintf.o vprintf.o vsprintf.o \ waitpid.o @@ -286,11 +286,16 @@ install_to_libdir: all fi @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install +# This is tricky. Even though CC in the Makefile contains +# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the +# default multilib, so we have to take LIBCFLAGS into account as well, +# since it will be passed the multilib flags. +MULTIOSDIR = `$(CC) $(LIBCFLAGS) -print-multi-os-directory` install_to_tooldir: all - ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/`$$CC -print-multi-os-directory` - $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/`$$CC -print-multi-os-directory`/$(TARGETLIB)n - ( cd $(DESTDIR)$(tooldir)/lib/`$$CC -print-multi-os-directory` ; $(RANLIB) $(TARGETLIB)n ) - mv -f $(DESTDIR)$(tooldir)/lib/`$$CC -print-multi-os-directory`/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/`$$CC -print-multi-os-directory`/$(TARGETLIB) + ${mkinstalldirs} $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) + $(INSTALL_DATA) $(TARGETLIB) $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n + ( cd $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR) ; $(RANLIB) $(TARGETLIB)n ) + mv -f $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB)n $(DESTDIR)$(tooldir)/lib/$(MULTIOSDIR)/$(TARGETLIB) @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install # needed-list is used by libstdc++. NEEDED is the list of functions @@ -418,7 +423,7 @@ atexit.o: config.h basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h bsearch.o: config.h $(INCDIR)/ansidecl.h -calloc.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +calloc.o: $(INCDIR)/ansidecl.h choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h clock.o: config.h concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h @@ -426,7 +431,7 @@ copysign.o: $(INCDIR)/ansidecl.h cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ - $(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ $(INCDIR)/libiberty.h fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h @@ -446,31 +451,38 @@ hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h memchr.o: $(INCDIR)/ansidecl.h memcmp.o: $(INCDIR)/ansidecl.h memcpy.o: $(INCDIR)/ansidecl.h memmove.o: $(INCDIR)/ansidecl.h +mempcpy.o: $(INCDIR)/ansidecl.h memset.o: $(INCDIR)/ansidecl.h mkstemps.o: config.h $(INCDIR)/ansidecl.h objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h obstack.o: config.h $(INCDIR)/obstack.h partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/partition.h -pex-djgpp.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -pex-mpw.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -pex-msdos.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h -pex-os2.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -pex-unix.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -pex-win32.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -physmem.o: config.h $(INCDIR)/libiberty.h +pex-djgpp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h +pex-mpw.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h +pex-msdos.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h $(INCDIR)/safe-ctype.h +pex-os2.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h +pex-unix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h +pex-win32.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(srcdir)/pex-common.h +physmem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h putenv.o: config.h $(INCDIR)/ansidecl.h random.o: $(INCDIR)/ansidecl.h regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h -rename.o: config.h +rename.o: config.h $(INCDIR)/ansidecl.h safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h setenv.o: config.h $(INCDIR)/ansidecl.h sigsetmask.o: $(INCDIR)/ansidecl.h @@ -479,8 +491,11 @@ sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/splay-tree.h +stpcpy.o: $(INCDIR)/ansidecl.h +stpncpy.o: $(INCDIR)/ansidecl.h strcasecmp.o: $(INCDIR)/ansidecl.h strchr.o: $(INCDIR)/ansidecl.h +strdup.o: $(INCDIR)/ansidecl.h strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h strncasecmp.o: $(INCDIR)/ansidecl.h strncmp.o: $(INCDIR)/ansidecl.h @@ -493,6 +508,7 @@ ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/ternary.h vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h vfork.o: $(INCDIR)/ansidecl.h +vfprintf.o: $(INCDIR)/ansidecl.h vprintf.o: $(INCDIR)/ansidecl.h vsprintf.o: $(INCDIR)/ansidecl.h waitpid.o: config.h diff --git a/libiberty/argv.c b/libiberty/argv.c index 4205579..31d8ef5 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -29,13 +29,13 @@ Boston, MA 02111-1307, USA. */ /* Routines imported from standard C runtime libraries. */ -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #include <string.h> #include <stdlib.h> -#else /* !__STDC__ */ +#else /* !ANSI_PROTOTYPES */ #if !defined _WIN32 || defined __GNUC__ extern char *memcpy (); /* Copy memory region */ @@ -46,7 +46,7 @@ extern void free (); /* Free malloc'd memory */ extern char *strdup (); /* Duplicate a string */ #endif -#endif /* __STDC__ */ +#endif /* ANSI_PROTOTYPES */ #ifndef NULL diff --git a/libiberty/calloc.c b/libiberty/calloc.c index b342f6c..5073682 100644 --- a/libiberty/calloc.c +++ b/libiberty/calloc.c @@ -13,8 +13,6 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of */ #include "ansidecl.h" -#include "libiberty.h" - #ifdef ANSI_PROTOTYPES #include <stddef.h> #else @@ -23,6 +21,7 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of /* For systems with larger pointers than ints, this must be declared. */ PTR malloc PARAMS ((size_t)); +void bzero PARAMS ((PTR, size_t)); PTR calloc (nelem, elsize) diff --git a/libiberty/config.in b/libiberty/config.in index f0e1746..0efae6d 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -105,6 +105,9 @@ /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE +/* Define if you have the mempcpy function. */ +#undef HAVE_MEMPCPY + /* Define if you have the memset function. */ #undef HAVE_MEMSET @@ -147,6 +150,12 @@ /* Define if you have the sigsetmask function. */ #undef HAVE_SIGSETMASK +/* Define if you have the stpcpy function. */ +#undef HAVE_STPCPY + +/* Define if you have the stpncpy function. */ +#undef HAVE_STPNCPY + /* Define if you have the strcasecmp function. */ #undef HAVE_STRCASECMP diff --git a/libiberty/configure b/libiberty/configure index 3f46ebf..ed8b388 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -1645,22 +1645,21 @@ EOF fi - -if test $ac_cv_type_uintptr_t = yes -then - cat >> confdefs.h <<\EOF +# Given the above check, we always have uintptr_t or a fallback +# definition. So define HAVE_UINTPTR_T in case any imported code +# relies on it. +cat >> confdefs.h <<\EOF #define HAVE_UINTPTR_T 1 EOF -fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1659: checking for pid_t" >&5 +echo "configure:1658: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1664 "configure" +#line 1663 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1709,6 +1708,7 @@ funcs="$funcs memchr" funcs="$funcs memcmp" funcs="$funcs memcpy" funcs="$funcs memmove" +funcs="$funcs mempcpy" funcs="$funcs memset" funcs="$funcs mkstemps" funcs="$funcs putenv" @@ -1717,6 +1717,8 @@ funcs="$funcs rename" funcs="$funcs rindex" funcs="$funcs setenv" funcs="$funcs sigsetmask" +funcs="$funcs stpcpy" +funcs="$funcs stpncpy" funcs="$funcs strcasecmp" funcs="$funcs strchr" funcs="$funcs strdup" @@ -1747,12 +1749,12 @@ if test "x" = "y"; then for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1751: checking for $ac_func" >&5 +echo "configure:1753: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1756 "configure" +#line 1758 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1775,7 +1777,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1802,12 +1804,12 @@ done for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1806: checking for $ac_func" >&5 +echo "configure:1808: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1811 "configure" +#line 1813 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1830,7 +1832,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1854,15 +1856,15 @@ else fi done - for ac_func in memmove memset putenv random rename rindex sigsetmask + for ac_func in memmove mempcpy memset putenv random rename rindex sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1861: checking for $ac_func" >&5 +echo "configure:1863: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1866 "configure" +#line 1868 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1885,7 +1887,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1909,15 +1911,15 @@ else fi done - for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr + for ac_func in strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1916: checking for $ac_func" >&5 +echo "configure:1918: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1921 "configure" +#line 1923 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1940,7 +1942,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1967,12 +1969,12 @@ done for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1971: checking for $ac_func" >&5 +echo "configure:1973: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1976 "configure" +#line 1978 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1995,7 +1997,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2022,12 +2024,12 @@ done for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2026: checking for $ac_func" >&5 +echo "configure:2028: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2031 "configure" +#line 2033 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2050,7 +2052,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2077,12 +2079,12 @@ done for ac_func in sysconf times sbrk gettimeofday ffs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2081: checking for $ac_func" >&5 +echo "configure:2083: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2086 "configure" +#line 2088 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2105,7 +2107,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2132,12 +2134,12 @@ done for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2136: checking for $ac_func" >&5 +echo "configure:2138: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2141 "configure" +#line 2143 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2160,7 +2162,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2187,12 +2189,12 @@ done for ac_func in realpath canonicalize_file_name do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2191: checking for $ac_func" >&5 +echo "configure:2193: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2196 "configure" +#line 2198 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2215,7 +2217,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2449,7 +2451,7 @@ if test -z "${setobjs}"; then # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2453: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2455: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2460,12 +2462,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2464 "configure" +#line 2466 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2491,19 +2493,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2495: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2497: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2502: checking for $ac_func" >&5 +echo "configure:2504: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2507 "configure" +#line 2509 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2526,7 +2528,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2553,12 +2555,12 @@ done echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2557: checking whether alloca needs Cray hooks" >&5 +echo "configure:2559: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2562 "configure" +#line 2564 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2583,12 +2585,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2587: checking for $ac_func" >&5 +echo "configure:2589: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2592 "configure" +#line 2594 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2611,7 +2613,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2637,7 +2639,7 @@ fi fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2641: checking stack direction for C alloca" >&5 +echo "configure:2643: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2645,7 +2647,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2649 "configure" +#line 2651 "configure" #include "confdefs.h" find_stack_direction () { @@ -2664,7 +2666,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2686,17 +2688,17 @@ EOF ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2690: checking for vfork.h" >&5 +echo "configure:2692: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2695 "configure" +#line 2697 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2721,18 +2723,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2725: checking for working vfork" >&5 +echo "configure:2727: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2731: checking for vfork" >&5 +echo "configure:2733: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2736 "configure" +#line 2738 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2755,7 +2757,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2777,7 +2779,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 2781 "configure" +#line 2783 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2872,7 +2874,7 @@ main() { } } EOF -if { (eval echo configure:2876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2904,12 +2906,12 @@ fi for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2908: checking for $ac_func" >&5 +echo "configure:2910: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2913 "configure" +#line 2915 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2932,7 +2934,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2962,12 +2964,12 @@ done for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2966: checking for $ac_func" >&5 +echo "configure:2968: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2971 "configure" +#line 2973 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2990,7 +2992,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3018,19 +3020,19 @@ done for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:3022: checking for $v" >&5 +echo "configure:3024: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3027 "configure" +#line 3029 "configure" #include "confdefs.h" int *p; int main() { extern int $v []; p = $v; ; return 0; } EOF -if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -3056,12 +3058,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3060: checking for $ac_func" >&5 +echo "configure:3062: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3065 "configure" +#line 3067 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3084,7 +3086,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3109,12 +3111,12 @@ fi done echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:3113: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:3115: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3118 "configure" +#line 3120 "configure" #include "confdefs.h" #include "confdefs.h" @@ -3136,7 +3138,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:3140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_decl_needed_canonicalize_file_name=no else @@ -3172,17 +3174,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3176: checking for $ac_hdr" >&5 +echo "configure:3178: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3181 "configure" +#line 3183 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3211,12 +3213,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3215: checking for $ac_func" >&5 +echo "configure:3217: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3220 "configure" +#line 3222 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3239,7 +3241,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3264,7 +3266,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3268: checking for working mmap" >&5 +echo "configure:3270: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3272,7 +3274,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3276 "configure" +#line 3278 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3412,7 +3414,7 @@ main() } EOF -if { (eval echo configure:3416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3436,7 +3438,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:3440: checking for working strncmp" >&5 +echo "configure:3442: checking for working strncmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3444,7 +3446,7 @@ else ac_cv_func_strncmp_works=no else cat > conftest.$ac_ext <<EOF -#line 3448 "configure" +#line 3450 "configure" #include "confdefs.h" /* Test by Jim Wilson and Kaveh Ghazi. @@ -3508,7 +3510,7 @@ main () } EOF -if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strncmp_works=yes else diff --git a/libiberty/configure.in b/libiberty/configure.in index 5b38660..d6c2649 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -149,11 +149,10 @@ AC_HEADER_TIME libiberty_AC_DECLARE_ERRNO AC_CHECK_TYPE(uintptr_t, unsigned long) - -if test $ac_cv_type_uintptr_t = yes -then - AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) -fi +# Given the above check, we always have uintptr_t or a fallback +# definition. So define HAVE_UINTPTR_T in case any imported code +# relies on it. +AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) AC_TYPE_PID_T @@ -178,6 +177,7 @@ funcs="$funcs memchr" funcs="$funcs memcmp" funcs="$funcs memcpy" funcs="$funcs memmove" +funcs="$funcs mempcpy" funcs="$funcs memset" funcs="$funcs mkstemps" funcs="$funcs putenv" @@ -186,6 +186,8 @@ funcs="$funcs rename" funcs="$funcs rindex" funcs="$funcs setenv" funcs="$funcs sigsetmask" +funcs="$funcs stpcpy" +funcs="$funcs stpncpy" funcs="$funcs strcasecmp" funcs="$funcs strchr" funcs="$funcs strdup" @@ -215,8 +217,8 @@ checkfuncs="$checkfuncs getsysinfo table sysctl" if test "x" = "y"; then AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock) AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy) - AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask) - AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr) + AC_CHECK_FUNCS(memmove mempcpy memset putenv random rename rindex sigsetmask) + AC_CHECK_FUNCS(strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr) AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf) AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal) AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs) diff --git a/libiberty/copysign.c b/libiberty/copysign.c index 5c48a54..d288be2 100644 --- a/libiberty/copysign.c +++ b/libiberty/copysign.c @@ -131,7 +131,9 @@ typedef union #if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN) -double DEFUN(copysign, (x, y), double x AND double y) +double +copysign (x, y) + double x, y; { __ieee_double_shape_type a,b; b.value = y; @@ -142,7 +144,9 @@ double DEFUN(copysign, (x, y), double x AND double y) #else -double DEFUN(copysign, (x, y), double x AND double y) +double +copysign (x, y) + double x, y; { if ((x < 0 && y > 0) || (x > 0 && y < 0)) return -x; diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index af35bc1..59afcd3 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -1797,31 +1797,34 @@ demangle_integral_value (work, mangled, s) success = 0; - /* Negative numbers are indicated with a leading `m'. */ - if (**mangled == 'm') - { - string_appendn (s, "-", 1); - (*mangled)++; - } - else if (mangled[0][0] == '_' && mangled[0][1] == 'm') - { - /* Since consume_count_with_underscores does not handle the - `m'-prefix we must do it here, using consume_count and - adjusting underscores: we have to consume the underscore - matching the prepended one. */ - multidigit_without_leading_underscore = 1; - string_appendn (s, "-", 1); - (*mangled) += 2; - } - else if (**mangled == '_') - { - /* Do not consume a following underscore; - multidigit_without_leading_underscore will consume what should be - consumed. */ - leave_following_underscore = 1; + if (**mangled == '_') + { + if (mangled[0][1] == 'm') + { + /* Since consume_count_with_underscores does not handle the + `m'-prefix we must do it here, using consume_count and + adjusting underscores: we have to consume the underscore + matching the prepended one. */ + multidigit_without_leading_underscore = 1; + string_appendn (s, "-", 1); + (*mangled) += 2; + } + else + { + /* Do not consume a following underscore; + consume_count_with_underscores will consume what + should be consumed. */ + leave_following_underscore = 1; + } } else { + /* Negative numbers are indicated with a leading `m'. */ + if (**mangled == 'm') + { + string_appendn (s, "-", 1); + (*mangled)++; + } /* Since consume_count_with_underscores does not handle multi-digit numbers that do not start with an underscore, and this number can be an integer template parameter, @@ -1862,7 +1865,7 @@ demangle_integral_value (work, mangled, s) /* All is well. */ success = 1; } - } + } return success; } diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index d9e9fad..d69024f 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -17,9 +17,10 @@ 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 "ansidecl.h" #include "floatformat.h" #include <math.h> /* ldexp */ -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> extern void *memcpy (void *s1, const void *s2, size_t n); extern void *memset (void *s, int c, size_t n); diff --git a/libiberty/functions.texi b/libiberty/functions.texi index 2c7b9e1..bb35549 100644 --- a/libiberty/functions.texi +++ b/libiberty/functions.texi @@ -398,7 +398,7 @@ and a path ending in @code{/} returns the empty string after it. Given a pointer to a string containing a pathname, returns a canonical version of the filename. Symlinks will be resolved, and ``.'' and ``..'' components will be simplified. The returned value will be allocated using -@code{xmalloc} or @code{malloc}. +@code{malloc}, or @code{NULL} will be returned on a memory allocation error. @end deftypefn @@ -476,6 +476,14 @@ Copies @var{count} bytes from memory area @var{from} to memory area @end deftypefn +@c mempcpy.c:23 +@deftypefn Supplemental void* mempcpy (void *@var{out}, const void *@var{in}, size_t @var{length}) + +Copies @var{length} bytes from memory region @var{in} to region +@var{out}. Returns a pointer to @var{out} + @var{length}. + +@end deftypefn + @c memset.c:6 @deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) @@ -674,6 +682,24 @@ valid until at least the next call. @end deftypefn +@c stpcpy.c:23 +@deftypefn Supplemental char* stpcpy (char *@var{dst}, const char *@var{src}) + +Copies the string @var{src} into @var{dst}. Returns a pointer to +@var{dst} + strlen(@var{src}). + +@end deftypefn + +@c stpncpy.c:23 +@deftypefn Supplemental char* stpncpy (char *@var{dst}, const char *@var{src}, size_t @var{len}) + +Copies the string @var{src} into @var{dst}, copying exactly @var{len} +and padding with zeros if necessary. If @var{len} < strlen(@var{src}) +then return @var{dst} + @var{len}, otherwise returns @var{dst} + +strlen(@var{src}). + +@end deftypefn + @c strcasecmp.c:15 @deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2}) diff --git a/libiberty/getcwd.c b/libiberty/getcwd.c index 465b4e0..a19d267 100644 --- a/libiberty/getcwd.c +++ b/libiberty/getcwd.c @@ -40,7 +40,7 @@ extern int errno; char * getcwd (buf, len) char *buf; - int len; + size_t len; { char ourbuf[MAXPATHLEN]; char *result; diff --git a/libiberty/getopt.c b/libiberty/getopt.c index 2402a39..a1e4827 100644 --- a/libiberty/getopt.c +++ b/libiberty/getopt.c @@ -333,8 +333,8 @@ exchange (argv) nonoption_flags_len = nonoption_flags_max_len = 0; else { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), + memset (mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; @@ -444,7 +444,7 @@ _getopt_initialize (argc, argv, optstring) if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + memset (mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 0429936..32067af 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -373,7 +373,14 @@ htab_expand (htab) oentries = htab->entries; olimit = oentries + htab->size; - nsize = higher_prime_number (htab->size * 2); + /* Resize only when table after removal of unused elements is either + too full or too empty. */ + if ((htab->n_elements - htab->n_deleted) * 2 > htab->size + || ((htab->n_elements - htab->n_deleted) * 8 < htab->size + && htab->size > 32)) + nsize = higher_prime_number ((htab->n_elements - htab->n_deleted) * 2); + else + nsize = htab->size; if (htab->alloc_with_arg_f != NULL) nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize, @@ -596,13 +603,16 @@ htab_clear_slot (htab, slot) argument. */ void -htab_traverse (htab, callback, info) +htab_traverse_noresize (htab, callback, info) htab_t htab; htab_trav callback; PTR info; { - PTR *slot = htab->entries; - PTR *limit = slot + htab->size; + PTR *slot; + PTR *limit; + + slot = htab->entries; + limit = slot + htab->size; do { @@ -615,6 +625,21 @@ htab_traverse (htab, callback, info) while (++slot < limit); } +/* Like htab_traverse_noresize, but does resize the table when it is + too empty to improve effectivity of subsequent calls. */ + +void +htab_traverse (htab, callback, info) + htab_t htab; + htab_trav callback; + PTR info; +{ + if ((htab->n_elements - htab->n_deleted) * 8 < htab->size) + htab_expand (htab); + + htab_traverse_noresize (htab, callback, info); +} + /* Return the current size of given hash table. */ size_t diff --git a/libiberty/maint-tool b/libiberty/maint-tool index ceeb48d..6b9bf7f 100644 --- a/libiberty/maint-tool +++ b/libiberty/maint-tool @@ -223,6 +223,14 @@ sub deps { } $mine{'config.h'} = "config.h"; + opendir(INC, $srcdir); + while ($f = readdir INC) { + next unless $f =~ /\.h$/; + $mine{$f} = "\$(srcdir)/$f"; + $deps{$f} = join(' ', &deps_for("$srcdir/$f")); + } + $mine{'config.h'} = "config.h"; + open(IN, "$srcdir/Makefile.in"); open(OUT, ">$srcdir/Makefile.tmp"); while (<IN>) { diff --git a/libiberty/memchr.c b/libiberty/memchr.c index f94bea0..3948125 100644 --- a/libiberty/memchr.c +++ b/libiberty/memchr.c @@ -15,7 +15,7 @@ returned. */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/libiberty/memcmp.c b/libiberty/memcmp.c index d8d3997..92f2b6e 100644 --- a/libiberty/memcmp.c +++ b/libiberty/memcmp.c @@ -16,15 +16,17 @@ as if comparing unsigned char arrays. */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif int -DEFUN(memcmp, (str1, str2, count), - const PTR str1 AND const PTR str2 AND size_t count) +memcmp (str1, str2, count) + const PTR str1; + const PTR str2; + size_t count; { register const unsigned char *s1 = (const unsigned char*)str1; register const unsigned char *s2 = (const unsigned char*)str2; diff --git a/libiberty/memcpy.c b/libiberty/memcpy.c index 0f2bac7..5eece7a 100644 --- a/libiberty/memcpy.c +++ b/libiberty/memcpy.c @@ -13,14 +13,19 @@ Copies @var{length} bytes from memory region @var{in} to region */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif +void bcopy PARAMS((const void*, void*, size_t)); + PTR -DEFUN(memcpy, (out, in, length), PTR out AND const PTR in AND size_t length) +memcpy (out, in, length) + PTR out; + const PTR in; + size_t length; { bcopy(in, out, length); return out; diff --git a/libiberty/memmove.c b/libiberty/memmove.c index 3ec7320..00ac053 100644 --- a/libiberty/memmove.c +++ b/libiberty/memmove.c @@ -13,12 +13,14 @@ Copies @var{count} bytes from memory area @var{from} to memory area */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif +void bcopy PARAMS ((const void*, void*, size_t)); + PTR memmove (s1, s2, n) PTR s1; diff --git a/libiberty/memset.c b/libiberty/memset.c index 489ca17..5119f85 100644 --- a/libiberty/memset.c +++ b/libiberty/memset.c @@ -13,15 +13,17 @@ Sets the first @var{count} bytes of @var{s} to the constant byte */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long #endif PTR -DEFUN(memset, (dest, val, len), - PTR dest AND register int val AND register size_t len) +memset (dest, val, len) + PTR dest; + register int val; + register size_t len; { register unsigned char *ptr = (unsigned char*)dest; while (len-- > 0) diff --git a/libiberty/regex.c b/libiberty/regex.c index f9d9a4e..e3439b2 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -8200,7 +8200,7 @@ regerror (errcode, preg, errbuf, errbuf_size) if (msg_size > errbuf_size) { #if defined HAVE_MEMPCPY || defined _LIBC - *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; + *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; diff --git a/libiberty/rename.c b/libiberty/rename.c index 0563062..399980a 100644 --- a/libiberty/rename.c +++ b/libiberty/rename.c @@ -12,6 +12,7 @@ exists, it is removed. */ +#include "ansidecl.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -22,8 +23,8 @@ exists, it is removed. int rename (zfrom, zto) - char *zfrom; - char *zto; + const char *zfrom; + const char *zto; { if (link (zfrom, zto) < 0) { diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c index f705fbb..4de3e4b 100644 --- a/libiberty/sigsetmask.c +++ b/libiberty/sigsetmask.c @@ -25,8 +25,8 @@ extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN; #ifdef SIG_SETMASK int -DEFUN(sigsetmask,(set), - int set) +sigsetmask (set) + int set; { sigset_t new; sigset_t old; diff --git a/libiberty/strcasecmp.c b/libiberty/strcasecmp.c index 4bfe650..d2608dc 100644 --- a/libiberty/strcasecmp.c +++ b/libiberty/strcasecmp.c @@ -25,7 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/libiberty/strdup.c b/libiberty/strdup.c index 49233ba..071a4a4 100644 --- a/libiberty/strdup.c +++ b/libiberty/strdup.c @@ -9,13 +9,24 @@ Returns a pointer to a copy of @var{s} in memory obtained from */ +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES +#include <stddef.h> +#else +#define size_t unsigned long +#endif + +extern size_t strlen PARAMS ((const char*)); +extern PTR malloc PARAMS ((size_t)); +extern PTR memcpy PARAMS ((PTR, const PTR, size_t)); + char * strdup(s) char *s; { - char *result = (char*)malloc(strlen(s) + 1); - if (result == (char*)0) - return (char*)0; - strcpy(result, s); - return result; + size_t len = strlen (s) + 1; + char *result = (char*) malloc (len); + if (result == (char*) 0) + return (char*) 0; + return (char*) memcpy (result, s, len); } diff --git a/libiberty/strncasecmp.c b/libiberty/strncasecmp.c index 77cb421..10feee8 100644 --- a/libiberty/strncasecmp.c +++ b/libiberty/strncasecmp.c @@ -25,7 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/libiberty/strncmp.c b/libiberty/strncmp.c index 819cea6..ad87e1f 100644 --- a/libiberty/strncmp.c +++ b/libiberty/strncmp.c @@ -13,7 +13,7 @@ Compares the first @var{n} bytes of two strings, returning a value as */ #include <ansidecl.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/libiberty/strsignal.c b/libiberty/strsignal.c index 86c8aca..a8a7d34 100644 --- a/libiberty/strsignal.c +++ b/libiberty/strsignal.c @@ -42,7 +42,7 @@ extern PTR memset (); #undef sys_nsig #ifndef NULL -# ifdef __STDC__ +# ifdef ANSI_PROTOTYPES # define NULL (void *) 0 # else # define NULL 0 diff --git a/libiberty/strstr.c b/libiberty/strstr.c index 470e04b..a059c7f 100644 --- a/libiberty/strstr.c +++ b/libiberty/strstr.c @@ -27,8 +27,8 @@ strstr (s1, s2) register char *p = s1; extern char *strchr (); extern int strncmp (); -#if __GNUC__==2 - extern __SIZE_TYPE__ strlen (); +#if __GNUC__ >= 2 + extern __SIZE_TYPE__ strlen (const char *); #endif register int len = strlen (s2); diff --git a/libiberty/vfprintf.c b/libiberty/vfprintf.c index db7b2ff..18f09d4 100644 --- a/libiberty/vfprintf.c +++ b/libiberty/vfprintf.c @@ -3,7 +3,8 @@ Copyright (C) 1998 Free Software Foundation, Inc. */ -#ifdef __STDC__ +#include "ansidecl.h" +#ifdef ANSI_PROTOTYPES #include <stdarg.h> #else #include <varargs.h> diff --git a/libiberty/vprintf.c b/libiberty/vprintf.c index c57c3e4..9487896 100644 --- a/libiberty/vprintf.c +++ b/libiberty/vprintf.c @@ -15,13 +15,13 @@ nonstandard but common function @code{_doprnt}. */ -#ifdef __STDC__ +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES #include <stdarg.h> #else #include <varargs.h> #endif #include <stdio.h> -#include <ansidecl.h> #undef vprintf int vprintf (format, ap) diff --git a/libiberty/vsprintf.c b/libiberty/vsprintf.c index b69e9bc..9f09d7e 100644 --- a/libiberty/vsprintf.c +++ b/libiberty/vsprintf.c @@ -26,9 +26,13 @@ the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ +#include <ansidecl.h> +#ifdef ANSI_PROTOTYPES +#include <stdarg.h> +#else #include <varargs.h> +#endif #include <stdio.h> -#include <ansidecl.h> #undef vsprintf #if defined _IOSTRG && defined _IOWRT diff --git a/libiberty/xatexit.c b/libiberty/xatexit.c index abf3407..075599c 100644 --- a/libiberty/xatexit.c +++ b/libiberty/xatexit.c @@ -27,7 +27,7 @@ failure. If you use @code{xatexit} to register functions, you must use #include <stdio.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index 4c8249a..c3fe1a8 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -68,7 +68,7 @@ function will be called to print an error message and terminate execution. #include <stdio.h> -#ifdef __STDC__ +#ifdef ANSI_PROTOTYPES #include <stddef.h> #else #define size_t unsigned long @@ -636,7 +636,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) + alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 42cf257..8148ca9 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,68 @@ +2003-04-15 Rohit Kumar Srivastava <rohits@kpitcummins.com> + + * h8500-opc.c: Replace occurrances of 'Hitachi' with 'Renesas'. + +2003-04-07 James E Wilson <wilson@tuliptree.org> + + * ia64-ic.tbl (fr-readers): Add mem-writers-fp. + * ia64-asmtab.c: Regenerate. + +2003-04-08 Alexandre Oliva <aoliva@redhat.com> + + * mips-dis.c (mips_gpr_names_newabi): Reverted previous patch. + +2003-04-07 Alexandre Oliva <aoliva@redhat.com> + + * mips-dis.c (mips_gpr_names_newabi): $12-$15 are named $t4-$t7. + +2003-04-04 Svein E. Seldal <Svein.Seldal@solidas.com> + + * tic4x-dis.c: Namespace cleanup. Replace s/c4x/tic4x and + s/c3x/tic3x/ + +2003-04-01 Nick Clifton <nickc@redhat.com> + + * arm-dis.c: Remove presence of (r) and (tm) symbols. + * arm-opc.h: Remove presence of (r) and (tm) symbols. + +2003-03-25 Stan Cox <scox@redhat.com> + Nick Clifton <nickc@redhat.com> + + Contribute support for Intel's iWMMXt chip - an ARM variant: + + * arm-dis.c (regnames): Add iWMMXt register names. + (set_iwmmxt_regnames): New function. + (print_insn_arm): Handle iWMMXt formatters. + * arm-opc.h: Document iWMMXt formatters. + (arm_opcod): Add iWMMXt instructions. + +2003-03-22 Doug Evans <dje@sebabeach.org> + + * i386-dis.c (dis386): Recognize icebp (0xf1). + +2003-03-21 Martin Schwidefsky <schwidefsky@de.ibm.com> + + * s390-dis.c (init_disasm): Rename S390_OPCODE_ESAME to + S390_OPCODE_ZARCH. + (print_insn_s390): Use new modes field of s390_opcodes. + * s390-mkopc.c (ARCHBITS_ESAONLY, ARCHBITS_ESA, ARCHBITS_ESAME): Remove. + (s390_opcode_mode_val, s390_opcode_cpu_val): New enums. + (struct op_struct): Remove archbits. Add mode_bits and min_cpu. + (insertOpcode): Replace archbits by min_cpu and mode_bits. + (dumpTable): Write mode_bits and min_cpu instead of archbits. + (main): Adapt to new format in s390-opcode.txt. + * s390-opc.c (s390_opformats): Replace archbits by min_cpu and + mode_bits. + * s390-opc.txt: Replace archbits by min_cpu and mode_bits. + +2003-03-17 Nick Clifton <nickc@redhat.com> + + * ppc-opc.c: Fix formatting. Update copyright date. + +2003-03-14 Daniel Jacobowitz <drow@mvista.com> + + * ppc-opc.c (powerpc_opcodes): Readd tlbre for PPC403. + 2003-02-25 Alan Modra <amodra@bigpond.net.au> * hppa-dis.c: Formatting. diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index d3ecd6f..df20832 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -160,6 +160,7 @@ CFILES = \ xstormy16-dis.c \ xstormy16-ibld.c \ xstormy16-opc.c \ + xtensa-dis.c \ z8k-dis.c \ z8kgen.c @@ -270,6 +271,7 @@ ALL_MACHINES = \ xstormy16-dis.lo \ xstormy16-ibld.lo \ xstormy16-opc.lo \ + xtensa-dis.lo \ z8k-dis.lo OFILES = @BFD_MACHINES@ @@ -817,6 +819,9 @@ xstormy16-ibld.lo: xstormy16-ibld.c sysdep.h config.h \ xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h +xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \ + $(BFD_H) $(INCDIR)/symcat.h z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 4939324..0220191 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -271,6 +271,7 @@ CFILES = \ xstormy16-dis.c \ xstormy16-ibld.c \ xstormy16-opc.c \ + xtensa-dis.c \ z8k-dis.c \ z8kgen.c @@ -382,6 +383,7 @@ ALL_MACHINES = \ xstormy16-dis.lo \ xstormy16-ibld.lo \ xstormy16-opc.lo \ + xtensa-dis.lo \ z8k-dis.lo @@ -465,7 +467,7 @@ acinclude.m4 aclocal.m4 config.in configure configure.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES) OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS) @@ -1313,6 +1315,9 @@ xstormy16-ibld.lo: xstormy16-ibld.c sysdep.h config.h \ xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen.h xstormy16-opc.h $(INCDIR)/libiberty.h +xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/dis-asm.h \ + $(BFD_H) $(INCDIR)/symcat.h z8k-dis.lo: z8k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h z8k-opc.h z8kgen.lo: z8kgen.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 62a2a39..2c9e385 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -1,24 +1,24 @@ /* Instruction printing code for the ARM - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modification by James G. Smith (jsmith@cygnus.co.uk) -This file is part of libopcodes. + This file is part of libopcodes. -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2 of the License, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "dis-asm.h" @@ -70,7 +70,21 @@ static arm_regname regnames[] = { "atpcs", "Select register names used in the ATPCS", { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "IP", "SP", "LR", "PC" }}, { "special-atpcs", "Select special register names used in the ATPCS", - { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL", "FP", "IP", "SP", "LR", "PC" }} + { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL", "FP", "IP", "SP", "LR", "PC" }}, + { "iwmmxt_regnames", "Select register names used on the Intel Wireless MMX technology coprocessor", + { "wr0", "wr1", "wr2", "wr3", "wr4", "wr5", "wr6", "wr7", "wr8", "wr9", "wr10", "wr11", "wr12", "wr13", "wr14", "wr15"}}, + { "iwmmxt_Cregnames", "Select control register names used on the Intel Wireless MMX technology coprocessor", + {"wcid", "wcon", "wcssf", "wcasf", "reserved", "reserved", "reserved", "reserved", "wcgr0", "wcgr1", "wcgr2", "wcgr3", "reserved", "reserved", "reserved", "reserved"}} +}; + +static char * iwmmxt_wwnames[] = +{"b", "h", "w", "d"}; + +static char * iwmmxt_wwssnames[] = +{"b", "bus", "b", "bss", + "h", "hus", "h", "hss", + "w", "wus", "w", "wss", + "d", "dus", "d", "dss" }; /* Default to GCC register name set. */ @@ -98,11 +112,15 @@ static void parse_disassembler_options PARAMS ((char *)); static int print_insn PARAMS ((bfd_vma, struct disassemble_info *, bfd_boolean)); -int get_arm_regname_num_options (void); -int set_arm_regname_option (int option); -int get_arm_regnames (int option, const char **setname, - const char **setdescription, - const char ***register_names); +static int set_iwmmxt_regnames + PARAMS ((void)); + +int get_arm_regname_num_options + PARAMS ((void)); +int set_arm_regname_option + PARAMS ((int)); +int get_arm_regnames + PARAMS ((int, const char **, const char **, const char ***)); /* Functions. */ int @@ -167,6 +185,24 @@ arm_decode_shift (given, func, stream) } } +static int +set_iwmmxt_regnames () +{ + const char * setname; + const char * setdesc; + const char ** regnames; + int iwmmxt_regnames = 0; + int num_regnames = get_arm_regname_num_options (); + + get_arm_regnames (iwmmxt_regnames, &setname, + &setdesc, ®names); + while ((strcmp ("iwmmxt_regnames", setname)) + && (iwmmxt_regnames < num_regnames)) + get_arm_regnames (++iwmmxt_regnames, &setname, &setdesc, ®names); + + return iwmmxt_regnames; +} + /* Print one instruction from PC on INFO->STREAM. Return the size of the instruction (always 4 on ARM). */ @@ -179,9 +215,15 @@ print_insn_arm (pc, info, given) const struct arm_opcode *insn; void *stream = info->stream; fprintf_ftype func = info->fprintf_func; + static int iwmmxt_regnames = 0; for (insn = arm_opcodes; insn->assembler; insn++) { + if (insn->value == FIRST_IWMMXT_INSN + && info->mach != bfd_mach_arm_XScale + && info->mach != bfd_mach_arm_iWMMXt) + insn = insn + IWMMXT_INSN_COUNT; + if ((given & insn->mask) == insn->value) { char * c; @@ -629,6 +671,63 @@ print_insn_arm (pc, info, given) func (stream, "f%d", reg); } break; + + case 'w': + { + long reg; + + if (bitstart != bitend) + { + reg = given >> bitstart; + reg &= (2 << (bitend - bitstart)) - 1; + if (bitend - bitstart == 1) + func (stream, "%s", iwmmxt_wwnames[reg]); + else + func (stream, "%s", iwmmxt_wwssnames[reg]); + } + else + { + reg = (((given >> 8) & 0x1) | + ((given >> 22) & 0x1)); + func (stream, "%s", iwmmxt_wwnames[reg]); + } + } + break; + + case 'g': + { + long reg; + int current_regnames; + + if (! iwmmxt_regnames) + iwmmxt_regnames = set_iwmmxt_regnames (); + current_regnames = set_arm_regname_option + (iwmmxt_regnames); + + reg = given >> bitstart; + reg &= (2 << (bitend - bitstart)) - 1; + func (stream, "%s", arm_regnames[reg]); + set_arm_regname_option (current_regnames); + } + break; + + case 'G': + { + long reg; + int current_regnames; + + if (! iwmmxt_regnames) + iwmmxt_regnames = set_iwmmxt_regnames (); + current_regnames = set_arm_regname_option + (iwmmxt_regnames + 1); + + reg = given >> bitstart; + reg &= (2 << (bitend - bitstart)) - 1; + func (stream, "%s", arm_regnames[reg]); + set_arm_regname_option (current_regnames); + } + break; + default: abort (); } @@ -734,6 +833,54 @@ print_insn_arm (pc, info, given) } break; + case 'L': + switch (given & 0x00400100) + { + case 0x00000000: func (stream, "b"); break; + case 0x00400000: func (stream, "h"); break; + case 0x00000100: func (stream, "w"); break; + case 0x00400100: func (stream, "d"); break; + default: + break; + } + break; + + case 'Z': + { + int value; + /* given (20, 23) | given (0, 3) */ + value = ((given >> 16) & 0xf0) | (given & 0xf); + func (stream, "%d", value); + } + break; + + case 'l': + /* This is like the 'A' operator, except that if + the width field "M" is zero, then the offset is + *not* multiplied by four. */ + { + int offset = given & 0xff; + int multiplier = (given & 0x00000100) ? 4 : 1; + + func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]); + + if (offset) + { + if ((given & 0x01000000) != 0) + func (stream, ", %s#%d]%s", + ((given & 0x00800000) == 0 ? "-" : ""), + offset * multiplier, + ((given & 0x00200000) != 0 ? "!" : "")); + else + func (stream, "], %s#%d", + ((given & 0x00800000) == 0 ? "-" : ""), + offset * multiplier); + } + else + func (stream, "]"); + } + break; + default: abort (); } diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h index 213d4f0..22313cb 100644 --- a/opcodes/arm-opc.h +++ b/opcodes/arm-opc.h @@ -1,6 +1,6 @@ /* Opcode table for the ARM. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -60,6 +60,13 @@ struct thumb_opcode %m print register mask for ldm/stm instruction %C print the PSR sub type. %F print the COUNT field of a LFM/SFM instruction. +IWMMXT specific format options: + %<bitfield>g print as an iWMMXt 64-bit register + %<bitfield>G print as an iWMMXt general purpose or control register + %<bitfield>w print as an iWMMXt width field - [bhwd]ss/us + %Z print the Immediate of a WSHUFH instruction. + %L print as an iWMMXt N/M width field. + %l like 'A' except use byte offsets for 'B' & 'H' versions Thumb specific format options: %D print Thumb register (bits 0..2 as high number if bit 7 set) %S print Thumb register (bits 3..5 as high number if bit 6 set) @@ -101,6 +108,59 @@ static const struct arm_opcode arm_opcodes[] = {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, {0xf450f000, 0xfc70f000, "pld\t%a"}, + /* Intel Wireless MMX technology instructions. */ +#define FIRST_IWMMXT_INSN 0x0e130130 +#define IWMMXT_INSN_COUNT 47 + {0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"}, + {0x0e400010, 0x0ff00f3f, "tbcst%6-7w%c\t%16-19g, %12-15r"}, + {0x0e130170, 0x0f3f0ff8, "textrc%22-23w%c\t%12-15r, #%0-2d"}, + {0x0e100070, 0x0f300ff0, "textrm%3?su%22-23w%c\t%12-15r, %16-19g, #%0-2d"}, + {0x0e600010, 0x0ff00f38, "tinsr%6-7w%c\t%16-19g, %12-15r, #%0-2d"}, + {0x0e000110, 0x0ff00fff, "tmcr%c\t%16-19G, %12-15r"}, + {0x0c400000, 0x0ff00ff0, "tmcrr%c\t%0-3g, %12-15r, %16-19r"}, + {0x0e2c0010, 0x0ffc0e10, "tmia%17?tb%16?tb%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e200010, 0x0fff0e10, "tmia%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e280010, 0x0fff0e10, "tmiaph%c\t%5-8g, %0-3r, %12-15r"}, + {0x0e100030, 0x0f300fff, "tmovmsk%22-23w%c\t%12-15r, %16-19g"}, + {0x0e100110, 0x0ff00ff0, "tmrc%c\t%12-15r, %16-19G"}, + {0x0c500000, 0x0ff00ff0, "tmrrc%c\t%12-15r, %16-19r, %0-3g"}, + {0x0e130150, 0x0f3f0fff, "torc%22-23w%c\t%12-15r"}, + {0x0e0001c0, 0x0f300fff, "wacc%22-23w%c\t%12-15g, %16-19g"}, + {0x0e000180, 0x0f000ff0, "wadd%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000020, 0x0f800ff0, "waligni%c\t%12-15g, %16-19g, %0-3g, #%20-22d"}, + {0x0e800020, 0x0fc00ff0, "walignr%20-21d%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e200000, 0x0fe00ff0, "wand%20'n%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e800000, 0x0fa00ff0, "wavg2%22?hb%20'r%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000060, 0x0f300ff0, "wcmpeq%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100060, 0x0f100ff0, "wcmpgt%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0xfc100100, 0xfe500f00, "wldrw\t%12-15G, %A"}, + {0x0c100000, 0x0e100e00, "wldr%L%c\t%12-15g, %l"}, + {0x0e400100, 0x0fc00ff0, "wmac%21?su%20'z%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e800100, 0x0fd00ff0, "wmadd%21?su%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000160, 0x0f100ff0, "wmax%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100160, 0x0f100ff0, "wmin%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000100, 0x0fc00ff0, "wmul%21?su%20?ml%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000000, 0x0ff00ff0, "wor%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000080, 0x0f000ff0, "wpack%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e300040, 0x0f300ff0, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e300148, 0x0f300ffc, "wror%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e000120, 0x0fa00ff0, "wsad%22?hb%20'z%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e0001e0, 0x0f000ff0, "wshufh%c\t%12-15g, %16-19g, #%Z"}, + {0x0e100040, 0x0f300ff0, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100148, 0x0f300ffc, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e000040, 0x0f300ff0, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e000148, 0x0f300ffc, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0x0e200040, 0x0f300ff0, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e200148, 0x0f300ffc, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"}, + {0xfc000100, 0xfe500f00, "wstrw\t%12-15G, %A"}, + {0x0c000000, 0x0e100e00, "wstr%L%c\t%12-15g, %l"}, + {0x0e0001a0, 0x0f000ff0, "wsub%20-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e0000c0, 0x0f100fff, "wunpckeh%21?su%22-23w%c\t%12-15g, %16-19g"}, + {0x0e0000e0, 0x0f100fff, "wunpckel%21?su%22-23w%c\t%12-15g, %16-19g"}, + {0x0e1000c0, 0x0f300ff0, "wunpckih%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e1000e0, 0x0f300ff0, "wunpckil%22-23w%c\t%12-15g, %16-19g, %0-3g"}, + {0x0e100000, 0x0ff00ff0, "wxor%c\t%12-15g, %16-19g, %0-3g"}, + /* V5 Instructions. */ {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, {0xfa000000, 0xfe000000, "blx\t%B"}, diff --git a/opcodes/configure b/opcodes/configure index 171fadd..be6e1b8 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -57,6 +57,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -171,6 +172,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -341,6 +343,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -506,12 +513,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -550,12 +561,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:554: checking for Cygwin environment" >&5 +echo "configure:565: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 559 "configure" +#line 570 "configure" #include "confdefs.h" int main() { @@ -566,7 +577,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -583,19 +594,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:587: checking for mingw32 environment" >&5 +echo "configure:598: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 592 "configure" +#line 603 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -660,7 +671,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:664: checking host system type" >&5 +echo "configure:675: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -681,7 +692,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:685: checking target system type" >&5 +echo "configure:696: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -699,7 +710,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:703: checking build system type" >&5 +echo "configure:714: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -724,7 +735,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:728: checking for $ac_word" >&5 +echo "configure:739: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -754,7 +765,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:758: checking for $ac_word" >&5 +echo "configure:769: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -805,7 +816,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:809: checking for $ac_word" >&5 +echo "configure:820: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -837,7 +848,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -848,12 +859,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 852 "configure" +#line 863 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -879,12 +890,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:888: checking whether we are using GNU C" >&5 +echo "configure:899: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -893,7 +904,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -912,7 +923,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:916: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:927: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -944,7 +955,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:948: checking for POSIXized ISC" >&5 +echo "configure:959: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -982,7 +993,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:986: checking for a BSD compatible install" >&5 +echo "configure:997: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1035,7 +1046,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1039: checking whether build environment is sane" >&5 +echo "configure:1050: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1092,7 +1103,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1096: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1107: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1138,7 +1149,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1142: checking for working aclocal" >&5 +echo "configure:1153: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1151,7 +1162,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1155: checking for working autoconf" >&5 +echo "configure:1166: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1164,7 +1175,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1168: checking for working automake" >&5 +echo "configure:1179: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1177,7 +1188,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1181: checking for working autoheader" >&5 +echo "configure:1192: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1190,7 +1201,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1194: checking for working makeinfo" >&5 +echo "configure:1205: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1213,7 +1224,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1217: checking for $ac_word" >&5 +echo "configure:1228: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1245,7 +1256,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1249: checking for $ac_word" >&5 +echo "configure:1260: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1277,7 +1288,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1281: checking for $ac_word" >&5 +echo "configure:1292: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1392,7 +1403,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1396: checking for ld used by GCC" >&5 +echo "configure:1407: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1422,10 +1433,10 @@ echo "configure:1396: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1426: checking for GNU ld" >&5 +echo "configure:1437: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1429: checking for non-GNU ld" >&5 +echo "configure:1440: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1460,7 +1471,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1464: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1475: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1477,7 +1488,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1481: checking for $LD option to reload object files" >&5 +echo "configure:1492: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1489,7 +1500,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1493: checking for BSD-compatible nm" >&5 +echo "configure:1504: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1527,7 +1538,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1531: checking whether ln -s works" >&5 +echo "configure:1542: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1548,7 +1559,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1552: checking how to recognise dependant libraries" >&5 +echo "configure:1563: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1721,13 +1732,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1725: checking for object suffix" >&5 +echo "configure:1736: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1742: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1747,7 +1758,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1751: checking for executable suffix" >&5 +echo "configure:1762: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1757,10 +1768,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1784,7 +1795,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1788: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1799: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1846,7 +1857,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1850: checking for file" >&5 +echo "configure:1861: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1917,7 +1928,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1921: checking for $ac_word" >&5 +echo "configure:1932: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1949,7 +1960,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1964: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1984,7 +1995,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1988: checking for $ac_word" >&5 +echo "configure:1999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2016,7 +2027,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2020: checking for $ac_word" >&5 +echo "configure:2031: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2083,8 +2094,21 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2087 "configure"' > conftest.$ac_ext - if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2098 "configure"' > conftest.$ac_ext + if { (eval echo configure:2099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2096,6 +2120,7 @@ case $host in LD="${LD-ld} -64" ;; esac + fi fi rm -rf conftest* ;; @@ -2103,7 +2128,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2121,7 +2146,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2125: checking whether the C compiler needs -belf" >&5 +echo "configure:2150: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2134,14 +2159,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 2138 "configure" +#line 2163 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2309,7 +2334,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2313: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2338: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2332,7 +2357,7 @@ fi echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2336: checking whether to install libbfd" >&5 +echo "configure:2361: checking whether to install libbfd" >&5 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2369,7 +2394,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2373: checking for executable suffix" >&5 +echo "configure:2398: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2379,10 +2404,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2405,7 +2430,7 @@ ac_exeext=$EXEEXT # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2409: checking for $ac_word" >&5 +echo "configure:2434: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2435,7 +2460,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2439: checking for $ac_word" >&5 +echo "configure:2464: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2486,7 +2511,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2490: checking for $ac_word" >&5 +echo "configure:2515: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2518,7 +2543,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2522: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2547: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2529,12 +2554,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2533 "configure" +#line 2558 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2560,12 +2585,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2564: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2589: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2569: checking whether we are using GNU C" >&5 +echo "configure:2594: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2574,7 +2599,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2603: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2593,7 +2618,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2597: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2622: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2627,7 +2652,7 @@ fi ALL_LINGUAS="fr sv tr es da de id pt_BR" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2631: checking how to run the C preprocessor" >&5 +echo "configure:2656: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2642,13 +2667,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2646 "configure" +#line 2671 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2659,13 +2684,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2663 "configure" +#line 2688 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2694: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2676,13 +2701,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2680 "configure" +#line 2705 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2709,7 +2734,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2713: checking for $ac_word" >&5 +echo "configure:2738: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2737,12 +2762,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2741: checking for ANSI C header files" >&5 +echo "configure:2766: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2746 "configure" +#line 2771 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2750,7 +2775,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2779: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2767,7 +2792,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2771 "configure" +#line 2796 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2785,7 +2810,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2789 "configure" +#line 2814 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2806,7 +2831,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2810 "configure" +#line 2835 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2817,7 +2842,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2841,12 +2866,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2845: checking for working const" >&5 +echo "configure:2870: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2850 "configure" +#line 2875 "configure" #include "confdefs.h" int main() { @@ -2895,7 +2920,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2916,21 +2941,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2920: checking for inline" >&5 +echo "configure:2945: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2927 "configure" +#line 2952 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2956,12 +2981,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2960: checking for off_t" >&5 +echo "configure:2985: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2965 "configure" +#line 2990 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2989,12 +3014,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2993: checking for size_t" >&5 +echo "configure:3018: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2998 "configure" +#line 3023 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3024,19 +3049,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3028: checking for working alloca.h" >&5 +echo "configure:3053: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3033 "configure" +#line 3058 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3057,12 +3082,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3061: checking for alloca" >&5 +echo "configure:3086: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3066 "configure" +#line 3091 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3090,7 +3115,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3122,12 +3147,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3126: checking whether alloca needs Cray hooks" >&5 +echo "configure:3151: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3131 "configure" +#line 3156 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3152,12 +3177,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3156: checking for $ac_func" >&5 +echo "configure:3181: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3161 "configure" +#line 3186 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3180,7 +3205,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3207,7 +3232,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3211: checking stack direction for C alloca" >&5 +echo "configure:3236: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3215,7 +3240,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3219 "configure" +#line 3244 "configure" #include "confdefs.h" find_stack_direction () { @@ -3234,7 +3259,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3255,21 +3280,21 @@ EOF fi -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3263: checking for $ac_hdr" >&5 +echo "configure:3288: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3268 "configure" +#line 3293 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3298,12 +3323,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3302: checking for $ac_func" >&5 +echo "configure:3327: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3307 "configure" +#line 3332 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3326,7 +3351,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3351,7 +3376,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3355: checking for working mmap" >&5 +echo "configure:3380: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3359,7 +3384,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3363 "configure" +#line 3388 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3387,24 +3412,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3512,7 +3524,7 @@ main() } EOF -if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3540,17 +3552,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3544: checking for $ac_hdr" >&5 +echo "configure:3556: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3549 "configure" +#line 3561 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3580,12 +3592,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3584: checking for $ac_func" >&5 +echo "configure:3596: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3589 "configure" +#line 3601 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3608,7 +3620,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3637,12 +3649,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3641: checking for $ac_func" >&5 +echo "configure:3653: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3646 "configure" +#line 3658 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3665,7 +3677,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3699,19 +3711,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3703: checking for LC_MESSAGES" >&5 +echo "configure:3715: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3708 "configure" +#line 3720 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3732,7 +3744,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3736: checking whether NLS is requested" >&5 +echo "configure:3748: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3752,7 +3764,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3756: checking whether included gettext is requested" >&5 +echo "configure:3768: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3771,17 +3783,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3775: checking for libintl.h" >&5 +echo "configure:3787: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3780 "configure" +#line 3792 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3798,19 +3810,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3802: checking for gettext in libc" >&5 +echo "configure:3814: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3807 "configure" +#line 3819 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3826,7 +3838,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3830: checking for bindtextdomain in -lintl" >&5 +echo "configure:3842: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3834,7 +3846,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3838 "configure" +#line 3850 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3845,7 +3857,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3861,19 +3873,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3865: checking for gettext in libintl" >&5 +echo "configure:3877: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3870 "configure" +#line 3882 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3901,7 +3913,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3905: checking for $ac_word" >&5 +echo "configure:3917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3935,12 +3947,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3939: checking for $ac_func" >&5 +echo "configure:3951: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3944 "configure" +#line 3956 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3963,7 +3975,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3990,7 +4002,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3994: checking for $ac_word" >&5 +echo "configure:4006: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4026,7 +4038,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4030: checking for $ac_word" >&5 +echo "configure:4042: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4058,7 +4070,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4062 "configure" +#line 4074 "configure" #include "confdefs.h" int main() { @@ -4066,7 +4078,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4098,7 +4110,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4102: checking for $ac_word" >&5 +echo "configure:4114: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4132,7 +4144,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4136: checking for $ac_word" >&5 +echo "configure:4148: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4168,7 +4180,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4172: checking for $ac_word" >&5 +echo "configure:4184: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4258,7 +4270,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4262: checking for catalogs to be installed" >&5 +echo "configure:4274: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4286,17 +4298,17 @@ echo "configure:4262: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4290: checking for linux/version.h" >&5 +echo "configure:4302: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4295 "configure" +#line 4307 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4300: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4374,7 +4386,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4378: checking for build system executable suffix" >&5 +echo "configure:4390: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4411,7 +4423,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4415: checking for a BSD compatible install" >&5 +echo "configure:4427: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4468,17 +4480,17 @@ for ac_hdr in string.h strings.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4472: checking for $ac_hdr" >&5 +echo "configure:4484: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4477 "configure" +#line 4489 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4666,6 +4678,7 @@ if test x${all_targets} = xfalse ; then bfd_w65_arch) ta="$ta w65-dis.lo" ;; bfd_we32k_arch) ;; bfd_xstormy16_arch) ta="$ta xstormy16-asm.lo xstormy16-desc.lo xstormy16-dis.lo xstormy16-ibld.lo xstormy16-opc.lo" using_cgen=yes ;; + bfd_xtensa_arch) ta="$ta xtensa-dis.lo" ;; bfd_z8k_arch) ta="$ta z8k-dis.lo" ;; bfd_frv_arch) ta="$ta frv-asm.lo frv-desc.lo frv-dis.lo frv-ibld.lo frv-opc.lo" using_cgen=yes ;; diff --git a/opcodes/configure.in b/opcodes/configure.in index 6e74b15..e4014f1 100644 --- a/opcodes/configure.in +++ b/opcodes/configure.in @@ -241,6 +241,7 @@ if test x${all_targets} = xfalse ; then bfd_w65_arch) ta="$ta w65-dis.lo" ;; bfd_we32k_arch) ;; bfd_xstormy16_arch) ta="$ta xstormy16-asm.lo xstormy16-desc.lo xstormy16-dis.lo xstormy16-ibld.lo xstormy16-opc.lo" using_cgen=yes ;; + bfd_xtensa_arch) ta="$ta xtensa-dis.lo" ;; bfd_z8k_arch) ta="$ta z8k-dis.lo" ;; bfd_frv_arch) ta="$ta frv-asm.lo frv-desc.lo frv-dis.lo frv-ibld.lo frv-opc.lo" using_cgen=yes ;; diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 7e6ba0b..1408f39 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -68,6 +68,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ARCH_vax #define ARCH_w65 #define ARCH_xstormy16 +#define ARCH_xtensa #define ARCH_z8k #define ARCH_frv #define ARCH_iq2000 @@ -343,6 +344,11 @@ disassembler (abfd) disassemble = print_insn_xstormy16; break; #endif +#ifdef ARCH_xtensa + case bfd_arch_xtensa: + disassemble = print_insn_xtensa; + break; +#endif #ifdef ARCH_z8k case bfd_arch_z8k: if (bfd_get_mach(abfd) == bfd_mach_z8001) diff --git a/opcodes/h8500-opc.h b/opcodes/h8500-opc.h index b2c8617..a88464a 100644 --- a/opcodes/h8500-opc.h +++ b/opcodes/h8500-opc.h @@ -1,24 +1,22 @@ -/* Instruction opcode header for Hitachi 8500. +/* Instruction opcode header for Renesas 8500. -Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2003 Free Software Foundation, Inc. -This file is part of the GNU Binutils and/or GDB, the GNU debugger. + This file is part of the GNU Binutils and/or GDB, the GNU debugger. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ typedef enum { @@ -27,6 +25,7 @@ typedef enum GCCR, GPC, GSEGC, GSEGD, GSEGE, GSEGT,GLAST } gdbreg_type; + #define O_XORC 1 #define O_XOR 2 #define O_XCH 3 diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index f185b28..79faee6 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -736,7 +736,7 @@ static const struct dis386 dis386[] = { { "outS", indirDX, eAX, XX }, /* f0 */ { "(bad)", XX, XX, XX }, /* lock prefix */ - { "(bad)", XX, XX, XX }, + { "icebp", XX, XX, XX }, { "(bad)", XX, XX, XX }, /* repne */ { "(bad)", XX, XX, XX }, /* repz */ { "hlt", XX, XX, XX }, diff --git a/opcodes/ia64-asmtab.c b/opcodes/ia64-asmtab.c index a8aa976..2465d39 100644 --- a/opcodes/ia64-asmtab.c +++ b/opcodes/ia64-asmtab.c @@ -1544,30 +1544,36 @@ static const short dep235[] = { }; static const short dep236[] = { - 40, 41, 75, 96, 134, 148, 174, 267, 2165, 2166, 2169, 2172, 4135, + 0, 40, 41, 75, 76, 81, 83, 96, 110, 127, 128, 130, 131, 134, 135, 136, 138, + 139, 146, 163, 174, 178, 181, 267, 274, 2134, 2135, 2136, 2137, 2138, 2139, + 2165, 2166, 2169, 2172, 4135, 16524, 16526, 20613, }; static const short dep237[] = { + 40, 41, 75, 96, 134, 148, 174, 267, 2165, 2166, 2169, 2172, 4135, +}; + +static const short dep238[] = { 40, 41, 75, 96, 134, 135, 139, 148, 174, 267, 2165, 2166, 2169, 2172, 4135, }; -static const short dep238[] = { +static const short dep239[] = { 40, 41, 75, 96, 134, 148, 174, 267, 2137, 2138, 2139, 2165, 2166, 2169, 2172, 2312, 4135, 20613, }; -static const short dep239[] = { +static const short dep240[] = { 40, 41, 75, 96, 134, 135, 139, 148, 174, 267, 2137, 2138, 2139, 2165, 2166, 2169, 2172, 2312, 4135, 20613, }; -static const short dep240[] = { +static const short dep241[] = { 40, 41, 96, 174, 267, 2137, 2138, 2139, 2165, 2166, 2169, 2172, 2310, 4135, 16524, 16526, 18746, 18748, 18749, 18751, 20613, }; -static const short dep241[] = { +static const short dep242[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 28, 29, 30, 31, 96, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 197, 198, 200, 201, 203, 204, 206, 207, 208, @@ -1575,7 +1581,7 @@ static const short dep241[] = { 2312, 28852, 29002, }; -static const short dep242[] = { +static const short dep243[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 31, 40, 41, 96, 134, 171, 174, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 197, 198, 200, 201, @@ -1732,13 +1738,14 @@ op_dependencies[] = { { NELS(dep233), dep233, NELS(dep232), dep232, }, { NELS(dep234), dep234, NELS(dep232), dep232, }, { NELS(dep233), dep233, NELS(dep235), dep235, }, - { NELS(dep236), dep236, NELS(dep31), dep31, }, + { NELS(dep236), dep236, NELS(dep217), dep217, }, { NELS(dep237), dep237, NELS(dep31), dep31, }, - { NELS(dep238), dep238, NELS(dep0), dep0, }, + { NELS(dep238), dep238, NELS(dep31), dep31, }, { NELS(dep239), dep239, NELS(dep0), dep0, }, - { NELS(dep240), dep240, NELS(dep62), dep62, }, + { NELS(dep240), dep240, NELS(dep0), dep0, }, + { NELS(dep241), dep241, NELS(dep62), dep62, }, { 0, NULL, 0, NULL, }, - { NELS(dep242), dep242, NELS(dep241), dep241, }, + { NELS(dep243), dep243, NELS(dep242), dep242, }, }; static const struct ia64_completer_table @@ -1758,7 +1765,7 @@ completer_table[] = { { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, 455, -1, 0, 1, 6 }, { 0x0, 0x0, 0, 518, -1, 0, 1, 17 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 150 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, { 0x0, 0x0, 0, 617, -1, 0, 1, 17 }, { 0x0, 0x0, 0, 1836, -1, 0, 1, 10 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 9 }, @@ -1810,7 +1817,7 @@ completer_table[] = { { 0x0, 0x0, 0, 1181, -1, 0, 1, 33 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 40 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 33 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 150 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 77 }, { 0x0, 0x0, 0, 1216, -1, 0, 1, 124 }, { 0x0, 0x0, 0, 1225, -1, 0, 1, 124 }, @@ -1843,9 +1850,9 @@ completer_table[] = { { 0x0, 0x0, 0, 1419, -1, 0, 1, 140 }, { 0x0, 0x0, 0, 1425, -1, 0, 1, 140 }, { 0x0, 0x0, 0, 1431, -1, 0, 1, 140 }, - { 0x0, 0x0, 0, 1435, -1, 0, 1, 145 }, - { 0x0, 0x0, 0, 1439, -1, 0, 1, 147 }, - { 0x0, 0x0, 0, 1443, -1, 0, 1, 147 }, + { 0x0, 0x0, 0, 1435, -1, 0, 1, 146 }, + { 0x0, 0x0, 0, 1439, -1, 0, 1, 148 }, + { 0x0, 0x0, 0, 1443, -1, 0, 1, 148 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 79 }, { 0x0, 0x0, 0, 253, -1, 0, 1, 40 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, @@ -1880,13 +1887,13 @@ completer_table[] = { { 0x0, 0x0, 0, -1, -1, 0, 1, 111 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 112 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 113 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 152 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 152 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 152 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 71 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, - { 0x0, 0x0, 0, -1, -1, 0, 1, 150 }, + { 0x0, 0x0, 0, -1, -1, 0, 1, 151 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, 2394, -1, 0, 1, 0 }, @@ -1934,14 +1941,14 @@ completer_table[] = { { 0x0, 0x0, 0, 1723, -1, 0, 1, 138 }, { 0x0, 0x0, 0, 1726, -1, 0, 1, 131 }, { 0x0, 0x0, 0, 1729, -1, 0, 1, 138 }, - { 0x0, 0x0, 0, 1732, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1733, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1734, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1735, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1736, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1737, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1738, -1, 0, 1, 131 }, - { 0x0, 0x0, 0, 1739, -1, 0, 1, 131 }, + { 0x0, 0x0, 0, 1732, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1733, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1734, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1735, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1736, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1737, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1738, -1, 0, 1, 145 }, + { 0x0, 0x0, 0, 1739, -1, 0, 1, 145 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, { 0x0, 0x0, 0, -1, -1, 0, 1, 0 }, @@ -2453,7 +2460,7 @@ completer_table[] = { { 0x0, 0x0, 38, 960, -1, 0, 1, 95 }, { 0x0, 0x0, 38, -1, -1, 0, 1, 104 }, { 0x0, 0x0, 38, 966, -1, 0, 1, 116 }, - { 0x3, 0x3, 38, -1, -1, 30, 1, 149 }, + { 0x3, 0x3, 38, -1, -1, 30, 1, 150 }, { 0x0, 0x0, 38, 967, -1, 0, 1, 40 }, { 0x0, 0x0, 40, -1, 825, 0, 0, -1 }, { 0x0, 0x0, 40, -1, 833, 0, 0, -1 }, @@ -2546,21 +2553,21 @@ completer_table[] = { { 0x0, 0x0, 44, 942, -1, 0, 1, 0 }, { 0x0, 0x0, 44, 943, -1, 0, 1, 0 }, { 0x0, 0x0, 44, 944, -1, 0, 1, 0 }, - { 0x1, 0x1, 45, -1, 1433, 30, 1, 146 }, - { 0x1, 0x1, 45, 815, 1432, 30, 1, 145 }, - { 0x1, 0x1, 45, -1, 1437, 30, 1, 148 }, - { 0x1, 0x1, 45, 816, 1436, 30, 1, 147 }, - { 0x1, 0x1, 45, -1, 1441, 30, 1, 148 }, - { 0x1, 0x1, 45, 817, 1440, 30, 1, 147 }, + { 0x1, 0x1, 45, -1, 1433, 30, 1, 147 }, + { 0x1, 0x1, 45, 815, 1432, 30, 1, 146 }, + { 0x1, 0x1, 45, -1, 1437, 30, 1, 149 }, + { 0x1, 0x1, 45, 816, 1436, 30, 1, 148 }, + { 0x1, 0x1, 45, -1, 1441, 30, 1, 149 }, + { 0x1, 0x1, 45, 817, 1440, 30, 1, 148 }, { 0x3, 0x3, 46, -1, 978, 3, 1, 22 }, { 0x1, 0x1, 47, 1889, -1, 30, 1, 137 }, - { 0x1, 0x1, 47, 1920, -1, 30, 1, 149 }, + { 0x1, 0x1, 47, 1920, -1, 30, 1, 150 }, { 0x0, 0x0, 49, -1, -1, 0, 1, 40 }, { 0x0, 0x0, 49, -1, -1, 0, 1, 40 }, { 0x0, 0x0, 49, -1, -1, 0, 1, 40 }, - { 0x1, 0x1, 56, -1, 1434, 31, 1, 146 }, - { 0x1, 0x1, 56, -1, 1438, 31, 1, 148 }, - { 0x1, 0x1, 56, -1, 1442, 31, 1, 148 }, + { 0x1, 0x1, 56, -1, 1434, 31, 1, 147 }, + { 0x1, 0x1, 56, -1, 1438, 31, 1, 149 }, + { 0x1, 0x1, 56, -1, 1442, 31, 1, 149 }, { 0x0, 0x0, 56, -1, -1, 0, 1, 94 }, { 0x2, 0x3, 56, -1, -1, 27, 1, 94 }, { 0x1, 0x1, 56, -1, -1, 28, 1, 94 }, @@ -3175,34 +3182,34 @@ completer_table[] = { { 0x1, 0x1, 171, 1695, -1, 28, 1, 144 }, { 0x1, 0x1, 171, 1696, -1, 28, 1, 144 }, { 0x1, 0x1, 171, 1697, -1, 28, 1, 140 }, - { 0x1, 0x1, 171, 1448, -1, 28, 1, 145 }, - { 0x1, 0x1, 171, 1449, -1, 28, 1, 146 }, - { 0x1, 0x1, 171, 1450, -1, 28, 1, 146 }, - { 0x1, 0x1, 171, 1451, -1, 28, 1, 145 }, - { 0x1, 0x1, 171, 1452, -1, 28, 1, 147 }, - { 0x1, 0x1, 171, 1453, -1, 28, 1, 148 }, - { 0x1, 0x1, 171, 1454, -1, 28, 1, 148 }, - { 0x1, 0x1, 171, 1455, -1, 28, 1, 147 }, - { 0x1, 0x1, 171, 1456, -1, 28, 1, 147 }, - { 0x1, 0x1, 171, 1457, -1, 28, 1, 148 }, - { 0x1, 0x1, 171, 1458, -1, 28, 1, 148 }, - { 0x1, 0x1, 171, 1459, -1, 28, 1, 147 }, + { 0x1, 0x1, 171, 1448, -1, 28, 1, 146 }, + { 0x1, 0x1, 171, 1449, -1, 28, 1, 147 }, + { 0x1, 0x1, 171, 1450, -1, 28, 1, 147 }, + { 0x1, 0x1, 171, 1451, -1, 28, 1, 146 }, + { 0x1, 0x1, 171, 1452, -1, 28, 1, 148 }, + { 0x1, 0x1, 171, 1453, -1, 28, 1, 149 }, + { 0x1, 0x1, 171, 1454, -1, 28, 1, 149 }, + { 0x1, 0x1, 171, 1455, -1, 28, 1, 148 }, + { 0x1, 0x1, 171, 1456, -1, 28, 1, 148 }, + { 0x1, 0x1, 171, 1457, -1, 28, 1, 149 }, + { 0x1, 0x1, 171, 1458, -1, 28, 1, 149 }, + { 0x1, 0x1, 171, 1459, -1, 28, 1, 148 }, { 0x1, 0x1, 171, 1740, -1, 28, 1, 136 }, { 0x1, 0x1, 171, 1741, -1, 28, 1, 136 }, { 0x1, 0x1, 171, 1742, -1, 28, 1, 136 }, { 0x1, 0x1, 171, 1743, -1, 28, 1, 136 }, - { 0x1, 0x1, 172, 1698, -1, 29, 1, 145 }, - { 0x1, 0x1, 172, 1699, -1, 29, 1, 146 }, - { 0x1, 0x1, 172, 1700, -1, 29, 1, 146 }, - { 0x1, 0x1, 172, 1701, -1, 29, 1, 145 }, - { 0x1, 0x1, 172, 1702, -1, 29, 1, 147 }, - { 0x1, 0x1, 172, 1703, -1, 29, 1, 148 }, - { 0x1, 0x1, 172, 1704, -1, 29, 1, 148 }, - { 0x1, 0x1, 172, 1705, -1, 29, 1, 147 }, - { 0x1, 0x1, 172, 1706, -1, 29, 1, 147 }, - { 0x1, 0x1, 172, 1707, -1, 29, 1, 148 }, - { 0x1, 0x1, 172, 1708, -1, 29, 1, 148 }, - { 0x1, 0x1, 172, 1709, -1, 29, 1, 147 }, + { 0x1, 0x1, 172, 1698, -1, 29, 1, 146 }, + { 0x1, 0x1, 172, 1699, -1, 29, 1, 147 }, + { 0x1, 0x1, 172, 1700, -1, 29, 1, 147 }, + { 0x1, 0x1, 172, 1701, -1, 29, 1, 146 }, + { 0x1, 0x1, 172, 1702, -1, 29, 1, 148 }, + { 0x1, 0x1, 172, 1703, -1, 29, 1, 149 }, + { 0x1, 0x1, 172, 1704, -1, 29, 1, 149 }, + { 0x1, 0x1, 172, 1705, -1, 29, 1, 148 }, + { 0x1, 0x1, 172, 1706, -1, 29, 1, 148 }, + { 0x1, 0x1, 172, 1707, -1, 29, 1, 149 }, + { 0x1, 0x1, 172, 1708, -1, 29, 1, 149 }, + { 0x1, 0x1, 172, 1709, -1, 29, 1, 148 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 135 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 135 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 134 }, @@ -3441,18 +3448,18 @@ completer_table[] = { { 0x3, 0x3, 173, -1, -1, 28, 1, 144 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 144 }, { 0x3, 0x3, 173, 1919, -1, 28, 1, 140 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 146 }, - { 0x3, 0x3, 173, 803, -1, 28, 1, 146 }, - { 0x3, 0x3, 173, 804, -1, 28, 1, 145 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 147 }, + { 0x3, 0x3, 173, 803, -1, 28, 1, 147 }, + { 0x3, 0x3, 173, 804, -1, 28, 1, 146 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 148 }, - { 0x3, 0x3, 173, 805, -1, 28, 1, 148 }, - { 0x3, 0x3, 173, 806, -1, 28, 1, 147 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 147 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 149 }, + { 0x3, 0x3, 173, 805, -1, 28, 1, 149 }, + { 0x3, 0x3, 173, 806, -1, 28, 1, 148 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 148 }, - { 0x3, 0x3, 173, 807, -1, 28, 1, 148 }, - { 0x3, 0x3, 173, 808, -1, 28, 1, 147 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 149 }, + { 0x3, 0x3, 173, 807, -1, 28, 1, 149 }, + { 0x3, 0x3, 173, 808, -1, 28, 1, 148 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, { 0x3, 0x3, 173, 1857, -1, 28, 1, 131 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 138 }, @@ -3473,16 +3480,16 @@ completer_table[] = { { 0x3, 0x3, 173, -1, -1, 28, 1, 138 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 139 }, { 0x3, 0x3, 173, 1865, -1, 28, 1, 138 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, - { 0x3, 0x3, 173, -1, -1, 28, 1, 131 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, + { 0x3, 0x3, 173, -1, -1, 28, 1, 145 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 136 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 136 }, { 0x3, 0x3, 173, -1, -1, 28, 1, 136 }, @@ -3663,7 +3670,7 @@ completer_table[] = { { 0x1, 0x1, 219, 250, 1414, 32, 1, 141 }, { 0x1, 0x1, 219, 251, 1420, 32, 1, 141 }, { 0x1, 0x1, 219, 252, 1426, 32, 1, 141 }, - { 0x1, 0x1, 219, 710, -1, 31, 1, 149 }, + { 0x1, 0x1, 219, 710, -1, 31, 1, 150 }, { 0x0, 0x0, 220, 2012, -1, 0, 1, 65 }, { 0x0, 0x0, 220, 2013, -1, 0, 1, 28 }, { 0x0, 0x0, 220, 24, -1, 0, 1, 28 }, @@ -4061,11 +4068,11 @@ completer_table[] = { { 0x1, 0x1, 225, -1, -1, 28, 1, 33 }, { 0x1, 0x1, 225, -1, -1, 28, 1, 33 }, { 0x0, 0x0, 232, 810, -1, 0, 1, 137 }, - { 0x0, 0x0, 232, 811, -1, 0, 1, 149 }, + { 0x0, 0x0, 232, 811, -1, 0, 1, 150 }, { 0x1, 0x1, 233, -1, 1725, 33, 1, 133 }, { 0x1, 0x1, 233, -1, 1728, 33, 1, 139 }, - { 0x0, 0x0, 233, -1, 1730, 0, 1, 131 }, - { 0x0, 0x0, 233, -1, 1731, 0, 1, 131 }, + { 0x0, 0x0, 233, -1, 1730, 0, 1, 145 }, + { 0x0, 0x0, 233, -1, 1731, 0, 1, 145 }, { 0x0, 0x0, 234, 744, 823, 0, 0, -1 }, { 0x0, 0x0, 234, 745, 831, 0, 0, -1 }, { 0x0, 0x0, 234, 746, 827, 0, 0, -1 }, diff --git a/opcodes/ia64-ic.tbl b/opcodes/ia64-ic.tbl index 3eab2eb..45e3bd5 100644 --- a/opcodes/ia64-ic.tbl +++ b/opcodes/ia64-ic.tbl @@ -20,7 +20,7 @@ fpcmp-s0; fpcmp[Field(sf)==s0] fpcmp-s1; fpcmp[Field(sf)==s1] fpcmp-s2; fpcmp[Field(sf)==s2] fpcmp-s3; fpcmp[Field(sf)==s3] -fr-readers; IC:fp-arith, IC:fp-non-arith, IC:pr-writers-fp, chk.s[Format in {M21}], getf +fr-readers; IC:fp-arith, IC:fp-non-arith, IC:pr-writers-fp, chk.s[Format in {M21}], getf, IC:mem-writers-fp fr-writers; IC:fp-arith, IC:fp-non-arith\fclass, IC:mem-readers-fp, setf gr-readers; IC:gr-readers-writers, IC:mem-readers, IC:mem-writers, chk.s, cmp, cmp4, fc, itc.i, itc.d, itr.i, itr.d, IC:mov-to-AR-gr, IC:mov-to-BR, IC:mov-to-CR, IC:mov-to-IND, IC:mov-from-IND, IC:mov-to-PR-allreg, IC:mov-to-PSR-l, IC:mov-to-PSR-um, IC:probe-all, ptc.e, ptc.g, ptc.ga, ptc.l, ptr.i, ptr.d, setf, tbit, tnat gr-readers-writers; IC:mov-from-IND, add, addl, addp4, adds, and, andcm, IC:czx, dep\dep[Format in {I13}], extr, IC:mem-readers-int, IC:ld-all-postinc, IC:lfetch-postinc, IC:mix, IC:mux, or, IC:pack, IC:padd, IC:pavg, IC:pavgsub, IC:pcmp, IC:pmax, IC:pmin, IC:pmpy, IC:pmpyshr, popcnt, IC:probe-nofault, IC:psad, IC:pshl, IC:pshladd, IC:pshr, IC:pshradd, IC:psub, shl, shladd, shladdp4, shr, shrp, IC:st-postinc, sub, IC:sxt, tak, thash, tpa, ttag, IC:unpack, xor, IC:zxt diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index 1b62f87..27eb23e 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -1,24 +1,24 @@ /* ppc-opc.c -- PowerPC opcode list - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support -This file is part of GDB, GAS, and the GNU binutils. + This file is part of GDB, GAS, and the GNU binutils. -GDB, GAS, and the GNU binutils are free software; you can redistribute -them and/or modify them under the terms of the GNU General Public -License as published by the Free Software Foundation; either version -2, or (at your option) any later version. + GDB, GAS, and the GNU binutils are free software; you can redistribute + them and/or modify them under the terms of the GNU General Public + License as published by the Free Software Foundation; either version + 2, or (at your option) any later version. -GDB, GAS, and the GNU binutils are distributed in the hope that they -will be useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. + GDB, GAS, and the GNU binutils are distributed in the hope that they + will be useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this file; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this file; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ #include <stdio.h> #include "sysdep.h" @@ -497,52 +497,52 @@ const struct powerpc_operand powerpc_operands[] = #define UI U + 1 { 16, 0, 0, 0, 0 }, - /* The VA field in a VA, VX or VXR form instruction. */ + /* The VA field in a VA, VX or VXR form instruction. */ #define VA UI + 1 #define VA_MASK (0x1f << 16) { 5, 16, 0, 0, PPC_OPERAND_VR }, - /* The VB field in a VA, VX or VXR form instruction. */ + /* The VB field in a VA, VX or VXR form instruction. */ #define VB VA + 1 #define VB_MASK (0x1f << 11) { 5, 11, 0, 0, PPC_OPERAND_VR }, - /* The VC field in a VA form instruction. */ + /* The VC field in a VA form instruction. */ #define VC VB + 1 #define VC_MASK (0x1f << 6) { 5, 6, 0, 0, PPC_OPERAND_VR }, - /* The VD or VS field in a VA, VX, VXR or X form instruction. */ + /* The VD or VS field in a VA, VX, VXR or X form instruction. */ #define VD VC + 1 #define VS VD #define VD_MASK (0x1f << 21) { 5, 21, 0, 0, PPC_OPERAND_VR }, - /* The SIMM field in a VX form instruction. */ + /* The SIMM field in a VX form instruction. */ #define SIMM VD + 1 { 5, 16, 0, 0, PPC_OPERAND_SIGNED}, - /* The UIMM field in a VX form instruction. */ + /* The UIMM field in a VX form instruction. */ #define UIMM SIMM + 1 { 5, 16, 0, 0, 0 }, - /* The SHB field in a VA form instruction. */ + /* The SHB field in a VA form instruction. */ #define SHB UIMM + 1 { 4, 6, 0, 0, 0 }, - /* The other UIMM field in a EVX form instruction. */ + /* The other UIMM field in a EVX form instruction. */ #define EVUIMM SHB + 1 { 5, 11, 0, 0, 0 }, - /* The other UIMM field in a half word EVX form instruction. */ + /* The other UIMM field in a half word EVX form instruction. */ #define EVUIMM_2 EVUIMM + 1 { 32, 11, insert_ev2, extract_ev2, PPC_OPERAND_PARENS }, - /* The other UIMM field in a word EVX form instruction. */ + /* The other UIMM field in a word EVX form instruction. */ #define EVUIMM_4 EVUIMM_2 + 1 { 32, 11, insert_ev4, extract_ev4, PPC_OPERAND_PARENS }, - /* The other UIMM field in a double EVX form instruction. */ + /* The other UIMM field in a double EVX form instruction. */ #define EVUIMM_8 EVUIMM_4 + 1 { 32, 11, insert_ev8, extract_ev8, PPC_OPERAND_PARENS }, @@ -1499,22 +1499,22 @@ extract_tbr (insn, dialect, invalid) #define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1)) #define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1) -/* An VX form instruction. */ +/* An VX form instruction. */ #define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff)) -/* The mask for an VX form instruction. */ +/* The mask for an VX form instruction. */ #define VX_MASK VX(0x3f, 0x7ff) -/* An VA form instruction. */ +/* An VA form instruction. */ #define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f)) -/* The mask for an VA form instruction. */ +/* The mask for an VA form instruction. */ #define VXA_MASK VXA(0x3f, 0x3f) -/* An VXR form instruction. */ +/* An VXR form instruction. */ #define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff)) -/* The mask for a VXR form instruction. */ +/* The mask for a VXR form instruction. */ #define VXR_MASK VXR(0x3f, 0x3ff, 1) /* An X form instruction. */ @@ -1538,7 +1538,7 @@ extract_tbr (insn, dialect, invalid) /* An X_MASK with the RA and RB fields fixed. */ #define XRARB_MASK (X_MASK | RA_MASK | RB_MASK) -/* An XRARB_MASK, but with the L bit clear. */ +/* An XRARB_MASK, but with the L bit clear. */ #define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16)) /* An X_MASK with the RT and RA fields fixed. */ @@ -2349,34 +2349,34 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "cau", OP(15), OP_MASK, PWRCOM, { RT,RA,SISIGNOPT } }, { "subis", OP(15), OP_MASK, PPCCOM, { RT, RA, NSI } }, -{ "bdnz-", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdnz+", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdnz", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BD } }, -{ "bdn", BBO(16,BODNZ,0,0), BBOATBI_MASK, PWRCOM, { BD } }, -{ "bdnzl-", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdnzl+", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdnzl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BD } }, -{ "bdnl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PWRCOM, { BD } }, -{ "bdnza-", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdnza+", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdnza", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDA } }, -{ "bdna", BBO(16,BODNZ,1,0), BBOATBI_MASK, PWRCOM, { BDA } }, -{ "bdnzla-", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdnzla+", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdnzla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDA } }, -{ "bdnla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PWRCOM, { BDA } }, -{ "bdz-", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdz+", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdz", BBO(16,BODZ,0,0), BBOATBI_MASK, COM, { BD } }, -{ "bdzl-", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, -{ "bdzl+", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, -{ "bdzl", BBO(16,BODZ,0,1), BBOATBI_MASK, COM, { BD } }, -{ "bdza-", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdza+", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdza", BBO(16,BODZ,1,0), BBOATBI_MASK, COM, { BDA } }, -{ "bdzla-", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, -{ "bdzla+", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, -{ "bdzla", BBO(16,BODZ,1,1), BBOATBI_MASK, COM, { BDA } }, +{ "bdnz-", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, +{ "bdnz+", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, +{ "bdnz", BBO(16,BODNZ,0,0), BBOATBI_MASK, PPCCOM, { BD } }, +{ "bdn", BBO(16,BODNZ,0,0), BBOATBI_MASK, PWRCOM, { BD } }, +{ "bdnzl-", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, +{ "bdnzl+", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, +{ "bdnzl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PPCCOM, { BD } }, +{ "bdnl", BBO(16,BODNZ,0,1), BBOATBI_MASK, PWRCOM, { BD } }, +{ "bdnza-", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, +{ "bdnza+", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, +{ "bdnza", BBO(16,BODNZ,1,0), BBOATBI_MASK, PPCCOM, { BDA } }, +{ "bdna", BBO(16,BODNZ,1,0), BBOATBI_MASK, PWRCOM, { BDA } }, +{ "bdnzla-", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, +{ "bdnzla+", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, +{ "bdnzla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PPCCOM, { BDA } }, +{ "bdnla", BBO(16,BODNZ,1,1), BBOATBI_MASK, PWRCOM, { BDA } }, +{ "bdz-", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDM } }, +{ "bdz+", BBO(16,BODZ,0,0), BBOATBI_MASK, PPCCOM, { BDP } }, +{ "bdz", BBO(16,BODZ,0,0), BBOATBI_MASK, COM, { BD } }, +{ "bdzl-", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDM } }, +{ "bdzl+", BBO(16,BODZ,0,1), BBOATBI_MASK, PPCCOM, { BDP } }, +{ "bdzl", BBO(16,BODZ,0,1), BBOATBI_MASK, COM, { BD } }, +{ "bdza-", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDMA } }, +{ "bdza+", BBO(16,BODZ,1,0), BBOATBI_MASK, PPCCOM, { BDPA } }, +{ "bdza", BBO(16,BODZ,1,0), BBOATBI_MASK, COM, { BDA } }, +{ "bdzla-", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDMA } }, +{ "bdzla+", BBO(16,BODZ,1,1), BBOATBI_MASK, PPCCOM, { BDPA } }, +{ "bdzla", BBO(16,BODZ,1,1), BBOATBI_MASK, COM, { BDA } }, { "blt-", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDM } }, { "blt+", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM, { CR, BDP } }, { "blt", BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, COM, { CR, BD } }, @@ -2625,7 +2625,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "ba", B(18,1,0), B_MASK, COM, { LIA } }, { "bla", B(18,1,1), B_MASK, COM, { LIA } }, -{ "mcrf", XL(19,0), XLBB_MASK|(3<<21)|(3<<16), COM, { BF, BFA } }, +{ "mcrf", XL(19,0), XLBB_MASK|(3 << 21)|(3 << 16), COM, { BF, BFA } }, { "blr", XLO(19,BOU,16,0), XLBOBIBB_MASK, PPCCOM, { 0 } }, { "br", XLO(19,BOU,16,0), XLBOBIBB_MASK, PWRCOM, { 0 } }, @@ -2854,8 +2854,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "crnot", XL(19,33), XL_MASK, PPCCOM, { BT, BA, BBA } }, { "crnor", XL(19,33), XL_MASK, COM, { BT, BA, BB } }, -{ "rfmci", X(19,38), 0xffffffff, PPCRFMCI, { 0 } }, - +{ "rfmci", X(19,38), 0xffffffff, PPCRFMCI, { 0 } }, { "rfi", XL(19,50), 0xffffffff, COM, { 0 } }, { "rfci", XL(19,51), 0xffffffff, PPC403, { 0 } }, @@ -4230,6 +4229,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { { "tlbrehi", XTLB(31,946,0), XTLB_MASK, PPC403, { RT, RA } }, { "tlbrelo", XTLB(31,946,1), XTLB_MASK, PPC403, { RT, RA } }, +{ "tlbre", X(31,946), X_MASK, PPC403, { RS, RA, SH } }, { "sraiq", XRC(31,952,0), X_MASK, M601, { RA, RS, SH } }, { "sraiq.", XRC(31,952,1), X_MASK, M601, { RA, RS, SH } }, diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c index 8745a89..33121c7 100644 --- a/opcodes/s390-dis.c +++ b/opcodes/s390-dis.c @@ -57,7 +57,7 @@ init_disasm (info) current_arch_mask = 1 << S390_OPCODE_ESA; break; case bfd_mach_s390_64: - current_arch_mask = 1 << S390_OPCODE_ESAME; + current_arch_mask = 1 << S390_OPCODE_ZARCH; break; default: abort (); @@ -161,7 +161,7 @@ print_insn_s390 (memaddr, info) const unsigned char *opindex; /* Check architecture. */ - if (!(opcode->architecture & current_arch_mask)) + if (!(opcode->modes & current_arch_mask)) continue; /* Check signature of the opcode. */ if ((buffer[1] & opcode->mask[1]) != opcode->opcode[1] diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c index d79ff81..caa9993 100644 --- a/opcodes/s390-mkopc.c +++ b/opcodes/s390-mkopc.c @@ -23,21 +23,28 @@ #include <stdlib.h> #include <string.h> -/* ARCHBITS_ESA and ARCH_ESAME correspond to the bit numbers defined - by s390_opcode_arch_val in include/opcode/s390.h: - ARCHBITS_ESAONLY = (1<<S390_OPCODE_ESA) - ARCHBITS_ESA = (1<<S390_OPCODE_ESA) + (1<<S390_OPCODE_ESAME) - ARCHBITS_ESA = (1<<S390_OPCODE_ESAME). */ -#define ARCHBITS_ESAONLY 1 -#define ARCHBITS_ESA 3 -#define ARCHBITS_ESAME 2 +/* Taken from opcodes/s390.h */ +enum s390_opcode_mode_val + { + S390_OPCODE_ESA = 0, + S390_OPCODE_ZARCH + }; + +enum s390_opcode_cpu_val + { + S390_OPCODE_G5 = 0, + S390_OPCODE_G6, + S390_OPCODE_Z900 + }; struct op_struct { char opcode[16]; char mnemonic[16]; char format[16]; - int archbits; + int mode_bits; + int min_cpu; + unsigned long long sort_value; int no_nibbles; }; @@ -57,7 +64,8 @@ createTable (void) /* `insertOpcode': insert an op_struct into sorted opcode array. */ static void -insertOpcode (char *opcode, char *mnemonic, char *format, int archbits) +insertOpcode (char *opcode, char *mnemonic, char *format, + int min_cpu, int mode_bits) { char *str; unsigned long long sort_value; @@ -87,6 +95,7 @@ insertOpcode (char *opcode, char *mnemonic, char *format, int archbits) str ++; } sort_value <<= 4*(16 - ix); + sort_value += (min_cpu << 8) + mode_bits; no_nibbles = ix; for (ix = 0; ix < no_ops; ix++) if (sort_value > op_array[ix].sort_value) @@ -98,7 +107,8 @@ insertOpcode (char *opcode, char *mnemonic, char *format, int archbits) strcpy(op_array[ix].format, format); op_array[ix].sort_value = sort_value; op_array[ix].no_nibbles = no_nibbles; - op_array[ix].archbits = archbits; + op_array[ix].min_cpu = min_cpu; + op_array[ix].mode_bits = mode_bits; no_ops++; } @@ -136,7 +146,8 @@ dumpTable (void) op_array[ix].no_nibbles*4, op_array[ix].opcode); printf ("MASK_%s, INSTR_%s, ", op_array[ix].format, op_array[ix].format); - printf ("%i}", op_array[ix].archbits); + printf ("%i, ", op_array[ix].mode_bits); + printf ("%i}", op_array[ix].min_cpu); if (ix < no_ops-1) printf (",\n"); else @@ -162,24 +173,50 @@ main (void) char mnemonic[16]; char format[16]; char description[64]; - char archtag[16]; - int archbits; + char cpu_string[16]; + char modes_string[16]; + int min_cpu; + int mode_bits; + char *str; if (currentLine[0] == '#') continue; memset (opcode, 0, 8); - if (sscanf (currentLine, "%15s %15s %15s \"%[^\"]\" %15s", - opcode, mnemonic, format, description, archtag) == 5) + if (sscanf (currentLine, "%15s %15s %15s \"%[^\"]\" %15s %15s", + opcode, mnemonic, format, description, + cpu_string, modes_string) == 6) { - if (strcmp (archtag, "esaonly") == 0) - archbits = ARCHBITS_ESAONLY; - else if (strcmp (archtag, "esa") == 0) - archbits = ARCHBITS_ESA; - else if (strcmp (archtag, "esame") == 0) - archbits = ARCHBITS_ESAME; - else - archbits = 0; - insertOpcode (opcode, mnemonic, format, archbits); + if (strcmp (cpu_string, "g5") == 0) + min_cpu = S390_OPCODE_G5; + else if (strcmp (cpu_string, "g6") == 0) + min_cpu = S390_OPCODE_G6; + else if (strcmp (cpu_string, "z900") == 0) + min_cpu = S390_OPCODE_Z900; + else { + fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string); + exit (1); + } + + str = modes_string; + mode_bits = 0; + do { + if (strncmp (str, "esa", 3) == 0 + && (str[3] == 0 || str[3] == ',')) { + mode_bits |= 1 << S390_OPCODE_ESA; + str += 3; + } else if (strncmp (str, "zarch", 5) == 0 + && (str[5] == 0 || str[5] == ',')) { + mode_bits |= 1 << S390_OPCODE_ZARCH; + str += 5; + } else { + fprintf (stderr, "Couldn't parse modes string %s\n", + modes_string); + exit (1); + } + if (*str == ',') + str++; + } while (*str != 0); + insertOpcode (opcode, mnemonic, format, min_cpu, mode_bits); } else fprintf (stderr, "Couldn't scan line %s\n", currentLine); diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c index 7cd8231..a283783 100644 --- a/opcodes/s390-opc.c +++ b/opcodes/s390-opc.c @@ -293,23 +293,23 @@ const struct s390_operand s390_operands[] = const struct s390_opcode s390_opformats[] = { - { "e", OP8(0x00LL), MASK_E, INSTR_E, 3 }, - { "ri", OP8(0x00LL), MASK_RI_RI, INSTR_RI_RI, 3 }, - { "rie", OP8(0x00LL), MASK_RIE_RRP, INSTR_RIE_RRP, 3 }, - { "ril", OP8(0x00LL), MASK_RIL_RP, INSTR_RIL_RP, 3 }, - { "rr", OP8(0x00LL), MASK_RR_RR, INSTR_RR_RR, 3 }, - { "rre", OP8(0x00LL), MASK_RRE_RR, INSTR_RRE_RR, 3 }, - { "rrf", OP8(0x00LL), MASK_RRF_RURR, INSTR_RRF_RURR, 3 }, - { "rs", OP8(0x00LL), MASK_RS_RRRD, INSTR_RS_RRRD, 3 }, - { "rse", OP8(0x00LL), MASK_RSE_RRRD, INSTR_RSE_RRRD, 3 }, - { "rsi", OP8(0x00LL), MASK_RSI_RRP, INSTR_RSI_RRP, 3 }, - { "rx", OP8(0x00LL), MASK_RX_RRRD, INSTR_RX_RRRD, 3 }, - { "rxe", OP8(0x00LL), MASK_RXE_RRRD, INSTR_RXE_RRRD, 3 }, - { "rxf", OP8(0x00LL), MASK_RXF_RRRDR, INSTR_RXF_RRRDR,3 }, - { "s", OP8(0x00LL), MASK_S_RD, INSTR_S_RD, 3 }, - { "si", OP8(0x00LL), MASK_SI_URD, INSTR_SI_URD, 3 }, - { "ss", OP8(0x00LL), MASK_SS_RRRDRD, INSTR_SS_RRRDRD,3 }, - { "sse", OP8(0x00LL), MASK_SSE_RDRD, INSTR_SSE_RDRD, 3 }, + { "e", OP8(0x00LL), MASK_E, INSTR_E, 3, 0 }, + { "ri", OP8(0x00LL), MASK_RI_RI, INSTR_RI_RI, 3, 0 }, + { "rie", OP8(0x00LL), MASK_RIE_RRP, INSTR_RIE_RRP, 3, 0 }, + { "ril", OP8(0x00LL), MASK_RIL_RP, INSTR_RIL_RP, 3, 0 }, + { "rr", OP8(0x00LL), MASK_RR_RR, INSTR_RR_RR, 3, 0 }, + { "rre", OP8(0x00LL), MASK_RRE_RR, INSTR_RRE_RR, 3, 0 }, + { "rrf", OP8(0x00LL), MASK_RRF_RURR, INSTR_RRF_RURR, 3, 0 }, + { "rs", OP8(0x00LL), MASK_RS_RRRD, INSTR_RS_RRRD, 3, 0 }, + { "rse", OP8(0x00LL), MASK_RSE_RRRD, INSTR_RSE_RRRD, 3, 0 }, + { "rsi", OP8(0x00LL), MASK_RSI_RRP, INSTR_RSI_RRP, 3, 0 }, + { "rx", OP8(0x00LL), MASK_RX_RRRD, INSTR_RX_RRRD, 3, 0 }, + { "rxe", OP8(0x00LL), MASK_RXE_RRRD, INSTR_RXE_RRRD, 3, 0 }, + { "rxf", OP8(0x00LL), MASK_RXF_RRRDR, INSTR_RXF_RRRDR,3, 0 }, + { "s", OP8(0x00LL), MASK_S_RD, INSTR_S_RD, 3, 0 }, + { "si", OP8(0x00LL), MASK_SI_URD, INSTR_SI_URD, 3, 0 }, + { "ss", OP8(0x00LL), MASK_SS_RRRDRD, INSTR_SS_RRRDRD,3, 0 }, + { "sse", OP8(0x00LL), MASK_SSE_RDRD, INSTR_SSE_RDRD, 3, 0 }, }; const int s390_num_opformats = diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt index ddcf089..f0b7f83 100644 --- a/opcodes/s390-opc.txt +++ b/opcodes/s390-opc.txt @@ -1,626 +1,625 @@ # S/390 opcodes list. Use s390-mkopc to convert it into the opcode table. # Copyright 2000, 2001 Free Software Foundation, Inc. # Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). -5a a RX_RRRD "add" esa -6a ad RX_FRRD "add normalized (long)" esa -2a adr RR_FF "add normalized (long)" esa -7a ae RX_FRRD "add normalized (short)" esa -3a aer RR_FF "add normalized (short)" esa -4a ah RX_RRRD "add halfword" esa -5e al RX_RRRD "add logical" esa -1e alr RR_RR "add logical" esa -fa ap SS_LLRDRD "add decimal" esa -1a ar RR_RR "add" esa -7e au RX_FRRD "add unnormalized (short)" esa -3e aur RR_FF "add unnormalized (short)" esa -6e aw RX_FRRD "add unnormalized (long)" esa -2e awr RR_FF "add unnormalized (long)" esa -36 axr RR_FF "add normalized" esa -b240 bakr RRE_RR "branch and stack" esa -45 bal RX_RRRD "branch and link" esa -05 balr RR_RR "branch and link" esa -4d bas RX_RRRD "branch and save" esa -0d basr RR_RR "branch and save" esa -0c bassm RR_RR "branch and save and set mode" esa -47 bc RX_URRD "branch on condition" esa -07 bcr RR_UR "branch on condition" esa -46 bct RX_RRRD "branch on count" esa -06 bctr RR_RR "branch on count" esa -b258 bsg RRE_RR "branch in subspace group" esa -0b bsm RR_RR "branch and set mode" esa -86 bxh RS_RRRD "branch on index high" esa -87 bxle RS_RRRD "branch on index low or equal" esa -59 c RX_RRRD "compare" esa -69 cd RX_FRRD "compare (long)" esa -29 cdr RR_FF "compare (long)" esa -bb cds RS_RRRD "compare double and swap" esa -79 ce RX_FRRD "compare (short)" esa -39 cer RR_FF "compare (short)" esa -b21a cfc S_RD "compare and form codeword" esa -49 ch RX_RRRD "compare halfword" esa -55 cl RX_RRRD "compare logical" esa -d5 clc SS_L0RDRD "compare logical" esa -0f clcl RR_RR "compare logical long" esa -95 cli SI_URD "compare logical" esa -bd clm RS_RURD "compare logical characters under mask" esa -15 clr RR_RR "compare logical" esa -b25d clst RRE_RR "compare logical string" esa -b263 cmpsc RRE_RR "compression call" esa -f9 cp SS_LLRDRD "compare decimal" esa -b24d cpya RRE_AA "copy access" esa -19 cr RR_RR "compare" esa -ba cs RS_RRRD "compare and swap" esa -b230 csch S_00 "clear subchannel" esa -b257 cuse RRE_RR "compare until substring equal" esa -b250 csp RRE_RR "compare and swap and purge" esa -4f cvb RX_RRRD "convert to binary" esa -4e cvd RX_RRRD "convert to decimal" esa -5d d RX_RRRD "divide" esa -6d dd RX_FRRD "divide (long)" esa -2d ddr RR_FF "divide (long)" esa -7d de RX_FRRD "divide (short)" esa -3d der RR_FF "divide (short)" esa -83 diag RS_RRRD "diagnose" esa -fd dp SS_LLRDRD "divide decimal" esa -1d dr RR_RR "divide" esa -b22d dxr RRE_F0 "divide (ext.)" esa -b24f ear RRE_RA "extract access" esa -de ed SS_L0RDRD "edit" esa -df edmk SS_L0RDRD "edit and mark" esa -b226 epar RRE_R0 "extract primary ASN" esa -b249 ereg RRE_RR "extract stacked registers" esa -b227 esar RRE_R0 "extract secondary ASN" esa -b24a esta RRE_RR "extract stacked state" esa -44 ex RX_RRRD "execute" esa -24 hdr RR_FF "halve (long)" esa -34 her RR_FF "halve (short)" esa -b231 hsch S_00 "halt subchannel" esa -b224 iac RRE_R0 "insert address space control" esa -43 ic RX_RRRD "insert character" esa -bf icm RS_RURD "insert characters under mask" esa -b20b ipk S_00 "insert PSW key" esa -b222 ipm RRE_R0 "insert program mask" esa -b221 ipte RRE_RR "invalidate page table entry" esa -b229 iske RRE_RR "insert storage key extended" esa -b223 ivsk RRE_RR "insert virtual storage key" esa -58 l RX_RRRD "load" esa -41 la RX_RRRD "load address" esa -51 lae RX_RRRD "load address extended" esa -9a lam RS_AARD "load access multiple" esa -e500 lasp SSE_RDRD "load address space parameters" esa -23 lcdr RR_FF "load complement (long)" esa -33 lcer RR_FF "load complement (short)" esa -13 lcr RR_RR "load complement" esa -b7 lctl RS_CCRD "load control" esa -68 ld RX_FRRD "load (long)" esa -28 ldr RR_FF "load (long)" esa -78 le RX_FRRD "load (short)" esa -38 ler RR_FF "load (short)" esa -48 lh RX_RRRD "load halfword" esa -98 lm RS_RRRD "load multiple" esa -21 lndr RR_FF "load negative (long)" esa -31 lner RR_FF "load negative (short)" esa -11 lnr RR_RR "load negative" esa -20 lpdr RR_FF "load positive (long)" esa -30 lper RR_FF "load positive (short)" esa -10 lpr RR_RR "load positive" esa -82 lpsw S_RD "load PSW" esa -18 lr RR_RR "load" esa -b1 lra RX_RRRD "load real address" esa -25 lrdr RR_FF "load rounded (ext. to long)" esa -35 lrer RR_FF "load rounded (long to short)" esa -22 ltdr RR_FF "load and test (long)" esa -32 lter RR_FF "load and test (short)" esa -12 ltr RR_RR "load and test" esa -b24b lura RRE_RR "load using real address" esa -5c m RX_RRRD "multiply" esa -af mc SI_URD "monitor call" esa -6c md RX_FRRD "multiply (long)" esa -2c mdr RR_FF "multiply (long)" esa -7c me RX_FRRD "multiply (short to long)" esa -3c mer RR_FF "multiply (short to long)" esa -4c mh RX_RRRD "multiply halfword" esa -fc mp SS_LLRDRD "multiply decimal" esa -1c mr RR_RR "multiply" esa -b232 msch S_RD "modify subchannel" esa -b247 msta RRE_R0 "modify stacked state" esa -d2 mvc SS_L0RDRD "move" esa -e50f mvcdk SSE_RDRD "move with destination key" esa -e8 mvcin SS_L0RDRD "move inverse" esa -d9 mvck SS_RRRDRD "move with key" esa -0e mvcl RR_RR "move long" esa -da mvcp SS_RRRDRD "move to primary" esa -db mvcs SS_RRRDRD "move to secondary" esa -e50e mvcsk SSE_RDRD "move with source key" esa -92 mvi SI_URD "move" esa -d1 mvn SS_L0RDRD "move numerics" esa -f1 mvo SS_LLRDRD "move with offset" esa -b254 mvpg RRE_RR "move page" esa -b255 mvst RRE_RR "move string" esa -d3 mvz SS_L0RDRD "move zones" esa -67 mxd RX_FRRD "multiply (long to ext.)" esa -27 mxdr RR_FF "multiply (long to ext.)" esa -26 mxr RR_FF "multiply (ext.)" esa -54 n RX_RRRD "AND" esa -d4 nc SS_L0RDRD "AND" esa -94 ni SI_URD "AND" esa -14 nr RR_RR "AND" esa -56 o RX_RRRD "OR" esa -d6 oc SS_L0RDRD "OR" esa -96 oi SI_URD "OR" esa -16 or RR_RR "OR" esa -f2 pack SS_LLRDRD "pack" esa -b248 palb RRE_00 "purge ALB" esa -b218 pc S_RD "program call" esa -0101 pr E "program return" esa -b228 pt RRE_RR "program transfer" esa -b20d ptlb S_00 "purge TLB" esa -b23b rchp S_00 "reset channel path" esa -b22a rrbe RRE_RR "reset reference bit extended" esa -b238 rsch S_00 "resume subchannel" esa -5b s RX_RRRD "subtract" esa -b219 sac S_RD "set address space control" esa -b279 sacf S_RD "set address space control fast" esa -b237 sal S_00 "set address limit" esa -b24e sar RRE_AR "set access" esa -b23c schm S_00 "set channel monitor" esa -b204 sck S_RD "set clock" esa -b206 sckc S_RD "set clock comparator" esa -6b sd RX_FRRD "subtract normalized (long)" esa -2b sdr RR_FF "subtract normalized (long)" esa -7b se RX_FRRD "subtract normalized (short)" esa -3b ser RR_FF "subtract normalized (short)" esa -4b sh RX_RRRD "subtract halfword" esa -b214 sie S_RD "start interpretive execution" esa -ae sigp RS_RRRD "signal processor" esa -5f sl RX_RRRD "subtract logical" esa -8b sla RS_R0RD "shift left single" esa -8f slda RS_R0RD "shift left double (long)" esa -8d sldl RS_R0RD "shift left double logical (long)" esa -89 sll RS_R0RD "shift left single logical" esa -1f slr RR_RR "subtract logical" esa -fb sp SS_LLRDRD "subtract decimal" esa -b20a spka S_RD "set PSW key from address" esa -04 spm RR_R0 "set program mask" esa -b208 spt S_RD "set CPU timer" esa -b210 spx S_RD "set prefix" esa -b244 sqdr RRE_F0 "square root (long)" esa -b245 sqer RRE_F0 "square root (short)" esa -1b sr RR_RR "subtract" esa -8a sra RS_R0RD "shift right single" esa -8e srda RS_R0RD "shift right double (long)" esa -8c srdl RS_R0RD "shift right double logical (long)" esa -88 srl RS_R0RD "shift right single logical" esa -f0 srp SS_LIRDRD "shift and round decimal" esa -b25e srst RRE_RR "search string" esa -b225 ssar RRE_R0 "set secondary ASN" esa -b233 ssch S_RD "start subchannel" esa -b22b sske RRE_RR "set storage key extended" esa -80 ssm S_RD "set system mask" esa -50 st RX_RRRD "store" esa -9b stam RS_AARD "store access multiple" esa -b212 stap S_RD "store CPU address" esa -42 stc RX_RRRD "store character" esa -b205 stck S_RD "store clock" esa -b207 stckc S_RD "store clock comparator" esa -be stcm RS_RURD "store characters under mask" esa -b23a stcps S_RD "store channel path status" esa -b239 stcrw S_RD "store channel report word" esa -b6 stctl RS_CCRD "store control" esa -60 std RX_FRRD "store (long)" esa -70 ste RX_FRRD "store (short)" esa -40 sth RX_RRRD "store halfword" esa -b202 stidp S_RD "store CPU id" esa -90 stm RS_RRRD "store multiple" esa -ac stnsm SI_URD "store then AND system mask" esa -ad stosm SI_URD "store then OR system mask" esa -b209 stpt S_RD "store CPU timer" esa -b211 stpx S_RD "store prefix" esa -b234 stsch S_RD "store subchannel" esa -b246 stura RRE_RR "store using real address" esa -7f su RX_FRRD "subtract unnormalized (short)" esa -3f sur RR_FF "subtract unnormalized (short)" esa -0a svc RR_U0 "supervisor call" esa -6f sw RX_FRRD "subtract unnormalized (long)" esa -2f swr RR_FF "subtract unnormalized (long)" esa -37 sxr RR_FF "subtract normalized (ext.)" esa -b24c tar RRE_AR "test access" esa -b22c tb RRE_0R "test block" esa -91 tm SI_URD "test under mask" esa -b236 tpi S_RD "test pending interruption" esa -e501 tprot SSE_RDRD "test protection" esa -dc tr SS_L0RDRD "translate" esa -99 trace RS_RRRD "trace" esa -dd trt SS_L0RDRD "translate and test" esa -93 ts S_RD "test and set" esa -b235 tsch S_RD "test subchannel" esa -f3 unpk SS_LLRDRD "unpack" esa -0102 upt E "update tree" esa -57 x RX_RRRD "exclusive OR" esa -d7 xc SS_L0RDRD "exclusive OR" esa -97 xi SI_URD "exclusive OR" esa -17 xr RR_RR "exclusive OR" esa -f8 zap SS_LLRDRD "zero and add" esa -a70a ahi RI_RI "add halfword immediate" esa -84 brxh RSI_RRP "branch relative on index high" esa -85 brxle RSI_RRP "branch relative on index low or equal" esa -a705 bras RI_RP "branch relative and save" esa -a704 brc RI_UP "branch relative on condition" esa -a706 brct RI_RP "branch relative on count" esa -b241 cksm RRE_RR "checksum" esa -a70e chi RI_RI "compare halfword immediate" esa -a9 clcle RS_RRRD "compare logical long extended" esa -a708 lhi RI_RI "load halfword immediate" esa -a8 mvcle RS_RRRD "move long extended" esa -a70c mhi RI_RI "multiply halfword immediate" esa -b252 msr RRE_RR "multiply single" esa -71 ms RX_RRRD "multiply single" esa -a700 tmh RI_RU "test under mask high" esa -a701 tml RI_RU "test under mask low" esa -0700 nopr RR_0R "no operation" esa -0710 bor RR_0R "branch on overflow / if ones" esa -0720 bhr RR_0R "branch on high" esa -0720 bpr RR_0R "branch on plus" esa -0730 bnler RR_0R "branch on not low or equal" esa -0740 blr RR_0R "branch on low" esa -0740 bmr RR_0R "branch on minus / if mixed" esa -0750 bnher RR_0R "branch on not high or equal" esa -0760 blhr RR_0R "branch on low or high" esa -0770 bner RR_0R "branch on not equal" esa -0770 bnzr RR_0R "branch on not zero / if not zeros" esa -0780 ber RR_0R "branch on equal" esa -0780 bzr RR_0R "branch on zero / if zeros" esa -0790 bnlhr RR_0R "branch on not low or high" esa -07a0 bher RR_0R "branch on high or equal" esa -07b0 bnlr RR_0R "branch on not low" esa -07b0 bnmr RR_0R "branch on not minus / if not mixed" esa -07c0 bler RR_0R "brach on low or equal" esa -07d0 bnhr RR_0R "branch on not high" esa -07d0 bnpr RR_0R "branch on not plus" esa -07e0 bnor RR_0R "branch on not overflow / if not ones" esa -07f0 br RR_0R "unconditional branch" esa -4700 nop RX_0RRD "no operation" esa -4710 bo RX_0RRD "branch on overflow / if ones" esa -4720 bh RX_0RRD "branch on high" esa -4720 bp RX_0RRD "branch on plus" esa -4730 bnle RX_0RRD "branch on not low or equal" esa -4740 bl RX_0RRD "branch on low" esa -4740 bm RX_0RRD "branch on minus / if mixed" esa -4750 bnhe RX_0RRD "branch on not high or equal" esa -4760 blh RX_0RRD "branch on low or high" esa -4770 bne RX_0RRD "branch on not equal" esa -4770 bnz RX_0RRD "branch on not zero / if not zeros" esa -4780 be RX_0RRD "branch on equal" esa -4780 bz RX_0RRD "branch on zero / if zeros" esa -4790 bnlh RX_0RRD "branch on not low or high" esa -47a0 bhe RX_0RRD "branch on high or equal" esa -47b0 bnl RX_0RRD "branch on not low" esa -47b0 bnm RX_0RRD "branch on not minus / if not mixed" esa -47c0 ble RX_0RRD "branch on low or equal" esa -47d0 bnh RX_0RRD "branch on not high" esa -47d0 bnp RX_0RRD "branch on not plus" esa -47e0 bno RX_0RRD "branch on not overflow / if not ones" esa -47f0 b RX_0RRD "unconditional branch" esa -a714 jo RI_0P "jump on overflow / if ones" esa -a724 jh RI_0P "jump on A high" esa -a724 jp RI_0P "jump on plus" esa -a734 jnle RI_0P "jump on not low or equal" esa -a744 jl RI_0P "jump on A low" esa -a744 jm RI_0P "jump on minus / if mixed" esa -a754 jnhe RI_0P "jump on not high or equal" esa -a764 jlh RI_0P "jump on low or high" esa -a774 jne RI_0P "jump on A not equal B" esa -a774 jnz RI_0P "jump on not zero / if not zeros" esa -a784 je RI_0P "jump on A equal B" esa -a784 jz RI_0P "jump on zero / if zeros" esa -a794 jnlh RI_0P "jump on not low or high" esa -a7a4 jhe RI_0P "jump on high or equal" esa -a7b4 jnl RI_0P "jump on A not low" esa -a7b4 jnm RI_0P "jump on not minus / if not mixed" esa -a7c4 jle RI_0P "jump on low or equal" esa -a7d4 jnh RI_0P "jump on A not high" esa -a7d4 jnp RI_0P "jump on not plus" esa -a7e4 jno RI_0P "jump on not overflow / if not ones" esa -a7f4 j RI_0P "jump" esa -b34a axbr RRE_FF "add extended bfp" esa -b31a adbr RRE_FF "add long bfp" esa -ed000000001a adb RXE_FRRD "add long bfp" esa -b30a aebr RRE_FF "add short bfp" esa -ed000000000a aeb RXE_FRRD "add short bfp" esa -b349 cxbr RRE_FF "compare extended bfp" esa -b319 cdbr RRE_FF "compare long bfp" esa -ed0000000019 cdb RXE_FRRD "compare long bfp" esa -b309 cebr RRE_FF "compare short bfp" esa -ed0000000009 ceb RXE_FRRD "compare short bfp" esa -b348 kxbr RRE_FF "compare and signal extended bfp" esa -b318 kdbr RRE_FF "compare and signal long bfp" esa -ed0000000018 kdb RXE_FRRD "compare and signal long bfp" esa -b308 kebr RRE_FF "compare and signal short bfp" esa -ed0000000008 keb RXE_FRRD "compare and signal short bfp" esa -b396 cxfbr RRE_RF "convert from fixed 32 to extended bfp" esa -b395 cdfbr RRE_RF "convert from fixed 32 to long bfp" esa -b394 cefbr RRE_RF "convert from fixed 32 to short bfp" esa -b39a cfxbr RRF_U0FR "convert to fixed extended bfp to 32" esa -b399 cfdbr RRF_U0FR "convert to fixed long bfp to 32" esa -b398 cfebr RRF_U0FR "convert to fixed short bfp to 32" esa -b34d dxbr RRE_FF "divide extended bfp" esa -b31d ddbr RRE_FF "divide long bfp" esa -ed000000001d ddb RXE_FRRD "divide long bfp" esa -b30d debr RRE_FF "divide short bfp" esa -ed000000000d deb RXE_FRRD "divide short bfp" esa -b35b didbr RRF_FUFF "divide to integer long bfp" esa -b353 diebr RRF_FUFF "divide to integer short bfp" esa -b38c efpc RRE_RR "extract fpc" esa -b342 ltxbr RRE_FF "load and test extended bfp" esa -b312 ltdbr RRE_FF "load and test long bfp" esa -b302 ltebr RRE_FF "load and test short bfp" esa -b343 lcxbr RRE_FF "load complement extended bfp" esa -b313 lcdbr RRE_FF "load complement long bfp" esa -b303 lcebr RRE_FF "load complement short bfp" esa -b347 fixbr RRF_U0FF "load fp integer extended bfp" esa -b35f fidbr RRF_U0FF "load fp integer long bfp" esa -b357 fiebr RRF_U0FF "load fp integer short bfp" esa -b29d lfpc S_RD "load fpc" esa -b305 lxdbr RRE_FF "load lengthened long to extended bfp" esa -ed0000000005 lxdb RXE_FRRD "load lengthened long to extended bfp" esa -b306 lxebr RRE_FF "load lengthened short to extended bfp" esa -ed0000000006 lxeb RXE_FRRD "load lengthened short to extended bfp" esa -b304 ldebr RRE_FF "load lengthened short to long bfp" esa -ed0000000004 ldeb RXE_FRRD "load lengthened short to long bfp" esa -b341 lnxbr RRE_FF "load negative extended bfp" esa -b311 lndbr RRE_FF "load negative long bfp" esa -b301 lnebr RRE_FF "load negative short bfp" esa -b340 lpxbr RRE_FF "load positive extended bfp" esa -b310 lpdbr RRE_FF "load positive long bfp" esa -b300 lpebr RRE_FF "load positive short bfp" esa -b345 ldxbr RRE_FF "load rounded extended to long bfp" esa -b346 lexbr RRE_FF "load rounded extended to short bfp" esa -b344 ledbr RRE_FF "load rounded long to short bfp" esa -b34c mxbr RRE_FF "multiply extended bfp" esa -b31c mdbr RRE_FF "multiply long bfp" esa -ed000000001c mdb RXE_FRRD "multiply long bfp" esa -b307 mxdbr RRE_FF "multiply long to extended bfp" esa -ed0000000007 mxdb RXE_FRRD "multiply long to extended bfp" esa -b317 meebr RRE_FF "multiply short bfp" esa -ed0000000017 meeb RXE_FRRD "multiply short bfp" esa -b30c mdebr RRE_FF "multiply short to long bfp" esa -ed000000000c mdeb RXE_FRRD "multiply short to long bfp" esa -b31e madbr RRF_F0FF "multiply and add long bfp" esa -ed000000001e madb RXF_FRRDF "multiply and add long bfp" esa -b30e maebr RRF_F0FF "multiply and add short bfp" esa -ed000000000e maeb RXF_FRRDF "multiply and add short bfp" esa -b31f msdbr RRF_F0FF "multiply and subtract long bfp" esa -ed000000001f msdb RXF_FRRDF "multiply and subtract long bfp" esa -b30f msebr RRF_F0FF "multiply and subtract short bfp" esa -ed000000000f mseb RXF_FRRDF "multiply and subtract short bfp" esa -b384 sfpc RRE_RR "set fpc" esa -b299 srnm S_RD "set rounding mode" esa -b316 sqxbr RRE_FF "square root extended bfp" esa -b315 sqdbr RRE_FF "square root long bfp" esa -ed0000000015 sqdb RXE_FRRD "square root long bfp" esa -b314 sqebr RRE_FF "square root short bfp" esa -ed0000000014 sqeb RXE_FRRD "square root short bfp" esa -b29c stfpc S_RD "store fpc" esa -b34b sxbr RRE_FF "subtract extended bfp" esa -b31b sdbr RRE_FF "subtract long bfp" esa -ed000000001b sdb RXE_FRRD "subtract long bfp" esa -b30b sebr RRE_FF "subtract short bfp" esa -ed000000000b seb RXE_FRRD "subtract short bfp" esa -ed0000000012 tcxb RXE_FRRD "test data class extended bfp" esa -ed0000000011 tcdb RXE_FRRD "test data class long bfp" esa -ed0000000010 tceb RXE_FRRD "test data class short bfp" esa -b274 siga S_RD "signal adapter" esa -# are the following instructions confidential ?? -b2a6 cuutf RRE_RR "convert unicode to utf-8" esa -b2a7 cutfu RRE_RR "convert utf-8 to unicode" esa -ee plo SS_RRRDRD2 "perform locked operation" esa -b25a bsa RRE_RR "branch and set authority" esa -b277 rp S_RD "resume program" esa -0107 sckpf E "set clock programmable field" esa -b27d stsi S_RD "store system information" esa -01ff trap2 E "trap" esa -b2ff trap4 S_RD "trap4" esa +5a a RX_RRRD "add" g5 esa,zarch +6a ad RX_FRRD "add normalized (long)" g5 esa,zarch +2a adr RR_FF "add normalized (long)" g5 esa,zarch +7a ae RX_FRRD "add normalized (short)" g5 esa,zarch +3a aer RR_FF "add normalized (short)" g5 esa,zarch +4a ah RX_RRRD "add halfword" g5 esa,zarch +5e al RX_RRRD "add logical" g5 esa,zarch +1e alr RR_RR "add logical" g5 esa,zarch +fa ap SS_LLRDRD "add decimal" g5 esa,zarch +1a ar RR_RR "add" g5 esa,zarch +7e au RX_FRRD "add unnormalized (short)" g5 esa,zarch +3e aur RR_FF "add unnormalized (short)" g5 esa,zarch +6e aw RX_FRRD "add unnormalized (long)" g5 esa,zarch +2e awr RR_FF "add unnormalized (long)" g5 esa,zarch +36 axr RR_FF "add normalized" g5 esa,zarch +b240 bakr RRE_RR "branch and stack" g5 esa,zarch +45 bal RX_RRRD "branch and link" g5 esa,zarch +05 balr RR_RR "branch and link" g5 esa,zarch +4d bas RX_RRRD "branch and save" g5 esa,zarch +0d basr RR_RR "branch and save" g5 esa,zarch +0c bassm RR_RR "branch and save and set mode" g5 esa,zarch +47 bc RX_URRD "branch on condition" g5 esa,zarch +07 bcr RR_UR "branch on condition" g5 esa,zarch +46 bct RX_RRRD "branch on count" g5 esa,zarch +06 bctr RR_RR "branch on count" g5 esa,zarch +b258 bsg RRE_RR "branch in subspace group" g5 esa,zarch +0b bsm RR_RR "branch and set mode" g5 esa,zarch +86 bxh RS_RRRD "branch on index high" g5 esa,zarch +87 bxle RS_RRRD "branch on index low or equal" g5 esa,zarch +59 c RX_RRRD "compare" g5 esa,zarch +69 cd RX_FRRD "compare (long)" g5 esa,zarch +29 cdr RR_FF "compare (long)" g5 esa,zarch +bb cds RS_RRRD "compare double and swap" g5 esa,zarch +79 ce RX_FRRD "compare (short)" g5 esa,zarch +39 cer RR_FF "compare (short)" g5 esa,zarch +b21a cfc S_RD "compare and form codeword" g5 esa,zarch +49 ch RX_RRRD "compare halfword" g5 esa,zarch +55 cl RX_RRRD "compare logical" g5 esa,zarch +d5 clc SS_L0RDRD "compare logical" g5 esa,zarch +0f clcl RR_RR "compare logical long" g5 esa,zarch +95 cli SI_URD "compare logical" g5 esa,zarch +bd clm RS_RURD "compare logical characters under mask" g5 esa,zarch +15 clr RR_RR "compare logical" g5 esa,zarch +b25d clst RRE_RR "compare logical string" g5 esa,zarch +b263 cmpsc RRE_RR "compression call" g5 esa,zarch +f9 cp SS_LLRDRD "compare decimal" g5 esa,zarch +b24d cpya RRE_AA "copy access" g5 esa,zarch +19 cr RR_RR "compare" g5 esa,zarch +ba cs RS_RRRD "compare and swap" g5 esa,zarch +b230 csch S_00 "clear subchannel" g5 esa,zarch +b257 cuse RRE_RR "compare until substring equal" g5 esa,zarch +b250 csp RRE_RR "compare and swap and purge" g5 esa,zarch +4f cvb RX_RRRD "convert to binary" g5 esa,zarch +4e cvd RX_RRRD "convert to decimal" g5 esa,zarch +5d d RX_RRRD "divide" g5 esa,zarch +6d dd RX_FRRD "divide (long)" g5 esa,zarch +2d ddr RR_FF "divide (long)" g5 esa,zarch +7d de RX_FRRD "divide (short)" g5 esa,zarch +3d der RR_FF "divide (short)" g5 esa,zarch +83 diag RS_RRRD "diagnose" g5 esa,zarch +fd dp SS_LLRDRD "divide decimal" g5 esa,zarch +1d dr RR_RR "divide" g5 esa,zarch +b22d dxr RRE_F0 "divide (ext.)" g5 esa,zarch +b24f ear RRE_RA "extract access" g5 esa,zarch +de ed SS_L0RDRD "edit" g5 esa,zarch +df edmk SS_L0RDRD "edit and mark" g5 esa,zarch +b226 epar RRE_R0 "extract primary ASN" g5 esa,zarch +b249 ereg RRE_RR "extract stacked registers" g5 esa,zarch +b227 esar RRE_R0 "extract secondary ASN" g5 esa,zarch +b24a esta RRE_RR "extract stacked state" g5 esa,zarch +44 ex RX_RRRD "execute" g5 esa,zarch +24 hdr RR_FF "halve (long)" g5 esa,zarch +34 her RR_FF "halve (short)" g5 esa,zarch +b231 hsch S_00 "halt subchannel" g5 esa,zarch +b224 iac RRE_R0 "insert address space control" g5 esa,zarch +43 ic RX_RRRD "insert character" g5 esa,zarch +bf icm RS_RURD "insert characters under mask" g5 esa,zarch +b20b ipk S_00 "insert PSW key" g5 esa,zarch +b222 ipm RRE_R0 "insert program mask" g5 esa,zarch +b221 ipte RRE_RR "invalidate page table entry" g5 esa,zarch +b229 iske RRE_RR "insert storage key extended" g5 esa,zarch +b223 ivsk RRE_RR "insert virtual storage key" g5 esa,zarch +58 l RX_RRRD "load" g5 esa,zarch +41 la RX_RRRD "load address" g5 esa,zarch +51 lae RX_RRRD "load address extended" g5 esa,zarch +9a lam RS_AARD "load access multiple" g5 esa,zarch +e500 lasp SSE_RDRD "load address space parameters" g5 esa,zarch +23 lcdr RR_FF "load complement (long)" g5 esa,zarch +33 lcer RR_FF "load complement (short)" g5 esa,zarch +13 lcr RR_RR "load complement" g5 esa,zarch +b7 lctl RS_CCRD "load control" g5 esa,zarch +68 ld RX_FRRD "load (long)" g5 esa,zarch +28 ldr RR_FF "load (long)" g5 esa,zarch +78 le RX_FRRD "load (short)" g5 esa,zarch +38 ler RR_FF "load (short)" g5 esa,zarch +48 lh RX_RRRD "load halfword" g5 esa,zarch +98 lm RS_RRRD "load multiple" g5 esa,zarch +21 lndr RR_FF "load negative (long)" g5 esa,zarch +31 lner RR_FF "load negative (short)" g5 esa,zarch +11 lnr RR_RR "load negative" g5 esa,zarch +20 lpdr RR_FF "load positive (long)" g5 esa,zarch +30 lper RR_FF "load positive (short)" g5 esa,zarch +10 lpr RR_RR "load positive" g5 esa,zarch +82 lpsw S_RD "load PSW" g5 esa,zarch +18 lr RR_RR "load" g5 esa,zarch +b1 lra RX_RRRD "load real address" g5 esa,zarch +25 lrdr RR_FF "load rounded (ext. to long)" g5 esa,zarch +35 lrer RR_FF "load rounded (long to short)" g5 esa,zarch +22 ltdr RR_FF "load and test (long)" g5 esa,zarch +32 lter RR_FF "load and test (short)" g5 esa,zarch +12 ltr RR_RR "load and test" g5 esa,zarch +b24b lura RRE_RR "load using real address" g5 esa,zarch +5c m RX_RRRD "multiply" g5 esa,zarch +af mc SI_URD "monitor call" g5 esa,zarch +6c md RX_FRRD "multiply (long)" g5 esa,zarch +2c mdr RR_FF "multiply (long)" g5 esa,zarch +7c me RX_FRRD "multiply (short to long)" g5 esa,zarch +3c mer RR_FF "multiply (short to long)" g5 esa,zarch +4c mh RX_RRRD "multiply halfword" g5 esa,zarch +fc mp SS_LLRDRD "multiply decimal" g5 esa,zarch +1c mr RR_RR "multiply" g5 esa,zarch +b232 msch S_RD "modify subchannel" g5 esa,zarch +b247 msta RRE_R0 "modify stacked state" g5 esa,zarch +d2 mvc SS_L0RDRD "move" g5 esa,zarch +e50f mvcdk SSE_RDRD "move with destination key" g5 esa,zarch +e8 mvcin SS_L0RDRD "move inverse" g5 esa,zarch +d9 mvck SS_RRRDRD "move with key" g5 esa,zarch +0e mvcl RR_RR "move long" g5 esa,zarch +da mvcp SS_RRRDRD "move to primary" g5 esa,zarch +db mvcs SS_RRRDRD "move to secondary" g5 esa,zarch +e50e mvcsk SSE_RDRD "move with source key" g5 esa,zarch +92 mvi SI_URD "move" g5 esa,zarch +d1 mvn SS_L0RDRD "move numerics" g5 esa,zarch +f1 mvo SS_LLRDRD "move with offset" g5 esa,zarch +b254 mvpg RRE_RR "move page" g5 esa,zarch +b255 mvst RRE_RR "move string" g5 esa,zarch +d3 mvz SS_L0RDRD "move zones" g5 esa,zarch +67 mxd RX_FRRD "multiply (long to ext.)" g5 esa,zarch +27 mxdr RR_FF "multiply (long to ext.)" g5 esa,zarch +26 mxr RR_FF "multiply (ext.)" g5 esa,zarch +54 n RX_RRRD "AND" g5 esa,zarch +d4 nc SS_L0RDRD "AND" g5 esa,zarch +94 ni SI_URD "AND" g5 esa,zarch +14 nr RR_RR "AND" g5 esa,zarch +56 o RX_RRRD "OR" g5 esa,zarch +d6 oc SS_L0RDRD "OR" g5 esa,zarch +96 oi SI_URD "OR" g5 esa,zarch +16 or RR_RR "OR" g5 esa,zarch +f2 pack SS_LLRDRD "pack" g5 esa,zarch +b248 palb RRE_00 "purge ALB" g5 esa,zarch +b218 pc S_RD "program call" g5 esa,zarch +0101 pr E "program return" g5 esa,zarch +b228 pt RRE_RR "program transfer" g5 esa,zarch +b20d ptlb S_00 "purge TLB" g5 esa,zarch +b23b rchp S_00 "reset channel path" g5 esa,zarch +b22a rrbe RRE_RR "reset reference bit extended" g5 esa,zarch +b238 rsch S_00 "resume subchannel" g5 esa,zarch +5b s RX_RRRD "subtract" g5 esa,zarch +b219 sac S_RD "set address space control" g5 esa,zarch +b279 sacf S_RD "set address space control fast" g5 esa,zarch +b237 sal S_00 "set address limit" g5 esa,zarch +b24e sar RRE_AR "set access" g5 esa,zarch +b23c schm S_00 "set channel monitor" g5 esa,zarch +b204 sck S_RD "set clock" g5 esa,zarch +b206 sckc S_RD "set clock comparator" g5 esa,zarch +6b sd RX_FRRD "subtract normalized (long)" g5 esa,zarch +2b sdr RR_FF "subtract normalized (long)" g5 esa,zarch +7b se RX_FRRD "subtract normalized (short)" g5 esa,zarch +3b ser RR_FF "subtract normalized (short)" g5 esa,zarch +4b sh RX_RRRD "subtract halfword" g5 esa,zarch +b214 sie S_RD "start interpretive execution" g5 esa,zarch +ae sigp RS_RRRD "signal processor" g5 esa,zarch +5f sl RX_RRRD "subtract logical" g5 esa,zarch +8b sla RS_R0RD "shift left single" g5 esa,zarch +8f slda RS_R0RD "shift left double (long)" g5 esa,zarch +8d sldl RS_R0RD "shift left double logical (long)" g5 esa,zarch +89 sll RS_R0RD "shift left single logical" g5 esa,zarch +1f slr RR_RR "subtract logical" g5 esa,zarch +fb sp SS_LLRDRD "subtract decimal" g5 esa,zarch +b20a spka S_RD "set PSW key from address" g5 esa,zarch +04 spm RR_R0 "set program mask" g5 esa,zarch +b208 spt S_RD "set CPU timer" g5 esa,zarch +b210 spx S_RD "set prefix" g5 esa,zarch +b244 sqdr RRE_F0 "square root (long)" g5 esa,zarch +b245 sqer RRE_F0 "square root (short)" g5 esa,zarch +1b sr RR_RR "subtract" g5 esa,zarch +8a sra RS_R0RD "shift right single" g5 esa,zarch +8e srda RS_R0RD "shift right double (long)" g5 esa,zarch +8c srdl RS_R0RD "shift right double logical (long)" g5 esa,zarch +88 srl RS_R0RD "shift right single logical" g5 esa,zarch +f0 srp SS_LIRDRD "shift and round decimal" g5 esa,zarch +b25e srst RRE_RR "search string" g5 esa,zarch +b225 ssar RRE_R0 "set secondary ASN" g5 esa,zarch +b233 ssch S_RD "start subchannel" g5 esa,zarch +b22b sske RRE_RR "set storage key extended" g5 esa,zarch +80 ssm S_RD "set system mask" g5 esa,zarch +50 st RX_RRRD "store" g5 esa,zarch +9b stam RS_AARD "store access multiple" g5 esa,zarch +b212 stap S_RD "store CPU address" g5 esa,zarch +42 stc RX_RRRD "store character" g5 esa,zarch +b205 stck S_RD "store clock" g5 esa,zarch +b207 stckc S_RD "store clock comparator" g5 esa,zarch +be stcm RS_RURD "store characters under mask" g5 esa,zarch +b23a stcps S_RD "store channel path status" g5 esa,zarch +b239 stcrw S_RD "store channel report word" g5 esa,zarch +b6 stctl RS_CCRD "store control" g5 esa,zarch +60 std RX_FRRD "store (long)" g5 esa,zarch +70 ste RX_FRRD "store (short)" g5 esa,zarch +40 sth RX_RRRD "store halfword" g5 esa,zarch +b202 stidp S_RD "store CPU id" g5 esa,zarch +90 stm RS_RRRD "store multiple" g5 esa,zarch +ac stnsm SI_URD "store then AND system mask" g5 esa,zarch +ad stosm SI_URD "store then OR system mask" g5 esa,zarch +b209 stpt S_RD "store CPU timer" g5 esa,zarch +b211 stpx S_RD "store prefix" g5 esa,zarch +b234 stsch S_RD "store subchannel" g5 esa,zarch +b246 stura RRE_RR "store using real address" g5 esa,zarch +7f su RX_FRRD "subtract unnormalized (short)" g5 esa,zarch +3f sur RR_FF "subtract unnormalized (short)" g5 esa,zarch +0a svc RR_U0 "supervisor call" g5 esa,zarch +6f sw RX_FRRD "subtract unnormalized (long)" g5 esa,zarch +2f swr RR_FF "subtract unnormalized (long)" g5 esa,zarch +37 sxr RR_FF "subtract normalized (ext.)" g5 esa,zarch +b24c tar RRE_AR "test access" g5 esa,zarch +b22c tb RRE_0R "test block" g5 esa,zarch +91 tm SI_URD "test under mask" g5 esa,zarch +b236 tpi S_RD "test pending interruption" g5 esa,zarch +e501 tprot SSE_RDRD "test protection" g5 esa,zarch +dc tr SS_L0RDRD "translate" g5 esa,zarch +99 trace RS_RRRD "trace" g5 esa,zarch +dd trt SS_L0RDRD "translate and test" g5 esa,zarch +93 ts S_RD "test and set" g5 esa,zarch +b235 tsch S_RD "test subchannel" g5 esa,zarch +f3 unpk SS_LLRDRD "unpack" g5 esa,zarch +0102 upt E "update tree" g5 esa,zarch +57 x RX_RRRD "exclusive OR" g5 esa,zarch +d7 xc SS_L0RDRD "exclusive OR" g5 esa,zarch +97 xi SI_URD "exclusive OR" g5 esa,zarch +17 xr RR_RR "exclusive OR" g5 esa,zarch +f8 zap SS_LLRDRD "zero and add" g5 esa,zarch +a70a ahi RI_RI "add halfword immediate" g5 esa,zarch +84 brxh RSI_RRP "branch relative on index high" g5 esa,zarch +85 brxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch +a705 bras RI_RP "branch relative and save" g5 esa,zarch +a704 brc RI_UP "branch relative on condition" g5 esa,zarch +a706 brct RI_RP "branch relative on count" g5 esa,zarch +b241 cksm RRE_RR "checksum" g5 esa,zarch +a70e chi RI_RI "compare halfword immediate" g5 esa,zarch +a9 clcle RS_RRRD "compare logical long extended" g5 esa,zarch +a708 lhi RI_RI "load halfword immediate" g5 esa,zarch +a8 mvcle RS_RRRD "move long extended" g5 esa,zarch +a70c mhi RI_RI "multiply halfword immediate" g5 esa,zarch +b252 msr RRE_RR "multiply single" g5 esa,zarch +71 ms RX_RRRD "multiply single" g5 esa,zarch +a700 tmh RI_RU "test under mask high" g5 esa,zarch +a701 tml RI_RU "test under mask low" g5 esa,zarch +0700 nopr RR_0R "no operation" g5 esa,zarch +0710 bor RR_0R "branch on overflow / if ones" g5 esa,zarch +0720 bhr RR_0R "branch on high" g5 esa,zarch +0720 bpr RR_0R "branch on plus" g5 esa,zarch +0730 bnler RR_0R "branch on not low or equal" g5 esa,zarch +0740 blr RR_0R "branch on low" g5 esa,zarch +0740 bmr RR_0R "branch on minus / if mixed" g5 esa,zarch +0750 bnher RR_0R "branch on not high or equal" g5 esa,zarch +0760 blhr RR_0R "branch on low or high" g5 esa,zarch +0770 bner RR_0R "branch on not equal" g5 esa,zarch +0770 bnzr RR_0R "branch on not zero / if not zeros" g5 esa,zarch +0780 ber RR_0R "branch on equal" g5 esa,zarch +0780 bzr RR_0R "branch on zero / if zeros" g5 esa,zarch +0790 bnlhr RR_0R "branch on not low or high" g5 esa,zarch +07a0 bher RR_0R "branch on high or equal" g5 esa,zarch +07b0 bnlr RR_0R "branch on not low" g5 esa,zarch +07b0 bnmr RR_0R "branch on not minus / if not mixed" g5 esa,zarch +07c0 bler RR_0R "brach on low or equal" g5 esa,zarch +07d0 bnhr RR_0R "branch on not high" g5 esa,zarch +07d0 bnpr RR_0R "branch on not plus" g5 esa,zarch +07e0 bnor RR_0R "branch on not overflow / if not ones" g5 esa,zarch +07f0 br RR_0R "unconditional branch" g5 esa,zarch +4700 nop RX_0RRD "no operation" g5 esa,zarch +4710 bo RX_0RRD "branch on overflow / if ones" g5 esa,zarch +4720 bh RX_0RRD "branch on high" g5 esa,zarch +4720 bp RX_0RRD "branch on plus" g5 esa,zarch +4730 bnle RX_0RRD "branch on not low or equal" g5 esa,zarch +4740 bl RX_0RRD "branch on low" g5 esa,zarch +4740 bm RX_0RRD "branch on minus / if mixed" g5 esa,zarch +4750 bnhe RX_0RRD "branch on not high or equal" g5 esa,zarch +4760 blh RX_0RRD "branch on low or high" g5 esa,zarch +4770 bne RX_0RRD "branch on not equal" g5 esa,zarch +4770 bnz RX_0RRD "branch on not zero / if not zeros" g5 esa,zarch +4780 be RX_0RRD "branch on equal" g5 esa,zarch +4780 bz RX_0RRD "branch on zero / if zeros" g5 esa,zarch +4790 bnlh RX_0RRD "branch on not low or high" g5 esa,zarch +47a0 bhe RX_0RRD "branch on high or equal" g5 esa,zarch +47b0 bnl RX_0RRD "branch on not low" g5 esa,zarch +47b0 bnm RX_0RRD "branch on not minus / if not mixed" g5 esa,zarch +47c0 ble RX_0RRD "branch on low or equal" g5 esa,zarch +47d0 bnh RX_0RRD "branch on not high" g5 esa,zarch +47d0 bnp RX_0RRD "branch on not plus" g5 esa,zarch +47e0 bno RX_0RRD "branch on not overflow / if not ones" g5 esa,zarch +47f0 b RX_0RRD "unconditional branch" g5 esa,zarch +a714 jo RI_0P "jump on overflow / if ones" g5 esa,zarch +a724 jh RI_0P "jump on A high" g5 esa,zarch +a724 jp RI_0P "jump on plus" g5 esa,zarch +a734 jnle RI_0P "jump on not low or equal" g5 esa,zarch +a744 jl RI_0P "jump on A low" g5 esa,zarch +a744 jm RI_0P "jump on minus / if mixed" g5 esa,zarch +a754 jnhe RI_0P "jump on not high or equal" g5 esa,zarch +a764 jlh RI_0P "jump on low or high" g5 esa,zarch +a774 jne RI_0P "jump on A not equal B" g5 esa,zarch +a774 jnz RI_0P "jump on not zero / if not zeros" g5 esa,zarch +a784 je RI_0P "jump on A equal B" g5 esa,zarch +a784 jz RI_0P "jump on zero / if zeros" g5 esa,zarch +a794 jnlh RI_0P "jump on not low or high" g5 esa,zarch +a7a4 jhe RI_0P "jump on high or equal" g5 esa,zarch +a7b4 jnl RI_0P "jump on A not low" g5 esa,zarch +a7b4 jnm RI_0P "jump on not minus / if not mixed" g5 esa,zarch +a7c4 jle RI_0P "jump on low or equal" g5 esa,zarch +a7d4 jnh RI_0P "jump on A not high" g5 esa,zarch +a7d4 jnp RI_0P "jump on not plus" g5 esa,zarch +a7e4 jno RI_0P "jump on not overflow / if not ones" g5 esa,zarch +a7f4 j RI_0P "jump" g5 esa,zarch +b34a axbr RRE_FF "add extended bfp" g5 esa,zarch +b31a adbr RRE_FF "add long bfp" g5 esa,zarch +ed000000001a adb RXE_FRRD "add long bfp" g5 esa,zarch +b30a aebr RRE_FF "add short bfp" g5 esa,zarch +ed000000000a aeb RXE_FRRD "add short bfp" g5 esa,zarch +b349 cxbr RRE_FF "compare extended bfp" g5 esa,zarch +b319 cdbr RRE_FF "compare long bfp" g5 esa,zarch +ed0000000019 cdb RXE_FRRD "compare long bfp" g5 esa,zarch +b309 cebr RRE_FF "compare short bfp" g5 esa,zarch +ed0000000009 ceb RXE_FRRD "compare short bfp" g5 esa,zarch +b348 kxbr RRE_FF "compare and signal extended bfp" g5 esa,zarch +b318 kdbr RRE_FF "compare and signal long bfp" g5 esa,zarch +ed0000000018 kdb RXE_FRRD "compare and signal long bfp" g5 esa,zarch +b308 kebr RRE_FF "compare and signal short bfp" g5 esa,zarch +ed0000000008 keb RXE_FRRD "compare and signal short bfp" g5 esa,zarch +b396 cxfbr RRE_RF "convert from fixed 32 to extended bfp" g5 esa,zarch +b395 cdfbr RRE_RF "convert from fixed 32 to long bfp" g5 esa,zarch +b394 cefbr RRE_RF "convert from fixed 32 to short bfp" g5 esa,zarch +b39a cfxbr RRF_U0FR "convert to fixed extended bfp to 32" g5 esa,zarch +b399 cfdbr RRF_U0FR "convert to fixed long bfp to 32" g5 esa,zarch +b398 cfebr RRF_U0FR "convert to fixed short bfp to 32" g5 esa,zarch +b34d dxbr RRE_FF "divide extended bfp" g5 esa,zarch +b31d ddbr RRE_FF "divide long bfp" g5 esa,zarch +ed000000001d ddb RXE_FRRD "divide long bfp" g5 esa,zarch +b30d debr RRE_FF "divide short bfp" g5 esa,zarch +ed000000000d deb RXE_FRRD "divide short bfp" g5 esa,zarch +b35b didbr RRF_FUFF "divide to integer long bfp" g5 esa,zarch +b353 diebr RRF_FUFF "divide to integer short bfp" g5 esa,zarch +b38c efpc RRE_RR "extract fpc" g5 esa,zarch +b342 ltxbr RRE_FF "load and test extended bfp" g5 esa,zarch +b312 ltdbr RRE_FF "load and test long bfp" g5 esa,zarch +b302 ltebr RRE_FF "load and test short bfp" g5 esa,zarch +b343 lcxbr RRE_FF "load complement extended bfp" g5 esa,zarch +b313 lcdbr RRE_FF "load complement long bfp" g5 esa,zarch +b303 lcebr RRE_FF "load complement short bfp" g5 esa,zarch +b347 fixbr RRF_U0FF "load fp integer extended bfp" g5 esa,zarch +b35f fidbr RRF_U0FF "load fp integer long bfp" g5 esa,zarch +b357 fiebr RRF_U0FF "load fp integer short bfp" g5 esa,zarch +b29d lfpc S_RD "load fpc" g5 esa,zarch +b305 lxdbr RRE_FF "load lengthened long to extended bfp" g5 esa,zarch +ed0000000005 lxdb RXE_FRRD "load lengthened long to extended bfp" g5 esa,zarch +b306 lxebr RRE_FF "load lengthened short to extended bfp" g5 esa,zarch +ed0000000006 lxeb RXE_FRRD "load lengthened short to extended bfp" g5 esa,zarch +b304 ldebr RRE_FF "load lengthened short to long bfp" g5 esa,zarch +ed0000000004 ldeb RXE_FRRD "load lengthened short to long bfp" g5 esa,zarch +b341 lnxbr RRE_FF "load negative extended bfp" g5 esa,zarch +b311 lndbr RRE_FF "load negative long bfp" g5 esa,zarch +b301 lnebr RRE_FF "load negative short bfp" g5 esa,zarch +b340 lpxbr RRE_FF "load positive extended bfp" g5 esa,zarch +b310 lpdbr RRE_FF "load positive long bfp" g5 esa,zarch +b300 lpebr RRE_FF "load positive short bfp" g5 esa,zarch +b345 ldxbr RRE_FF "load rounded extended to long bfp" g5 esa,zarch +b346 lexbr RRE_FF "load rounded extended to short bfp" g5 esa,zarch +b344 ledbr RRE_FF "load rounded long to short bfp" g5 esa,zarch +b34c mxbr RRE_FF "multiply extended bfp" g5 esa,zarch +b31c mdbr RRE_FF "multiply long bfp" g5 esa,zarch +ed000000001c mdb RXE_FRRD "multiply long bfp" g5 esa,zarch +b307 mxdbr RRE_FF "multiply long to extended bfp" g5 esa,zarch +ed0000000007 mxdb RXE_FRRD "multiply long to extended bfp" g5 esa,zarch +b317 meebr RRE_FF "multiply short bfp" g5 esa,zarch +ed0000000017 meeb RXE_FRRD "multiply short bfp" g5 esa,zarch +b30c mdebr RRE_FF "multiply short to long bfp" g5 esa,zarch +ed000000000c mdeb RXE_FRRD "multiply short to long bfp" g5 esa,zarch +b31e madbr RRF_F0FF "multiply and add long bfp" g5 esa,zarch +ed000000001e madb RXF_FRRDF "multiply and add long bfp" g5 esa,zarch +b30e maebr RRF_F0FF "multiply and add short bfp" g5 esa,zarch +ed000000000e maeb RXF_FRRDF "multiply and add short bfp" g5 esa,zarch +b31f msdbr RRF_F0FF "multiply and subtract long bfp" g5 esa,zarch +ed000000001f msdb RXF_FRRDF "multiply and subtract long bfp" g5 esa,zarch +b30f msebr RRF_F0FF "multiply and subtract short bfp" g5 esa,zarch +ed000000000f mseb RXF_FRRDF "multiply and subtract short bfp" g5 esa,zarch +b384 sfpc RRE_RR "set fpc" g5 esa,zarch +b299 srnm S_RD "set rounding mode" g5 esa,zarch +b316 sqxbr RRE_FF "square root extended bfp" g5 esa,zarch +b315 sqdbr RRE_FF "square root long bfp" g5 esa,zarch +ed0000000015 sqdb RXE_FRRD "square root long bfp" g5 esa,zarch +b314 sqebr RRE_FF "square root short bfp" g5 esa,zarch +ed0000000014 sqeb RXE_FRRD "square root short bfp" g5 esa,zarch +b29c stfpc S_RD "store fpc" g5 esa,zarch +b34b sxbr RRE_FF "subtract extended bfp" g5 esa,zarch +b31b sdbr RRE_FF "subtract long bfp" g5 esa,zarch +ed000000001b sdb RXE_FRRD "subtract long bfp" g5 esa,zarch +b30b sebr RRE_FF "subtract short bfp" g5 esa,zarch +ed000000000b seb RXE_FRRD "subtract short bfp" g5 esa,zarch +ed0000000012 tcxb RXE_FRRD "test data class extended bfp" g5 esa,zarch +ed0000000011 tcdb RXE_FRRD "test data class long bfp" g5 esa,zarch +ed0000000010 tceb RXE_FRRD "test data class short bfp" g5 esa,zarch +b274 siga S_RD "signal adapter" g5 esa,zarch +b2a6 cuutf RRE_RR "convert unicode to utf-8" g5 esa,zarch +b2a7 cutfu RRE_RR "convert utf-8 to unicode" g5 esa,zarch +ee plo SS_RRRDRD2 "perform locked operation" g5 esa,zarch +b25a bsa RRE_RR "branch and set authority" g5 esa,zarch +b277 rp S_RD "resume program" g5 esa,zarch +0107 sckpf E "set clock programmable field" g5 esa,zarch +b27d stsi S_RD "store system information" g5 esa,zarch +01ff trap2 E "trap" g5 esa,zarch +b2ff trap4 S_RD "trap4" g5 esa,zarch +a700 tmlh RI_RU "test under mask low high" g5 esa,zarch +a701 tmll RI_RU "test under mask low low" g5 esa,zarch +b278 stcke S_RD "store clock extended" g5 esa,zarch +b2a5 tre RRE_RR "translate extended" g5 esa,zarch +eb000000008e mvclu RSE_RRRD "move long unicode" g5 esa,zarch +e9 pka SS_L0RDRD "pack ascii" g5 esa,zarch +e1 pku SS_L0RDRD "pack unicode" g5 esa,zarch +b993 troo RRE_RR "translate one to one" g5 esa,zarch +b992 trot RRE_RR "translate one to two" g5 esa,zarch +b991 trto RRE_RR "translate two to one" g5 esa,zarch +b990 trtt RRE_RR "translate two to two" g5 esa,zarch +ea unpka SS_L0RDRD "unpack ascii" g5 esa,zarch +e2 unpku SS_L0RDRD "unpack unicode" g5 esa,zarch +b358 thder RRE_RR "convert short bfp to long hfp" g5 esa,zarch +b359 thdr RRE_RR "convert long bfp to long hfp" g5 esa,zarch +b350 tbedr RRF_U0FF "convert long hfp to short bfp" g5 esa,zarch +b351 tbdr RRF_U0FF "convert long hfp to long bfp" g5 esa,zarch +b374 lzer RRE_R0 "load short zero" g5 esa,zarch +b375 lzdr RRE_R0 "load long zero" g5 esa,zarch +b376 lzxr RRE_R0 "load extended zero" g5 esa,zarch # Here are the new esame instructions: -b946 bctgr RRE_RR "branch on count 64" esame -b900 lpgr RRE_RR "load positive 64" esame -b910 lpgfr RRE_RR "load positive 64<32" esame -b901 lngr RRE_RR "load negative 64" esame -b911 lngfr RRE_RR "load negative 64<32" esame -b902 ltgr RRE_RR "load and test 64" esame -b912 ltgfr RRE_RR "load and test 64<32" esame -b903 lcgr RRE_RR "load complement 64" esame -b913 lcgfr RRE_RR "load complement 64<32" esame -b980 ngr RRE_RR "and 64" esame -b921 clgr RRE_RR "compare logical 64" esame -b931 clgfr RRE_RR "compare logical 64<32" esame -b981 ogr RRE_RR "or 64" esame -b982 xgr RRE_RR "exclusive or 64" esame -b904 lgr RRE_RR "load 64" esame -b914 lgfr RRE_RR "load 64<32" esame -b920 cgr RRE_RR "compare 64" esame -b930 cgfr RRE_RR "compare 64<32" esame -b908 agr RRE_RR "add 64" esame -b918 agfr RRE_RR "add 64<32" esame -b909 sgr RRE_RR "subtract 64" esame -b919 sgfr RRE_RR "subtract 64<32" esame -b90a algr RRE_RR "add logical 64" esame -b91a algfr RRE_RR "add logical 64<32" esame -b90b slgr RRE_RR "subtract logical 64" esame -b91b slgfr RRE_RR "subtract logical 64<32" esame -e30000000046 bctg RXE_RRRD "branch on count 64" esame -e3000000002e cvdg RXE_RRRD "convert to decimal 64" esame -e3000000000e cvbg RXE_RRRD "convert to binary 64" esame -e30000000024 stg RXE_RRRD "store 64" esame -e30000000080 ng RXE_RRRD "and 64" esame -e30000000021 clg RXE_RRRD "compare logical 64" esame -e30000000031 clgf RXE_RRRD "comparee logical 64<32" esame -e30000000081 og RXE_RRRD "or 64" esame -e30000000082 xg RXE_RRRD "exclusive or 64" esame -e30000000004 lg RXE_RRRD "load 64" esame -e30000000014 lgf RXE_RRRD "load 64<32" esame -e30000000015 lgh RXE_RRRD "load halfword 64" esame -e30000000020 cg RXE_RRRD "compare 64" esame -e30000000030 cgf RXE_RRRD "compare 64<32" esame -e30000000008 ag RXE_RRRD "add 64" esame -e30000000018 agf RXE_RRRD "add 64<32" esame -e30000000009 sg RXE_RRRD "subtract 64" esame -e30000000019 sgf RXE_RRRD "subtract 64<32" esame -e3000000000a alg RXE_RRRD "add logical 64" esame -e3000000001a algf RXE_RRRD "add logical 64<32" esame -e3000000000b slg RXE_RRRD "subtract logical 64" esame -e3000000001b slgf RXE_RRRD "subtract logical 64<32" esame -e3000000000c msg RXE_RRRD "multiply single 64" esame -e3000000001c msgf RXE_RRRD "multiply single 64<32" esame -ec0000000044 brxhg RIE_RRP "branch relative on index high 64" esame -ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" esame -eb0000000044 bxhg RSE_RRRD "branch on index high 64" esame -eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" esame -eb000000000c srlg RSE_RRRD "shift right single logical 64" esame -eb000000000d sllg RSE_RRRD "shift left single logical 64" esame -eb000000000a srag RSE_RRRD "shift right single 64" esame -eb000000000b slag RSE_RRRD "shift left single 64" esame -eb0000000024 stmg RSE_RRRD "store multiple 64" esame -eb0000000026 stmh RSE_RRRD "store multiple high" esame -eb0000000004 lmg RSE_RRRD "load multiple 64" esame -eb0000000096 lmh RSE_RRRD "load multiple high" esame -ef lmd SS_RRRDRD3 "load multiple disjoint" esame -eb000000000f tracg RSE_RRRD "trace 64" esame -e30000000003 lrag RXE_RRRD "load real address 64" esame -e50000000002 strag SSE_RDRD "store read address" esame -eb0000000025 stctg RSE_RRRD "store control 64" esame -eb000000002f lctlg RSE_RRRD "load control 64" esame -eb0000000030 csg RSE_RRRD "compare and swap 64" esame -eb000000003e cdsg RSE_RRRD "compare double and swap 64" esame -eb0000000020 clmh RSE_RURD "compare logical characters under mask high" esame -eb000000002c stcmh RSE_RURD "store characters under mask high" esame -eb0000000080 icmh RSE_RURD "insert characters under mask high" esame -a700 tmlh RI_RU "test under mask low high" esame -a702 tmhh RI_RU "test under mask high high" esame -a701 tmll RI_RU "test under mask low low" esame -a703 tmhl RI_RU "test under mask high low" esame -c004 brcl RIL_UP "branch relative on condition long" esame -c014 jgo RIL_0P "jump long on overflow / if ones" esame -c024 jgh RIL_0P "jump long on high" esame -c024 jgp RIL_0P "jump long on plus" esame -c034 jgnle RIL_0P "jump long on not low or equal" esame -c044 jgl RIL_0P "jump long on low" esame -c044 jgm RIL_0P "jump long on minus / if mixed" esame -c054 jgnhe RIL_0P "jump long on not high or equal" esame -c064 jglh RIL_0P "jump long on low or high" esame -c074 jgne RIL_0P "jump long on not equal" esame -c074 jgnz RIL_0P "jump long on not zero / if not zeros" esame -c084 jge RIL_0P "jump long on equal" esame -c084 jgz RIL_0P "jump long on zero / if zeros" esame -c094 jgnlh RIL_0P "jump long on not low or high" esame -c0a4 jghe RIL_0P "jump long on high or equal" esame -c0b4 jgnl RIL_0P "jump long on not low" esame -c0b4 jgnm RIL_0P "jump long on not minus / if not mixed" esame -c0c4 jgle RIL_0P "jump long on low or equal" esame -c0d4 jgnh RIL_0P "jump long on not high" esame -c0d4 jgnp RIL_0P "jump long on not plus" esame -c0e4 jgno RIL_0P "jump long on not overflow / if not ones" esame -c0f4 jg RIL_0P "jump long" esame -c005 brasl RIL_RP "branch relative and save long" esame -a707 brctg RI_RP "branch relative on count 64" esame -a709 lghi RI_RI "load halfword immediate 64" esame -a70b aghi RI_RI "add halfword immediate 64" esame -a70d mghi RI_RI "multiply halfword immediate 64" esame -a70f cghi RI_RI "compare halfword immediate 64" esame -b925 sturg RRE_RR "store using real address 64" esame -b90e eregg RRE_RR "extract stacked registers 64" esame -b905 lurag RRE_RR "load using real address 64" esame -b90c msgr RRE_RR "multiply single 64" esame -b91c msgfr RRE_RR "multiply single 64<32" esame -b3a4 cegbr RRE_RR "convert from fixed 64 to short bfp" esame -b3a5 cdgbr RRE_RR "convert from fixed 64 to long bfp" esame -b3a6 cxgbr RRE_RR "convert from fixed 64 to extended bfp" esame -b3a8 cgebr RRF_U0FR "convert to fixed short bfd to 64" esame -b3a9 cgdbr RRF_U0FR "convert to fixed long bfp to 64" esame -b3aa cgxbr RRF_U0FR "convert to fixed extended bfp to 64" esame -b3c4 cegr RRE_RR "convert from fixed 64 to short hfp" esame -b3c5 cdgr RRE_RR "convert from fixed 64 to long hfp" esame -b3c6 cxgr RRE_RR "convert from fixed 64 to extended hfp" esame -b3c8 cger RRF_U0FR "convert to fixed short hfp to 64" esame -b3c9 cgdr RRF_U0FR "convert to fixed long hfp to 64" esame -b3ca cgxr RRF_U0FR "convert to fixed extended hfp to 64" esame -010b tam E "test addressing mode" esame -010c sam24 E "set addressing mode 24" esame -010d sam31 E "set addressing mode 31" esame -010e sam64 E "set addressing mode 64" esame -a500 iihh RI_RU "insert immediate high high" esame -a501 iihl RI_RU "insert immediate high low" esame -a502 iilh RI_RU "insert immediate low high" esame -a503 iill RI_RU "insert immediate low low" esame -a504 nihh RI_RU "and immediate high high" esame -a505 nihl RI_RU "and immediate high low" esame -a506 nilh RI_RU "and immediate low high" esame -a507 nill RI_RU "and immediate low low" esame -a508 oihh RI_RU "or immediate high high" esame -a509 oihl RI_RU "or immediate high low" esame -a50a oilh RI_RU "or immediate low high" esame -a50b oill RI_RU "or immediate low low" esame -a50c llihh RI_RU "load logical immediate high high" esame -a50d llihl RI_RU "load logical immediate high low" esame -a50e llilh RI_RU "load logical immediate low high" esame -a50f llill RI_RU "load logical immediate low low" esame -b2b1 stfl S_RD "store facility list" esame -b2b2 lpswe S_RD "load psw extended" esame -b90d dsgr RRE_RR "divide single 64" esame -b90f lrvgr RRE_RR "load reversed 64" esame -b916 llgfr RRE_RR "load logical 64<32" esame -b917 llgtr RRE_RR "load logical thirty one bits" esame -b91d dsgfr RRE_RR "divide single 64<32" esame -b91f lrvr RRE_RR "load reversed 32" esame -b986 mlgr RRE_RR "multiply logical 64" esame -b987 dlgr RRE_RR "divide logical 64" esame -b988 alcgr RRE_RR "add logical with carry 64" esame -b989 slbgr RRE_RR "subtract logical with borrow 64" esame -b98d epsw RRE_RR "extract psw" esame -b996 mlr RRE_RR "multiply logical 32" esame -b997 dlr RRE_RR "divide logical 32" esame -b998 alcr RRE_RR "add logical with carry 32" esame -b999 slbr RRE_RR "subtract logical with borrow 32" esame -b99d esea RRE_R0 "extract and set extended authority" esame -c000 larl RIL_RP "load address relative long" esame -e3000000000d dsg RXE_RRRD "divide single 64" esame -e3000000000f lrvg RXE_RRRD "load reversed 64" esame -e30000000016 llgf RXE_RRRD "load logical 64<32" esame -e30000000017 llgt RXE_RRRD "load logical thirty one bits" esame -e3000000001d dsgf RXE_RRRD "divide single 64<32" esame -e3000000001e lrv RXE_RRRD "load reversed 32" esame -e3000000001f lrvh RXE_RRRD "load reversed 16" esame -e3000000002f strvg RXE_RRRD "store reversed 64" esame -e3000000003e strv RXE_RRRD "store reversed 32" esame -e3000000003f strvh RXE_RRRD "store reversed 64" esame -e30000000086 mlg RXE_RRRD "multiply logical 64" esame -e30000000087 dlg RXE_RRRD "divide logical 64" esame -e30000000088 alcg RXE_RRRD "add logical with carry 64" esame -e30000000089 slbg RXE_RRRD "subtract logical with borrow 64" esame -e3000000008e stpq RXE_RRRD "store pair to quadword" esame -e3000000008f lpq RXE_RRRD "load pair from quadword" esame -e30000000096 ml RXE_RRRD "multiply logical 32" esame -e30000000097 dl RXE_RRRD "divide logical 32" esame -e30000000098 alc RXE_RRRD "add logical with carry 32" esame -e30000000099 slb RXE_RRRD "subtract logical with borrow 32" esame -e30000000090 llgc RXE_RRRD "load logical character" esame -e30000000091 llgh RXE_RRRD "load logical halfword" esame -eb000000001c rllg RSE_RRRD "rotate left single logical 64" esame -eb000000001d rll RSE_RRRD "rotate left single logical 32" esame -b278 stcke S_RD "store clock extended" esame -b2a5 tre RRE_RR "translate extended" esame -eb000000008e mvclu RSE_RRRD "move long unicode" esame -e9 pka SS_L0RDRD "pack ascii" esame -e1 pku SS_L0RDRD "pack unicode" esame -b993 troo RRE_RR "translate one to one" esame -b992 trot RRE_RR "translate one to two" esame -b991 trto RRE_RR "translate two to one" esame -b990 trtt RRE_RR "translate two to two" esame -ea unpka SS_L0RDRD "unpack ascii" esame -e2 unpku SS_L0RDRD "unpack unicode" esame -b358 thder RRE_RR "convert short bfp to long hfp" esame -b359 thdr RRE_RR "convert long bfp to long hfp" esame -b350 tbedr RRF_U0FF "convert long hfp to short bfp" esame -b351 tbdr RRF_U0FF "convert long hfp to long bfp" esame -b374 lzer RRE_R0 "load short zero" esame -b375 lzdr RRE_R0 "load long zero" esame -b376 lzxr RRE_R0 "load extended zero" esame +b946 bctgr RRE_RR "branch on count 64" z900 zarch +b900 lpgr RRE_RR "load positive 64" z900 zarch +b910 lpgfr RRE_RR "load positive 64<32" z900 zarch +b901 lngr RRE_RR "load negative 64" z900 zarch +b911 lngfr RRE_RR "load negative 64<32" z900 zarch +b902 ltgr RRE_RR "load and test 64" z900 zarch +b912 ltgfr RRE_RR "load and test 64<32" z900 zarch +b903 lcgr RRE_RR "load complement 64" z900 zarch +b913 lcgfr RRE_RR "load complement 64<32" z900 zarch +b980 ngr RRE_RR "and 64" z900 zarch +b921 clgr RRE_RR "compare logical 64" z900 zarch +b931 clgfr RRE_RR "compare logical 64<32" z900 zarch +b981 ogr RRE_RR "or 64" z900 zarch +b982 xgr RRE_RR "exclusive or 64" z900 zarch +b904 lgr RRE_RR "load 64" z900 zarch +b914 lgfr RRE_RR "load 64<32" z900 zarch +b920 cgr RRE_RR "compare 64" z900 zarch +b930 cgfr RRE_RR "compare 64<32" z900 zarch +b908 agr RRE_RR "add 64" z900 zarch +b918 agfr RRE_RR "add 64<32" z900 zarch +b909 sgr RRE_RR "subtract 64" z900 zarch zarch +b919 sgfr RRE_RR "subtract 64<32" z900 zarch +b90a algr RRE_RR "add logical 64" z900 zarch +b91a algfr RRE_RR "add logical 64<32" z900 zarch +b90b slgr RRE_RR "subtract logical 64" z900 zarch +b91b slgfr RRE_RR "subtract logical 64<32" z900 zarch +e30000000046 bctg RXE_RRRD "branch on count 64" z900 zarch +e3000000002e cvdg RXE_RRRD "convert to decimal 64" z900 zarch +e3000000000e cvbg RXE_RRRD "convert to binary 64" z900 zarch +e30000000024 stg RXE_RRRD "store 64" z900 zarch +e30000000080 ng RXE_RRRD "and 64" z900 zarch +e30000000021 clg RXE_RRRD "compare logical 64" z900 zarch +e30000000031 clgf RXE_RRRD "comparee logical 64<32" z900 zarch +e30000000081 og RXE_RRRD "or 64" z900 zarch +e30000000082 xg RXE_RRRD "exclusive or 64" z900 zarch +e30000000004 lg RXE_RRRD "load 64" z900 zarch +e30000000014 lgf RXE_RRRD "load 64<32" z900 zarch +e30000000015 lgh RXE_RRRD "load halfword 64" z900 zarch +e30000000020 cg RXE_RRRD "compare 64" z900 zarch +e30000000030 cgf RXE_RRRD "compare 64<32" z900 zarch +e30000000008 ag RXE_RRRD "add 64" z900 zarch +e30000000018 agf RXE_RRRD "add 64<32" z900 zarch +e30000000009 sg RXE_RRRD "subtract 64" z900 zarch +e30000000019 sgf RXE_RRRD "subtract 64<32" z900 zarch +e3000000000a alg RXE_RRRD "add logical 64" z900 zarch +e3000000001a algf RXE_RRRD "add logical 64<32" z900 zarch +e3000000000b slg RXE_RRRD "subtract logical 64" z900 zarch +e3000000001b slgf RXE_RRRD "subtract logical 64<32" z900 zarch +e3000000000c msg RXE_RRRD "multiply single 64" z900 zarch +e3000000001c msgf RXE_RRRD "multiply single 64<32" z900 zarch +ec0000000044 brxhg RIE_RRP "branch relative on index high 64" z900 zarch +ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" z900 zarch +eb0000000044 bxhg RSE_RRRD "branch on index high 64" z900 zarch +eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" z900 zarch +eb000000000c srlg RSE_RRRD "shift right single logical 64" z900 zarch +eb000000000d sllg RSE_RRRD "shift left single logical 64" z900 zarch +eb000000000a srag RSE_RRRD "shift right single 64" z900 zarch +eb000000000b slag RSE_RRRD "shift left single 64" z900 zarch +eb0000000024 stmg RSE_RRRD "store multiple 64" z900 zarch +eb0000000026 stmh RSE_RRRD "store multiple high" z900 zarch +eb0000000004 lmg RSE_RRRD "load multiple 64" z900 zarch +eb0000000096 lmh RSE_RRRD "load multiple high" z900 zarch +ef lmd SS_RRRDRD3 "load multiple disjoint" z900 zarch +eb000000000f tracg RSE_RRRD "trace 64" z900 zarch +e30000000003 lrag RXE_RRRD "load real address 64" z900 zarch +e50000000002 strag SSE_RDRD "store read address" z900 zarch +eb0000000025 stctg RSE_RRRD "store control 64" z900 zarch +eb000000002f lctlg RSE_RRRD "load control 64" z900 zarch +eb0000000030 csg RSE_RRRD "compare and swap 64" z900 zarch +eb000000003e cdsg RSE_RRRD "compare double and swap 64" z900 zarch +eb0000000020 clmh RSE_RURD "compare logical characters under mask high" z900 zarch +eb000000002c stcmh RSE_RURD "store characters under mask high" z900 zarch +eb0000000080 icmh RSE_RURD "insert characters under mask high" z900 zarch +a702 tmhh RI_RU "test under mask high high" z900 zarch +a703 tmhl RI_RU "test under mask high low" z900 zarch +c004 brcl RIL_UP "branch relative on condition long" z900 esa,zarch +c014 jgo RIL_0P "jump long on overflow / if ones" z900 esa,zarch +c024 jgh RIL_0P "jump long on high" z900 esa,zarch +c024 jgp RIL_0P "jump long on plus" z900 esa,zarch +c034 jgnle RIL_0P "jump long on not low or equal" z900 esa,zarch +c044 jgl RIL_0P "jump long on low" z900 esa,zarch +c044 jgm RIL_0P "jump long on minus / if mixed" z900 esa,zarch +c054 jgnhe RIL_0P "jump long on not high or equal" z900 esa,zarch +c064 jglh RIL_0P "jump long on low or high" z900 esa,zarch +c074 jgne RIL_0P "jump long on not equal" z900 esa,zarch +c074 jgnz RIL_0P "jump long on not zero / if not zeros" z900 esa,zarch +c084 jge RIL_0P "jump long on equal" z900 esa,zarch +c084 jgz RIL_0P "jump long on zero / if zeros" z900 esa,zarch +c094 jgnlh RIL_0P "jump long on not low or high" z900 esa,zarch +c0a4 jghe RIL_0P "jump long on high or equal" z900 esa,zarch +c0b4 jgnl RIL_0P "jump long on not low" z900 esa,zarch +c0b4 jgnm RIL_0P "jump long on not minus / if not mixed" z900 esa,zarch +c0c4 jgle RIL_0P "jump long on low or equal" z900 esa,zarch +c0d4 jgnh RIL_0P "jump long on not high" z900 esa,zarch +c0d4 jgnp RIL_0P "jump long on not plus" z900 esa,zarch +c0e4 jgno RIL_0P "jump long on not overflow / if not ones" z900 esa,zarch +c0f4 jg RIL_0P "jump long" z900 esa,zarch +c005 brasl RIL_RP "branch relative and save long" z900 esa,zarch +a707 brctg RI_RP "branch relative on count 64" z900 zarch +a709 lghi RI_RI "load halfword immediate 64" z900 zarch +a70b aghi RI_RI "add halfword immediate 64" z900 zarch +a70d mghi RI_RI "multiply halfword immediate 64" z900 zarch +a70f cghi RI_RI "compare halfword immediate 64" z900 zarch +b925 sturg RRE_RR "store using real address 64" z900 zarch +b90e eregg RRE_RR "extract stacked registers 64" z900 zarch +b905 lurag RRE_RR "load using real address 64" z900 zarch +b90c msgr RRE_RR "multiply single 64" z900 zarch +b91c msgfr RRE_RR "multiply single 64<32" z900 zarch +b3a4 cegbr RRE_RR "convert from fixed 64 to short bfp" z900 zarch +b3a5 cdgbr RRE_RR "convert from fixed 64 to long bfp" z900 zarch +b3a6 cxgbr RRE_RR "convert from fixed 64 to extended bfp" z900 zarch +b3a8 cgebr RRF_U0FR "convert to fixed short bfd to 64" z900 zarch +b3a9 cgdbr RRF_U0FR "convert to fixed long bfp to 64" z900 zarch +b3aa cgxbr RRF_U0FR "convert to fixed extended bfp to 64" z900 zarch +b3c4 cegr RRE_RR "convert from fixed 64 to short hfp" z900 zarch +b3c5 cdgr RRE_RR "convert from fixed 64 to long hfp" z900 zarch +b3c6 cxgr RRE_RR "convert from fixed 64 to extended hfp" z900 zarch +b3c8 cger RRF_U0FR "convert to fixed short hfp to 64" z900 zarch +b3c9 cgdr RRF_U0FR "convert to fixed long hfp to 64" z900 zarch +b3ca cgxr RRF_U0FR "convert to fixed extended hfp to 64" z900 zarch +010b tam E "test addressing mode" z900 esa,zarch +010c sam24 E "set addressing mode 24" z900 esa,zarch +010d sam31 E "set addressing mode 31" z900 esa,zarch +010e sam64 E "set addressing mode 64" z900 zarch +a500 iihh RI_RU "insert immediate high high" z900 zarch +a501 iihl RI_RU "insert immediate high low" z900 zarch +a502 iilh RI_RU "insert immediate low high" z900 zarch +a503 iill RI_RU "insert immediate low low" z900 zarch +a504 nihh RI_RU "and immediate high high" z900 zarch +a505 nihl RI_RU "and immediate high low" z900 zarch +a506 nilh RI_RU "and immediate low high" z900 zarch +a507 nill RI_RU "and immediate low low" z900 zarch +a508 oihh RI_RU "or immediate high high" z900 zarch +a509 oihl RI_RU "or immediate high low" z900 zarch +a50a oilh RI_RU "or immediate low high" z900 zarch +a50b oill RI_RU "or immediate low low" z900 zarch +a50c llihh RI_RU "load logical immediate high high" z900 zarch +a50d llihl RI_RU "load logical immediate high low" z900 zarch +a50e llilh RI_RU "load logical immediate low high" z900 zarch +a50f llill RI_RU "load logical immediate low low" z900 zarch +b2b1 stfl S_RD "store facility list" z900 esa,zarch +b2b2 lpswe S_RD "load psw extended" z900 zarch +b90d dsgr RRE_RR "divide single 64" z900 zarch +b90f lrvgr RRE_RR "load reversed 64" z900 zarch +b916 llgfr RRE_RR "load logical 64<32" z900 zarch +b917 llgtr RRE_RR "load logical thirty one bits" z900 zarch +b91d dsgfr RRE_RR "divide single 64<32" z900 zarch +b91f lrvr RRE_RR "load reversed 32" z900 esa,zarch +b986 mlgr RRE_RR "multiply logical 64" z900 zarch +b987 dlgr RRE_RR "divide logical 64" z900 zarch +b988 alcgr RRE_RR "add logical with carry 64" z900 zarch +b989 slbgr RRE_RR "subtract logical with borrow 64" z900 zarch +b98d epsw RRE_RR "extract psw" z900 esa,zarch +b996 mlr RRE_RR "multiply logical 32" z900 esa,zarch +b997 dlr RRE_RR "divide logical 32" z900 esa,zarch +b998 alcr RRE_RR "add logical with carry 32" z900 esa,zarch +b999 slbr RRE_RR "subtract logical with borrow 32" z900 esa,zarch +b99d esea RRE_R0 "extract and set extended authority" z900 zarch +c000 larl RIL_RP "load address relative long" z900 esa,zarch +e3000000000d dsg RXE_RRRD "divide single 64" z900 zarch +e3000000000f lrvg RXE_RRRD "load reversed 64" z900 zarch +e30000000016 llgf RXE_RRRD "load logical 64<32" z900 zarch +e30000000017 llgt RXE_RRRD "load logical thirty one bits" z900 zarch +e3000000001d dsgf RXE_RRRD "divide single 64<32" z900 zarch +e3000000001e lrv RXE_RRRD "load reversed 32" z900 esa,zarch +e3000000001f lrvh RXE_RRRD "load reversed 16" z900 esa,zarch +e3000000002f strvg RXE_RRRD "store reversed 64" z900 zarch +e3000000003e strv RXE_RRRD "store reversed 32" z900 esa,zarch +e3000000003f strvh RXE_RRRD "store reversed 64" z900 esa,zarch +e30000000086 mlg RXE_RRRD "multiply logical 64" z900 zarch +e30000000087 dlg RXE_RRRD "divide logical 64" z900 zarch +e30000000088 alcg RXE_RRRD "add logical with carry 64" z900 zarch +e30000000089 slbg RXE_RRRD "subtract logical with borrow 64" z900 zarch +e3000000008e stpq RXE_RRRD "store pair to quadword" z900 zarch +e3000000008f lpq RXE_RRRD "load pair from quadword" z900 zarch +e30000000096 ml RXE_RRRD "multiply logical 32" z900 esa,zarch +e30000000097 dl RXE_RRRD "divide logical 32" z900 esa,zarch +e30000000098 alc RXE_RRRD "add logical with carry 32" z900 esa,zarch +e30000000099 slb RXE_RRRD "subtract logical with borrow 32" z900 esa,zarch +e30000000090 llgc RXE_RRRD "load logical character" z900 zarch +e30000000091 llgh RXE_RRRD "load logical halfword" z900 zarch +eb000000001c rllg RSE_RRRD "rotate left single logical 64" z900 zarch +eb000000001d rll RSE_RRRD "rotate left single logical 32" z900 esa,zarch diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c index b991693..8e452c0 100644 --- a/opcodes/tic4x-dis.c +++ b/opcodes/tic4x-dis.c @@ -1,6 +1,6 @@ /* Print instructions for the Texas TMS320C[34]X, for GDB and GNU Binutils. - Copyright 2002 Free Software Foundation, Inc. + Copyright 2002, 2003 Free Software Foundation, Inc. Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz) @@ -23,10 +23,10 @@ #include "dis-asm.h" #include "opcode/tic4x.h" -#define C4X_DEBUG 0 +#define TIC4X_DEBUG 0 -#define C4X_HASH_SIZE 11 /* 11 (bits) and above should give unique entries. */ -#define C4X_SPESOP_SIZE 8 /* Max 8. ops for special instructions */ +#define TIC4X_HASH_SIZE 11 /* 11 (bits) and above should give unique entries. */ +#define TIC4X_SPESOP_SIZE 8 /* Max 8. ops for special instructions */ typedef enum { @@ -43,49 +43,49 @@ typedef enum { INDIRECT_SHORT, INDIRECT_LONG, - INDIRECT_C4X + INDIRECT_TIC4X } indirect_t; -static int c4x_version = 0; -static int c4x_dp = 0; +static int tic4x_version = 0; +static int tic4x_dp = 0; -static int c4x_pc_offset +static int tic4x_pc_offset PARAMS ((unsigned int)); -static int c4x_print_char +static int tic4x_print_char PARAMS ((struct disassemble_info *, char)); -static int c4x_print_str +static int tic4x_print_str PARAMS ((struct disassemble_info *, char *)); -static int c4x_print_register +static int tic4x_print_register PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_addr +static int tic4x_print_addr PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_relative +static int tic4x_print_relative PARAMS ((struct disassemble_info *, unsigned long, long, unsigned long)); -void c4x_print_ftoa +void tic4x_print_ftoa PARAMS ((unsigned int, FILE *, fprintf_ftype)); -static int c4x_print_direct +static int tic4x_print_direct PARAMS ((struct disassemble_info *, unsigned long)); -static int c4x_print_immed +static int tic4x_print_immed PARAMS ((struct disassemble_info *, immed_t, unsigned long)); -static int c4x_print_cond +static int tic4x_print_cond PARAMS ((struct disassemble_info *, unsigned int)); -static int c4x_print_indirect +static int tic4x_print_indirect PARAMS ((struct disassemble_info *, indirect_t, unsigned long)); -static int c4x_print_op - PARAMS ((struct disassemble_info *, unsigned long, c4x_inst_t *, unsigned long)); -static void c4x_hash_opcode_special - PARAMS ((c4x_inst_t **, const c4x_inst_t *)); -static void c4x_hash_opcode - PARAMS ((c4x_inst_t **, c4x_inst_t **, const c4x_inst_t *, unsigned long)); -static int c4x_disassemble +static int tic4x_print_op + PARAMS ((struct disassemble_info *, unsigned long, tic4x_inst_t *, unsigned long)); +static void tic4x_hash_opcode_special + PARAMS ((tic4x_inst_t **, const tic4x_inst_t *)); +static void tic4x_hash_opcode + PARAMS ((tic4x_inst_t **, tic4x_inst_t **, const tic4x_inst_t *, unsigned long)); +static int tic4x_disassemble PARAMS ((unsigned long, unsigned long, struct disassemble_info *)); int print_insn_tic4x PARAMS ((bfd_vma, struct disassemble_info *)); static int -c4x_pc_offset (op) +tic4x_pc_offset (op) unsigned int op; { /* Determine the PC offset for a C[34]x instruction. @@ -143,7 +143,7 @@ c4x_pc_offset (op) } static int -c4x_print_char (info, ch) +tic4x_print_char (info, ch) struct disassemble_info * info; char ch; { @@ -153,7 +153,7 @@ c4x_print_char (info, ch) } static int -c4x_print_str (info, str) +tic4x_print_str (info, str) struct disassemble_info *info; char *str; { @@ -163,28 +163,28 @@ c4x_print_str (info, str) } static int -c4x_print_register (info, regno) +tic4x_print_register (info, regno) struct disassemble_info *info; unsigned long regno; { - static c4x_register_t **registertable = NULL; + static tic4x_register_t **registertable = NULL; unsigned int i; if (registertable == NULL) { - registertable = (c4x_register_t **) - xmalloc (sizeof (c4x_register_t *) * REG_TABLE_SIZE); - for (i = 0; i < c3x_num_registers; i++) - registertable[c3x_registers[i].regno] = (void *)&c3x_registers[i]; - if (IS_CPU_C4X (c4x_version)) + registertable = (tic4x_register_t **) + xmalloc (sizeof (tic4x_register_t *) * REG_TABLE_SIZE); + for (i = 0; i < tic3x_num_registers; i++) + registertable[tic3x_registers[i].regno] = (void *)&tic3x_registers[i]; + if (IS_CPU_TIC4X (tic4x_version)) { /* Add C4x additional registers, overwriting any C3x registers if necessary. */ - for (i = 0; i < c4x_num_registers; i++) - registertable[c4x_registers[i].regno] = (void *)&c4x_registers[i]; + for (i = 0; i < tic4x_num_registers; i++) + registertable[tic4x_registers[i].regno] = (void *)&tic4x_registers[i]; } } - if ((int) regno > (IS_CPU_C4X (c4x_version) ? C4X_REG_MAX : C3X_REG_MAX)) + if ((int) regno > (IS_CPU_TIC4X (tic4x_version) ? TIC4X_REG_MAX : TIC3X_REG_MAX)) return 0; if (info != NULL) (*info->fprintf_func) (info->stream, "%s", registertable[regno]->name); @@ -192,7 +192,7 @@ c4x_print_register (info, regno) } static int -c4x_print_addr (info, addr) +tic4x_print_addr (info, addr) struct disassemble_info *info; unsigned long addr; { @@ -202,24 +202,24 @@ c4x_print_addr (info, addr) } static int -c4x_print_relative (info, pc, offset, opcode) +tic4x_print_relative (info, pc, offset, opcode) struct disassemble_info *info; unsigned long pc; long offset; unsigned long opcode; { - return c4x_print_addr (info, pc + offset + c4x_pc_offset (opcode)); + return tic4x_print_addr (info, pc + offset + tic4x_pc_offset (opcode)); } static int -c4x_print_direct (info, arg) +tic4x_print_direct (info, arg) struct disassemble_info *info; unsigned long arg; { if (info != NULL) { (*info->fprintf_func) (info->stream, "@"); - c4x_print_addr (info, arg + (c4x_dp << 16)); + tic4x_print_addr (info, arg + (tic4x_dp << 16)); } return 1; } @@ -227,7 +227,7 @@ c4x_print_direct (info, arg) /* FIXME: make the floating point stuff not rely on host floating point arithmetic. */ void -c4x_print_ftoa (val, stream, pfunc) +tic4x_print_ftoa (val, stream, pfunc) unsigned int val; FILE *stream; fprintf_ftype pfunc; @@ -253,7 +253,7 @@ c4x_print_ftoa (val, stream, pfunc) } static int -c4x_print_immed (info, type, arg) +tic4x_print_immed (info, type, arg) struct disassemble_info *info; immed_t type; unsigned long arg; @@ -312,18 +312,18 @@ c4x_print_immed (info, type, arg) } static int -c4x_print_cond (info, cond) +tic4x_print_cond (info, cond) struct disassemble_info *info; unsigned int cond; { - static c4x_cond_t **condtable = NULL; + static tic4x_cond_t **condtable = NULL; unsigned int i; if (condtable == NULL) { - condtable = (c4x_cond_t **)xmalloc (sizeof (c4x_cond_t *) * 32); - for (i = 0; i < num_conds; i++) - condtable[c4x_conds[i].cond] = (void *)&c4x_conds[i]; + condtable = (tic4x_cond_t **)xmalloc (sizeof (tic4x_cond_t *) * 32); + for (i = 0; i < tic4x_num_conds; i++) + condtable[tic4x_conds[i].cond] = (void *)&tic4x_conds[i]; } if (cond > 31 || condtable[cond] == NULL) return 0; @@ -333,7 +333,7 @@ c4x_print_cond (info, cond) } static int -c4x_print_indirect (info, type, arg) +tic4x_print_indirect (info, type, arg) struct disassemble_info *info; indirect_t type; unsigned long arg; @@ -348,7 +348,7 @@ c4x_print_indirect (info, type, arg) disp = 1; switch(type) { - case INDIRECT_C4X: /* *+ARn(disp) */ + case INDIRECT_TIC4X: /* *+ARn(disp) */ disp = EXTRU (arg, 7, 3); aregno = EXTRU (arg, 2, 0) + REG_AR0; modn = 0; @@ -366,29 +366,30 @@ c4x_print_indirect (info, type, arg) return 0; break; default: - abort (); + (*info->fprintf_func)(info->stream, "# internal error: Unknown indirect type %d", type); + return 0; } - if (modn > C3X_MODN_MAX) + if (modn > TIC3X_MODN_MAX) return 0; - a = c4x_indirects[modn].name; + a = tic4x_indirects[modn].name; while (*a) { switch (*a) { case 'a': - c4x_print_register (info, aregno); + tic4x_print_register (info, aregno); break; case 'd': - c4x_print_immed (info, IMMED_UINT, disp); + tic4x_print_immed (info, IMMED_UINT, disp); break; case 'y': - c4x_print_str (info, "ir0"); + tic4x_print_str (info, "ir0"); break; case 'z': - c4x_print_str (info, "ir1"); + tic4x_print_str (info, "ir1"); break; default: - c4x_print_char (info, *a); + tic4x_print_char (info, *a); break; } a++; @@ -397,10 +398,10 @@ c4x_print_indirect (info, type, arg) } static int -c4x_print_op (info, instruction, p, pc) +tic4x_print_op (info, instruction, p, pc) struct disassemble_info *info; unsigned long instruction; - c4x_inst_t *p; + tic4x_inst_t *p; unsigned long pc; { int val; @@ -414,18 +415,18 @@ c4x_print_op (info, instruction, p, pc) switch (*s) { case 'B': - if (! c4x_print_cond (info, EXTRU (instruction, 20, 16))) + if (! tic4x_print_cond (info, EXTRU (instruction, 20, 16))) return 0; break; case 'C': - if (! c4x_print_cond (info, EXTRU (instruction, 27, 23))) + if (! tic4x_print_cond (info, EXTRU (instruction, 27, 23))) return 0; break; case '_': parallel = s + 1; /* Skip past `_' in name */ break; default: - c4x_print_char (info, *s); + tic4x_print_char (info, *s); break; } s++; @@ -434,45 +435,45 @@ c4x_print_op (info, instruction, p, pc) /* Print arguments. */ s = p->args; if (*s) - c4x_print_char (info, ' '); + tic4x_print_char (info, ' '); while (*s) { switch (*s) { case '*': /* indirect 0--15 */ - if (! c4x_print_indirect (info, INDIRECT_LONG, + if (! tic4x_print_indirect (info, INDIRECT_LONG, EXTRU (instruction, 15, 0))) return 0; break; case '#': /* only used for ldp, ldpk */ - c4x_print_immed (info, IMMED_UINT, EXTRU (instruction, 15, 0)); + tic4x_print_immed (info, IMMED_UINT, EXTRU (instruction, 15, 0)); break; case '@': /* direct 0--15 */ - c4x_print_direct (info, EXTRU (instruction, 15, 0)); + tic4x_print_direct (info, EXTRU (instruction, 15, 0)); break; case 'A': /* address register 24--22 */ - if (! c4x_print_register (info, EXTRU (instruction, 24, 22) + + if (! tic4x_print_register (info, EXTRU (instruction, 24, 22) + REG_AR0)) return 0; break; case 'B': /* 24-bit unsigned int immediate br(d)/call/rptb address 0--23. */ - if (IS_CPU_C4X (c4x_version)) - c4x_print_relative (info, pc, EXTRS (instruction, 23, 0), + if (IS_CPU_TIC4X (tic4x_version)) + tic4x_print_relative (info, pc, EXTRS (instruction, 23, 0), p->opcode); else - c4x_print_addr (info, EXTRU (instruction, 23, 0)); + tic4x_print_addr (info, EXTRU (instruction, 23, 0)); break; case 'C': /* indirect (short C4x) 0--7 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_indirect (info, INDIRECT_C4X, + if (! tic4x_print_indirect (info, INDIRECT_TIC4X, EXTRU (instruction, 7, 0))) return 0; break; @@ -483,26 +484,26 @@ c4x_print_op (info, instruction, p, pc) case 'E': /* register 0--7 */ case 'e': - if (! c4x_print_register (info, EXTRU (instruction, 7, 0))) + if (! tic4x_print_register (info, EXTRU (instruction, 7, 0))) return 0; break; case 'F': /* 16-bit float immediate 0--15 */ - c4x_print_immed (info, IMMED_SFLOAT, + tic4x_print_immed (info, IMMED_SFLOAT, EXTRU (instruction, 15, 0)); break; case 'i': /* Extended indirect 0--7 */ if ( EXTRU (instruction, 7, 5) == 7 ) { - if( !c4x_print_register (info, EXTRU (instruction, 4, 0)) ) + if( !tic4x_print_register (info, EXTRU (instruction, 4, 0)) ) return 0; break; } /* Fallthrough */ case 'I': /* indirect (short) 0--7 */ - if (! c4x_print_indirect (info, INDIRECT_SHORT, + if (! tic4x_print_indirect (info, INDIRECT_SHORT, EXTRU (instruction, 7, 0))) return 0; break; @@ -510,106 +511,106 @@ c4x_print_op (info, instruction, p, pc) case 'j': /* Extended indirect 8--15 */ if ( EXTRU (instruction, 15, 13) == 7 ) { - if( !c4x_print_register (info, EXTRU (instruction, 12, 8)) ) + if( !tic4x_print_register (info, EXTRU (instruction, 12, 8)) ) return 0; break; } case 'J': /* indirect (short) 8--15 */ - if (! c4x_print_indirect (info, INDIRECT_SHORT, + if (! tic4x_print_indirect (info, INDIRECT_SHORT, EXTRU (instruction, 15, 8))) return 0; break; case 'G': /* register 8--15 */ case 'g': - if (! c4x_print_register (info, EXTRU (instruction, 15, 8))) + if (! tic4x_print_register (info, EXTRU (instruction, 15, 8))) return 0; break; case 'H': /* register 16--18 */ - if (! c4x_print_register (info, EXTRU (instruction, 18, 16))) + if (! tic4x_print_register (info, EXTRU (instruction, 18, 16))) return 0; break; case 'K': /* register 19--21 */ - if (! c4x_print_register (info, EXTRU (instruction, 21, 19))) + if (! tic4x_print_register (info, EXTRU (instruction, 21, 19))) return 0; break; case 'L': /* register 22--24 */ - if (! c4x_print_register (info, EXTRU (instruction, 24, 22))) + if (! tic4x_print_register (info, EXTRU (instruction, 24, 22))) return 0; break; case 'M': /* register 22--22 */ - c4x_print_register (info, EXTRU (instruction, 22, 22) + REG_R2); + tic4x_print_register (info, EXTRU (instruction, 22, 22) + REG_R2); break; case 'N': /* register 23--23 */ - c4x_print_register (info, EXTRU (instruction, 23, 23) + REG_R0); + tic4x_print_register (info, EXTRU (instruction, 23, 23) + REG_R0); break; case 'O': /* indirect (short C4x) 8--15 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_indirect (info, INDIRECT_C4X, + if (! tic4x_print_indirect (info, INDIRECT_TIC4X, EXTRU (instruction, 15, 8))) return 0; break; case 'P': /* displacement 0--15 (used by Bcond and BcondD) */ - c4x_print_relative (info, pc, EXTRS (instruction, 15, 0), + tic4x_print_relative (info, pc, EXTRS (instruction, 15, 0), p->opcode); break; case 'Q': /* register 0--15 */ case 'q': - if (! c4x_print_register (info, EXTRU (instruction, 15, 0))) + if (! tic4x_print_register (info, EXTRU (instruction, 15, 0))) return 0; break; case 'R': /* register 16--20 */ case 'r': - if (! c4x_print_register (info, EXTRU (instruction, 20, 16))) + if (! tic4x_print_register (info, EXTRU (instruction, 20, 16))) return 0; break; case 'S': /* 16-bit signed immediate 0--15 */ - c4x_print_immed (info, IMMED_SINT, + tic4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 15, 0)); break; case 'T': /* 5-bit signed immediate 16--20 (C4x stik) */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - if (! c4x_print_immed (info, IMMED_SUINT, + if (! tic4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 20, 16))) return 0; break; case 'U': /* 16-bit unsigned int immediate 0--15 */ - c4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 15, 0)); + tic4x_print_immed (info, IMMED_SUINT, EXTRU (instruction, 15, 0)); break; case 'V': /* 5/9-bit unsigned vector 0--4/8 */ - c4x_print_immed (info, IMMED_SUINT, - IS_CPU_C4X (c4x_version) ? + tic4x_print_immed (info, IMMED_SUINT, + IS_CPU_TIC4X (tic4x_version) ? EXTRU (instruction, 8, 0) : EXTRU (instruction, 4, 0) & ~0x20); break; case 'W': /* 8-bit signed immediate 0--7 */ - if (! IS_CPU_C4X (c4x_version)) + if (! IS_CPU_TIC4X (tic4x_version)) return 0; - c4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 7, 0)); + tic4x_print_immed (info, IMMED_SINT, EXTRS (instruction, 7, 0)); break; case 'X': /* expansion register 4--0 */ val = EXTRU (instruction, 4, 0) + REG_IVTP; if (val < REG_IVTP || val > REG_TVTP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; @@ -617,7 +618,7 @@ c4x_print_op (info, instruction, p, pc) val = EXTRU (instruction, 20, 16); if (val < REG_AR0 || val > REG_SP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; @@ -625,22 +626,22 @@ c4x_print_op (info, instruction, p, pc) val = EXTRU (instruction, 20, 16) + REG_IVTP; if (val < REG_IVTP || val > REG_TVTP) return 0; - if (! c4x_print_register (info, val)) + if (! tic4x_print_register (info, val)) return 0; break; case '|': /* Parallel instruction */ - c4x_print_str (info, " || "); - c4x_print_str (info, parallel); - c4x_print_char (info, ' '); + tic4x_print_str (info, " || "); + tic4x_print_str (info, parallel); + tic4x_print_char (info, ' '); break; case ';': - c4x_print_char (info, ','); + tic4x_print_char (info, ','); break; default: - c4x_print_char (info, *s); + tic4x_print_char (info, *s); break; } s++; @@ -649,13 +650,13 @@ c4x_print_op (info, instruction, p, pc) } static void -c4x_hash_opcode_special (optable_special, inst) - c4x_inst_t **optable_special; - const c4x_inst_t *inst; +tic4x_hash_opcode_special (optable_special, inst) + tic4x_inst_t **optable_special; + const tic4x_inst_t *inst; { int i; - for( i=0; i<C4X_SPESOP_SIZE; i++ ) + for( i=0; i<TIC4X_SPESOP_SIZE; i++ ) if( optable_special[i] != NULL && optable_special[i]->opcode == inst->opcode ) { @@ -664,7 +665,7 @@ c4x_hash_opcode_special (optable_special, inst) return; } - for( i=0; i<C4X_SPESOP_SIZE; i++ ) + for( i=0; i<TIC4X_SPESOP_SIZE; i++ ) if( optable_special[i] == NULL ) { /* Add the new opcode */ @@ -673,32 +674,32 @@ c4x_hash_opcode_special (optable_special, inst) } /* This should never occur. This happens if the number of special - instructions exceeds C4X_SPESOP_SIZE. Please increase the variable + instructions exceeds TIC4X_SPESOP_SIZE. Please increase the variable of this variable */ -#if C4X_DEBUG - printf("optable_special[] is full, please increase C4X_SPESOP_SIZE!\n"); +#if TIC4X_DEBUG + printf("optable_special[] is full, please increase TIC4X_SPESOP_SIZE!\n"); #endif } static void -c4x_hash_opcode (optable, optable_special, inst, c4x_oplevel) - c4x_inst_t **optable; - c4x_inst_t **optable_special; - const c4x_inst_t *inst; - const unsigned long c4x_oplevel; +tic4x_hash_opcode (optable, optable_special, inst, tic4x_oplevel) + tic4x_inst_t **optable; + tic4x_inst_t **optable_special; + const tic4x_inst_t *inst; + const unsigned long tic4x_oplevel; { int j; - int opcode = inst->opcode >> (32 - C4X_HASH_SIZE); - int opmask = inst->opmask >> (32 - C4X_HASH_SIZE); + int opcode = inst->opcode >> (32 - TIC4X_HASH_SIZE); + int opmask = inst->opmask >> (32 - TIC4X_HASH_SIZE); - /* Use a C4X_HASH_SIZE bit index as a hash index. We should + /* Use a TIC4X_HASH_SIZE bit index as a hash index. We should have unique entries so there's no point having a linked list for each entry? */ for (j = opcode; j < opmask; j++) if ( (j & opmask) == opcode - && inst->oplevel & c4x_oplevel ) + && inst->oplevel & tic4x_oplevel ) { -#if C4X_DEBUG +#if TIC4X_DEBUG /* We should only have collisions for synonyms like ldp for ldi. */ if (optable[j] != NULL) @@ -710,13 +711,13 @@ c4x_hash_opcode (optable, optable_special, inst, c4x_oplevel) hash. Store them in a special-list, that will handle full 32-bit INSN, not only the first 11-bit (or so). */ if ( optable[j] != NULL - && inst->opmask & ~(opmask << (32 - C4X_HASH_SIZE)) ) + && inst->opmask & ~(opmask << (32 - TIC4X_HASH_SIZE)) ) { /* Add the instruction already on the list */ - c4x_hash_opcode_special(optable_special, optable[j]); + tic4x_hash_opcode_special(optable_special, optable[j]); /* Add the new instruction */ - c4x_hash_opcode_special(optable_special, inst); + tic4x_hash_opcode_special(optable_special, inst); } optable[j] = (void *)inst; @@ -730,67 +731,67 @@ c4x_hash_opcode (optable, optable_special, inst, c4x_oplevel) The function returns the length of this instruction in words. */ static int -c4x_disassemble (pc, instruction, info) +tic4x_disassemble (pc, instruction, info) unsigned long pc; unsigned long instruction; struct disassemble_info *info; { - static c4x_inst_t **optable = NULL; - static c4x_inst_t **optable_special = NULL; - c4x_inst_t *p; + static tic4x_inst_t **optable = NULL; + static tic4x_inst_t **optable_special = NULL; + tic4x_inst_t *p; int i; - unsigned long c4x_oplevel; + unsigned long tic4x_oplevel; - c4x_version = info->mach; + tic4x_version = info->mach; - c4x_oplevel = (IS_CPU_C4X (c4x_version)) ? OP_C4X : 0; - c4x_oplevel |= OP_C3X|OP_LPWR|OP_IDLE2|OP_ENH; + tic4x_oplevel = (IS_CPU_TIC4X (tic4x_version)) ? OP_C4X : 0; + tic4x_oplevel |= OP_C3X|OP_LPWR|OP_IDLE2|OP_ENH; if (optable == NULL) { - optable = (c4x_inst_t **) - xcalloc (sizeof (c4x_inst_t *), (1 << C4X_HASH_SIZE)); + optable = (tic4x_inst_t **) + xcalloc (sizeof (tic4x_inst_t *), (1 << TIC4X_HASH_SIZE)); - optable_special = (c4x_inst_t **) - xcalloc (sizeof (c4x_inst_t *), C4X_SPESOP_SIZE ); + optable_special = (tic4x_inst_t **) + xcalloc (sizeof (tic4x_inst_t *), TIC4X_SPESOP_SIZE ); /* Install opcodes in reverse order so that preferred forms overwrite synonyms. */ - for (i = c4x_num_insts - 1; i >= 0; i--) - c4x_hash_opcode (optable, optable_special, &c4x_insts[i], c4x_oplevel); + for (i = tic4x_num_insts - 1; i >= 0; i--) + tic4x_hash_opcode (optable, optable_special, &tic4x_insts[i], tic4x_oplevel); /* We now need to remove the insn that are special from the "normal" optable, to make the disasm search this extra list for them. */ - for (i=0; i<C4X_SPESOP_SIZE; i++) + for (i=0; i<TIC4X_SPESOP_SIZE; i++) if ( optable_special[i] != NULL ) - optable[optable_special[i]->opcode >> (32 - C4X_HASH_SIZE)] = NULL; + optable[optable_special[i]->opcode >> (32 - TIC4X_HASH_SIZE)] = NULL; } /* See if we can pick up any loading of the DP register... */ if ((instruction >> 16) == 0x5070 || (instruction >> 16) == 0x1f70) - c4x_dp = EXTRU (instruction, 15, 0); + tic4x_dp = EXTRU (instruction, 15, 0); - p = optable[instruction >> (32 - C4X_HASH_SIZE)]; + p = optable[instruction >> (32 - TIC4X_HASH_SIZE)]; if ( p != NULL ) { if ( ((instruction & p->opmask) == p->opcode) - && c4x_print_op (NULL, instruction, p, pc) ) - c4x_print_op (info, instruction, p, pc); + && tic4x_print_op (NULL, instruction, p, pc) ) + tic4x_print_op (info, instruction, p, pc); else (*info->fprintf_func) (info->stream, "%08x", instruction); } else { - for (i = 0; i<C4X_SPESOP_SIZE; i++) + for (i = 0; i<TIC4X_SPESOP_SIZE; i++) if (optable_special[i] != NULL && optable_special[i]->opcode == instruction ) { (*info->fprintf_func)(info->stream, "%s", optable_special[i]->name); break; } - if (i==C4X_SPESOP_SIZE) + if (i==TIC4X_SPESOP_SIZE) (*info->fprintf_func) (info->stream, "%08x", instruction); } @@ -822,5 +823,5 @@ print_insn_tic4x (memaddr, info) info->bytes_per_chunk = 4; info->octets_per_byte = 4; info->display_endian = BFD_ENDIAN_LITTLE; - return c4x_disassemble (pc, op, info) * 4; + return tic4x_disassemble (pc, op, info) * 4; } diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 5e4b316..a3cd7f2 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,72 @@ +2003-04-13 Nick Clifton <nickc@redhat.com> + + * armvirt.c (GetWord): Only call XScale_check_memacc if in XScale + mode. + (PutWord): Likewise. + +2003-03-30 Nick Clifton <nickc@redhat.com> + + * configure.in (CON_FLAGS): Remove. + (COPRO): Unconditionally include iwmmxt.o. + * configure: Regenerate. + * Makefile.in (CON_FLAGS): Remove. + * armcopro.c: Remove use of __IWMMXT__ flag. + * wrapper.c: Likewise. + * armemu.c: Likewise. + Add explanatory comment for suppressed code. + +2003-03-27 Nick Clifton <nickc@redhat.com> + + * armos.c (ARMul_OsHandleSWI): Catch SWIs for unhandled vectors. + +2003-03-27 Nick Clifton <nickc@redhat.com> + + * configure.in: (CON_FLAGS): Define and intialise. + (COPRO): Add iwmmxt.o if configuring for XScale. + * configure: Regenerate. + * Makefile.in (iwmmxt.o): Add rule to build. + (COM_FLAGS): Define. + (ALL_FLAGS): Add CON_FLAGS. + * armcopro.c (ARMul_CoProInit): Initialise iWMMXt coprocessors. + * armdefs.h (struct ARMul_State): Add 'is_iWMMXt' field. + (ARM_iWMMXt_Prop): Define. + * armemu.c (ARMul_Emulate16): Intercept iWMMXt instructions and + pass to coprocessor. + * arminit.c (ARMul_NewState): Initialise 'is_iWMMXt'. + (ARMul_Abort): Catch branches through uninitialised vectors. + * armos.c (softevtorcode): Update comment. + (ARMul_OsInit): Use ARMUndefinedInstrV. + * wrapper.c (sim_create_inferior): Handle iWMMXt processor type. + (sim_store_register): Handle iWMMXt registers. + (sim_fetch_register): Handle iWMMXt registers. + * iwmmxt.h: New file. Exported iWMMXt coprocessor emulator + functions. + * iwmmxt.c: New file: iWMMXt emulator. + +2003-03-20 Nick Clifton <nickc@redhat.com> + + * Contribute support for Cirrus Maverick ARM co-processor, + written by Aldy Hernandez <aldyh@redhat.com> and + Andrew Cagney <cagney@redhat.com>: + + * maverick.c: New file: Support for Maverick floating point + co-processor. + * Makefile.in: Add maverick.o target. + * configure.in (COPRO): Add maverick.o. + * configure: Regenerate. + * armcopro.c (ARMul_CoProInit): Only initialise co-processors + available on target processor. Add code to initialse Maverick + co-processor support code. + * armdefs.h (ARMul_state): Add is_ep9312 field. + (ARM_ep9312_Prop): Define. + * armemu.h: Add prototypes for Maverick co-processor + functions. + * arminit.c (ARMul_SelectProcessor): Initialise the + co-processor support once the chip has been selected. + * wrapper.c: Add support for Maverick co-processor. + (init): Do not call ARMul_CoProInit. Delays this until the + chip has been selected. + 2003-03-02 Nick Clifton <nickc@redhat.com> * armos.c (SWIWrite0): Catch big-endian bug when printing diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in index 0da765f..7def0f9 100644 --- a/sim/arm/Makefile.in +++ b/sim/arm/Makefile.in @@ -31,6 +31,8 @@ SIM_OBJS = armemu26.o armemu32.o arminit.o armos.o armsupp.o \ armos.o: armos.c armdefs.h armos.h armfpe.h armcopro.o: armcopro.c armdefs.h +maverick.o: maverick.c armdefs.h +iwmmxt.o: iwmmxt.c iwmmxt.h armdefs.h armemu26.o: armemu.c armdefs.h armemu.h $(CC) -c $(srcdir)/armemu.c -o armemu26.o $(ALL_CFLAGS) diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c index 2c2ca85..aa75243 100644 --- a/sim/arm/armcopro.c +++ b/sim/arm/armcopro.c @@ -19,6 +19,7 @@ #include "armos.h" #include "armemu.h" #include "ansidecl.h" +#include "iwmmxt.h" /* Dummy Co-processors. */ @@ -1322,34 +1323,57 @@ ARMul_CoProInit (ARMul_State * state) /* Install CoPro Instruction handlers here. The format is: - ARMul_CoProAttach (state, CP Number, - Init routine, Exit routine - LDC routine, STC routine, - MRC routine, MCR routine, - CDP routine, - Read Reg routine, Write Reg routine). */ - ARMul_CoProAttach (state, 4, NULL, NULL, - ValLDC, ValSTC, ValMRC, ValMCR, ValCDP, NULL, NULL); - - ARMul_CoProAttach (state, 5, NULL, NULL, - NULL, NULL, ValMRC, ValMCR, IntCDP, NULL, NULL); - - ARMul_CoProAttach (state, 15, MMUInit, NULL, - NULL, NULL, MMUMRC, MMUMCR, NULL, MMURead, MMUWrite); - - ARMul_CoProAttach (state, 13, XScale_cp13_init, NULL, - XScale_cp13_LDC, XScale_cp13_STC, XScale_cp13_MRC, - XScale_cp13_MCR, NULL, XScale_cp13_read_reg, - XScale_cp13_write_reg); - - ARMul_CoProAttach (state, 14, XScale_cp14_init, NULL, - XScale_cp14_LDC, XScale_cp14_STC, XScale_cp14_MRC, - XScale_cp14_MCR, NULL, XScale_cp14_read_reg, - XScale_cp14_write_reg); - - ARMul_CoProAttach (state, 15, XScale_cp15_init, NULL, - NULL, NULL, XScale_cp15_MRC, XScale_cp15_MCR, - NULL, XScale_cp15_read_reg, XScale_cp15_write_reg); + ARMul_CoProAttach (state, CP Number, Init routine, Exit routine + LDC routine, STC routine, MRC routine, MCR routine, + CDP routine, Read Reg routine, Write Reg routine). */ + if (state->is_ep9312) + { + ARMul_CoProAttach (state, 4, NULL, NULL, DSPLDC4, DSPSTC4, + DSPMRC4, DSPMCR4, DSPCDP4, NULL, NULL); + ARMul_CoProAttach (state, 5, NULL, NULL, DSPLDC5, DSPSTC5, + DSPMRC5, DSPMCR5, DSPCDP5, NULL, NULL); + ARMul_CoProAttach (state, 6, NULL, NULL, NULL, NULL, + DSPMRC6, DSPMCR6, DSPCDP6, NULL, NULL); + } + else + { + ARMul_CoProAttach (state, 4, NULL, NULL, ValLDC, ValSTC, + ValMRC, ValMCR, ValCDP, NULL, NULL); + + ARMul_CoProAttach (state, 5, NULL, NULL, NULL, NULL, + ValMRC, ValMCR, IntCDP, NULL, NULL); + } + + if (state->is_XScale) + { + ARMul_CoProAttach (state, 13, XScale_cp13_init, NULL, + XScale_cp13_LDC, XScale_cp13_STC, XScale_cp13_MRC, + XScale_cp13_MCR, NULL, XScale_cp13_read_reg, + XScale_cp13_write_reg); + + ARMul_CoProAttach (state, 14, XScale_cp14_init, NULL, + XScale_cp14_LDC, XScale_cp14_STC, XScale_cp14_MRC, + XScale_cp14_MCR, NULL, XScale_cp14_read_reg, + XScale_cp14_write_reg); + + ARMul_CoProAttach (state, 15, XScale_cp15_init, NULL, + NULL, NULL, XScale_cp15_MRC, XScale_cp15_MCR, + NULL, XScale_cp15_read_reg, XScale_cp15_write_reg); + } + else + { + ARMul_CoProAttach (state, 15, MMUInit, NULL, NULL, NULL, + MMUMRC, MMUMCR, NULL, MMURead, MMUWrite); + } + + if (state->is_iWMMXt) + { + ARMul_CoProAttach (state, 0, NULL, NULL, IwmmxtLDC, IwmmxtSTC, + NULL, NULL, IwmmxtCDP, NULL, NULL); + + ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL, + IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL); + } /* No handlers below here. */ diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h index fde3125..a2ea405 100644 --- a/sim/arm/armdefs.h +++ b/sim/arm/armdefs.h @@ -135,6 +135,8 @@ struct ARMul_State unsigned is_v5; /* Are we emulating a v5 architecture ? */ unsigned is_v5e; /* Are we emulating a v5e architecture ? */ unsigned is_XScale; /* Are we emulating an XScale architecture ? */ + unsigned is_iWMMXt; /* Are we emulating an iWMMXt co-processor ? */ + unsigned is_ep9312; /* Are we emulating a Cirrus Maverick co-processor ? */ unsigned verbose; /* Print various messages like the banner */ }; @@ -162,6 +164,8 @@ struct ARMul_State #define ARM_v5_Prop 0x80 #define ARM_v5e_Prop 0x100 #define ARM_XScale_Prop 0x200 +#define ARM_ep9312_Prop 0x400 +#define ARM_iWMMXt_Prop 0x800 /***************************************************************************\ * Macros to extract instruction fields * diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 44943c4..d12ad10 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -19,6 +19,7 @@ #include "armdefs.h" #include "armemu.h" #include "armos.h" +#include "iwmmxt.h" static ARMword GetDPRegRHS (ARMul_State *, ARMword); static ARMword GetDPSRegRHS (ARMul_State *, ARMword); @@ -374,12 +375,23 @@ ARMul_Emulate26 (ARMul_State * state) if (state->EventSet) ARMul_EnvokeEvent (state); -#if 0 - /* Enable this for a helpful bit of debugging when tracing is needed. */ +#if 0 /* Enable this for a helpful bit of debugging when tracing is needed. */ fprintf (stderr, "pc: %x, instr: %x\n", pc & ~1, instr); if (instr == 0) abort (); #endif +#if 0 /* Enable this code to help track down stack alignment bugs. */ + { + static ARMword old_sp = -1; + + if (old_sp != state->Reg[13]) + { + old_sp = state->Reg[13]; + fprintf (stderr, "pc: %08x: SP set to %08x%s\n", + pc & ~1, old_sp, (old_sp % 8) ? " [UNALIGNED!]" : ""); + } + } +#endif if (state->Exception) { @@ -492,6 +504,10 @@ ARMul_Emulate26 (ARMul_State * state) else if ((instr & 0xFC70F000) == 0xF450F000) /* The PLD instruction. Ignored. */ goto donext; + else if ( ((instr & 0xfe500f00) == 0xfc100100) + || ((instr & 0xfe500f00) == 0xfc000100)) + /* wldrw and wstrw are unconditional. */ + goto mainswitch; else /* UNDEFINED in v5, UNPREDICTABLE in v3, v4, non executed in v1, v2. */ ARMul_UndefInstr (state, instr); @@ -689,6 +705,9 @@ check_PMUintr: goto donext; } } + + if (ARMul_HandleIwmmxt (state, instr)) + goto donext; } switch ((int) BITS (20, 27)) diff --git a/sim/arm/armemu.h b/sim/arm/armemu.h index 385924b..dfaafb0 100644 --- a/sim/arm/armemu.h +++ b/sim/arm/armemu.h @@ -530,3 +530,16 @@ extern void ARMul_CoProAttach (ARMul_State *, unsigned, ARMul_CPInits *, A extern void ARMul_CoProDetach (ARMul_State *, unsigned); extern ARMword read_cp15_reg (unsigned, unsigned, unsigned); +extern unsigned DSPLDC4 (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned DSPMCR4 (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned DSPMRC4 (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned DSPSTC4 (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned DSPCDP4 (ARMul_State *, unsigned, ARMword); +extern unsigned DSPMCR5 (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned DSPMRC5 (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned DSPLDC5 (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned DSPSTC5 (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned DSPCDP5 (ARMul_State *, unsigned, ARMword); +extern unsigned DSPMCR6 (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned DSPMRC6 (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned DSPCDP6 (ARMul_State *, unsigned, ARMword); diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c index c0312e9..4588787 100644 --- a/sim/arm/arminit.c +++ b/sim/arm/arminit.c @@ -17,6 +17,7 @@ #include "armdefs.h" #include "armemu.h" +#include "dbg_rdi.h" /***************************************************************************\ * Definitions for the emulator architecture * @@ -127,6 +128,7 @@ ARMul_NewState (void) state->is_v5 = LOW; state->is_v5e = LOW; state->is_XScale = LOW; + state->is_iWMMXt = LOW; ARMul_Reset (state); @@ -157,6 +159,12 @@ ARMul_SelectProcessor (ARMul_State * state, unsigned properties) state->is_v5 = (properties & ARM_v5_Prop) ? HIGH : LOW; state->is_v5e = (properties & ARM_v5e_Prop) ? HIGH : LOW; state->is_XScale = (properties & ARM_XScale_Prop) ? HIGH : LOW; + state->is_iWMMXt = (properties & ARM_iWMMXt_Prop) ? HIGH : LOW; + state->is_ep9312 = (properties & ARM_ep9312_Prop) ? HIGH : LOW; + + /* Only initialse the coprocessor support once we + know what kind of chip we are dealing with. */ + ARMul_CoProInit (state); } /***************************************************************************\ @@ -318,4 +326,24 @@ ARMul_Abort (ARMul_State * state, ARMword vector) ARMul_SetR15 (state, vector); else ARMul_SetR15 (state, R15CCINTMODE | vector); + + if (ARMul_ReadWord (state, ARMul_GetPC (state)) == 0) + { + /* No vector has been installed. Rather than simulating whatever + random bits might happen to be at address 0x20 onwards we elect + to stop. */ + switch (vector) + { + case ARMul_ResetV: state->EndCondition = RDIError_Reset; break; + case ARMul_UndefinedInstrV: state->EndCondition = RDIError_UndefinedInstruction; break; + case ARMul_SWIV: state->EndCondition = RDIError_SoftwareInterrupt; break; + case ARMul_PrefetchAbortV: state->EndCondition = RDIError_PrefetchAbort; break; + case ARMul_DataAbortV: state->EndCondition = RDIError_DataAbort; break; + case ARMul_AddrExceptnV: state->EndCondition = RDIError_AddressException; break; + case ARMul_IRQV: state->EndCondition = RDIError_IRQ; break; + case ARMul_FIQV: state->EndCondition = RDIError_FIQ; break; + default: break; + } + state->Emulate = FALSE; + } } diff --git a/sim/arm/armos.c b/sim/arm/armos.c index 04916d6..613d07e 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -131,8 +131,11 @@ unsigned int swi_mask = -1; static ARMword softvectorcode[] = { - /* Basic: swi tidyexception + event; mov pc, lr; - ldmia r11,{r11,pc}; swi generateexception + event. */ + /* Installed instructions: + swi tidyexception + event; + mov lr, pc; + ldmia fp, {fp, pc}; + swi generateexception + event. */ 0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080, /* Reset */ 0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081, /* Undef */ 0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082, /* SWI */ @@ -205,11 +208,15 @@ ARMul_OSInit (ARMul_State * state) /* Copy the code. */ ARMul_WriteWord (state, FPESTART + i, fpecode[i >> 2]); + /* Scan backwards from the end of the code. */ for (i = FPESTART + fpesize;; i -= 4) { - /* Reverse the error strings. */ + /* When we reach the marker value, break out of + the loop, leaving i pointing at the maker. */ if ((j = ARMul_ReadWord (state, i)) == 0xffffffff) break; + + /* If necessary, reverse the error strings. */ if (state->bigendSig && j < 0x80000000) { /* It's part of the string so swap it. */ @@ -221,9 +228,9 @@ ARMul_OSInit (ARMul_State * state) } /* Copy old illegal instr vector. */ - ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4)); + ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, ARMUndefinedInstrV)); /* Install new vector. */ - ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4))); + ARMul_WriteWord (state, ARMUndefinedInstrV, FPENEWVECT (ARMul_ReadWord (state, i - 4))); ARMul_ConsolePrint (state, ", FPE"); /* #endif ASIM */ @@ -692,12 +699,34 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) unhandled = TRUE; break; - case 0x90: - case 0x91: - case 0x92: - /* These are used by the FPE code. */ + /* The following SWIs are generated by the softvectorcode[] + installed by default by the simulator. */ + case 0x91: /* Undefined Instruction. */ + { + ARMword addr = state->RegBank[UNDEFBANK][14] - 4; + + sim_callback->printf_filtered + (sim_callback, "sim: exception: Unhandled Instruction '0x%08x' at 0x%08x. Stopping.\n", + ARMul_ReadWord (state, addr), addr); + state->EndCondition = RDIError_SoftwareInterrupt; + state->Emulate = FALSE; + return FALSE; + } + + case 0x90: /* Reset. */ + case 0x92: /* SWI. */ + /* These two can be safely ignored. */ break; - + + case 0x93: /* Prefetch Abort. */ + case 0x94: /* Data Abort. */ + case 0x95: /* Address Exception. */ + case 0x96: /* IRQ. */ + case 0x97: /* FIQ. */ + case 0x98: /* Error. */ + unhandled = TRUE; + break; + case -1: /* This can happen when a SWI is interrupted (eg receiving a ctrl-C whilst processing SWIRead()). The SWI will complete diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c index 26fd905..23038a1 100644 --- a/sim/arm/armvirt.c +++ b/sim/arm/armvirt.c @@ -64,7 +64,7 @@ GetWord (ARMul_State * state, ARMword address, int check) ARMword **pagetable; ARMword *pageptr; - if (check) + if (check && state->is_XScale) XScale_check_memacc (state, &address, 0); page = address >> PAGEBITS; @@ -100,7 +100,7 @@ PutWord (ARMul_State * state, ARMword address, ARMword data, int check) ARMword **pagetable; ARMword *pageptr; - if (check) + if (check && state->is_XScale) XScale_check_memacc (state, &address, 1); page = address >> PAGEBITS; diff --git a/sim/arm/configure b/sim/arm/configure index 65f0825..a82b7c7 100755 --- a/sim/arm/configure +++ b/sim/arm/configure @@ -3534,7 +3534,8 @@ fi done -COPRO=armcopro.o +COPRO="armcopro.o maverick.o iwmmxt.o" + diff --git a/sim/arm/configure.in b/sim/arm/configure.in index cbfac44..44300ca 100644 --- a/sim/arm/configure.in +++ b/sim/arm/configure.in @@ -7,7 +7,8 @@ SIM_AC_COMMON AC_CHECK_HEADERS(unistd.h) -COPRO=armcopro.o +COPRO="armcopro.o maverick.o iwmmxt.o" + AC_SUBST(COPRO) SIM_AC_OUTPUT diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 244c475..bba6f7f 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -59,6 +59,38 @@ static int big_endian; int stop_simulator; +/* Cirrus DSP registers. + + We need to define these registers outside of maverick.c because + maverick.c might not be linked in unless --target=arm9e-* in which + case wrapper.c will not compile because it tries to access Cirrus + registers. This should all go away once we get the Cirrus and ARM + Coprocessor to coexist in armcopro.c-- aldyh. */ + +struct maverick_regs +{ + union + { + int i; + float f; + } upper; + + union + { + int i; + float f; + } lower; +}; + +union maverick_acc_regs +{ + long double ld; /* Acc registers are 72-bits. */ +}; + +struct maverick_regs DSPregs[16]; +union maverick_acc_regs DSPacc[4]; +ARMword DSPsc; + static void init () { @@ -71,7 +103,6 @@ init () state->bigendSig = (big_endian ? HIGH : LOW); ARMul_MemoryInit (state, mem_size); ARMul_OSInit (state); - ARMul_CoProInit (state); state->verbose = verbosity; done = 1; } @@ -232,10 +263,38 @@ sim_create_inferior (sd, abfd, argv, env) /* We wouldn't set the machine type with earlier toolchains, so we explicitly select a processor capable of supporting all ARMs in 32bit mode. */ + /* We choose the XScale rather than the iWMMXt, because the iWMMXt + removes the FPE emulator, since it conflicts with its coprocessors. + For the most generic ARM support, we want the FPE emulator in place. */ case bfd_mach_arm_XScale: ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop); break; + case bfd_mach_arm_iWMMXt: + { + extern int SWI_vector_installed; + ARMword i; + + if (! SWI_vector_installed) + { + /* Intialise the hardware vectors to zero. */ + if (! SWI_vector_installed) + for (i = ARMul_ResetV; i <= ARMFIQV; i += 4) + ARMul_WriteWord (state, i, 0); + + /* ARM_WriteWord will have detected the write to the SWI vector, + but we want SWI_vector_installed to remain at 0 so that thumb + mode breakpoints will work. */ + SWI_vector_installed = 0; + } + } + ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop | ARM_iWMMXt_Prop); + break; + + case bfd_mach_arm_ep9312: + ARMul_SelectProcessor (state, ARM_v4_Prop | ARM_ep9312_Prop); + break; + case bfd_mach_arm_5: if (bfd_family_coff (abfd)) { @@ -422,6 +481,64 @@ sim_store_register (sd, rn, memory, length) ARMul_CPSRAltered (state); break; + case SIM_ARM_MAVERIC_COP0R0_REGNUM: + case SIM_ARM_MAVERIC_COP0R1_REGNUM: + case SIM_ARM_MAVERIC_COP0R2_REGNUM: + case SIM_ARM_MAVERIC_COP0R3_REGNUM: + case SIM_ARM_MAVERIC_COP0R4_REGNUM: + case SIM_ARM_MAVERIC_COP0R5_REGNUM: + case SIM_ARM_MAVERIC_COP0R6_REGNUM: + case SIM_ARM_MAVERIC_COP0R7_REGNUM: + case SIM_ARM_MAVERIC_COP0R8_REGNUM: + case SIM_ARM_MAVERIC_COP0R9_REGNUM: + case SIM_ARM_MAVERIC_COP0R10_REGNUM: + case SIM_ARM_MAVERIC_COP0R11_REGNUM: + case SIM_ARM_MAVERIC_COP0R12_REGNUM: + case SIM_ARM_MAVERIC_COP0R13_REGNUM: + case SIM_ARM_MAVERIC_COP0R14_REGNUM: + case SIM_ARM_MAVERIC_COP0R15_REGNUM: + memcpy (& DSPregs [rn - SIM_ARM_MAVERIC_COP0R0_REGNUM], + memory, sizeof (struct maverick_regs)); + return sizeof (struct maverick_regs); + + case SIM_ARM_MAVERIC_DSPSC_REGNUM: + memcpy (&DSPsc, memory, sizeof DSPsc); + return sizeof DSPsc; + + case SIM_ARM_IWMMXT_COP0R0_REGNUM: + case SIM_ARM_IWMMXT_COP0R1_REGNUM: + case SIM_ARM_IWMMXT_COP0R2_REGNUM: + case SIM_ARM_IWMMXT_COP0R3_REGNUM: + case SIM_ARM_IWMMXT_COP0R4_REGNUM: + case SIM_ARM_IWMMXT_COP0R5_REGNUM: + case SIM_ARM_IWMMXT_COP0R6_REGNUM: + case SIM_ARM_IWMMXT_COP0R7_REGNUM: + case SIM_ARM_IWMMXT_COP0R8_REGNUM: + case SIM_ARM_IWMMXT_COP0R9_REGNUM: + case SIM_ARM_IWMMXT_COP0R10_REGNUM: + case SIM_ARM_IWMMXT_COP0R11_REGNUM: + case SIM_ARM_IWMMXT_COP0R12_REGNUM: + case SIM_ARM_IWMMXT_COP0R13_REGNUM: + case SIM_ARM_IWMMXT_COP0R14_REGNUM: + case SIM_ARM_IWMMXT_COP0R15_REGNUM: + case SIM_ARM_IWMMXT_COP1R0_REGNUM: + case SIM_ARM_IWMMXT_COP1R1_REGNUM: + case SIM_ARM_IWMMXT_COP1R2_REGNUM: + case SIM_ARM_IWMMXT_COP1R3_REGNUM: + case SIM_ARM_IWMMXT_COP1R4_REGNUM: + case SIM_ARM_IWMMXT_COP1R5_REGNUM: + case SIM_ARM_IWMMXT_COP1R6_REGNUM: + case SIM_ARM_IWMMXT_COP1R7_REGNUM: + case SIM_ARM_IWMMXT_COP1R8_REGNUM: + case SIM_ARM_IWMMXT_COP1R9_REGNUM: + case SIM_ARM_IWMMXT_COP1R10_REGNUM: + case SIM_ARM_IWMMXT_COP1R11_REGNUM: + case SIM_ARM_IWMMXT_COP1R12_REGNUM: + case SIM_ARM_IWMMXT_COP1R13_REGNUM: + case SIM_ARM_IWMMXT_COP1R14_REGNUM: + case SIM_ARM_IWMMXT_COP1R15_REGNUM: + return Store_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory); + default: return 0; } @@ -477,6 +594,64 @@ sim_fetch_register (sd, rn, memory, length) regval = ARMul_GetCPSR (state); break; + case SIM_ARM_MAVERIC_COP0R0_REGNUM: + case SIM_ARM_MAVERIC_COP0R1_REGNUM: + case SIM_ARM_MAVERIC_COP0R2_REGNUM: + case SIM_ARM_MAVERIC_COP0R3_REGNUM: + case SIM_ARM_MAVERIC_COP0R4_REGNUM: + case SIM_ARM_MAVERIC_COP0R5_REGNUM: + case SIM_ARM_MAVERIC_COP0R6_REGNUM: + case SIM_ARM_MAVERIC_COP0R7_REGNUM: + case SIM_ARM_MAVERIC_COP0R8_REGNUM: + case SIM_ARM_MAVERIC_COP0R9_REGNUM: + case SIM_ARM_MAVERIC_COP0R10_REGNUM: + case SIM_ARM_MAVERIC_COP0R11_REGNUM: + case SIM_ARM_MAVERIC_COP0R12_REGNUM: + case SIM_ARM_MAVERIC_COP0R13_REGNUM: + case SIM_ARM_MAVERIC_COP0R14_REGNUM: + case SIM_ARM_MAVERIC_COP0R15_REGNUM: + memcpy (memory, & DSPregs [rn - SIM_ARM_MAVERIC_COP0R0_REGNUM], + sizeof (struct maverick_regs)); + return sizeof (struct maverick_regs); + + case SIM_ARM_MAVERIC_DSPSC_REGNUM: + memcpy (memory, & DSPsc, sizeof DSPsc); + return sizeof DSPsc; + + case SIM_ARM_IWMMXT_COP0R0_REGNUM: + case SIM_ARM_IWMMXT_COP0R1_REGNUM: + case SIM_ARM_IWMMXT_COP0R2_REGNUM: + case SIM_ARM_IWMMXT_COP0R3_REGNUM: + case SIM_ARM_IWMMXT_COP0R4_REGNUM: + case SIM_ARM_IWMMXT_COP0R5_REGNUM: + case SIM_ARM_IWMMXT_COP0R6_REGNUM: + case SIM_ARM_IWMMXT_COP0R7_REGNUM: + case SIM_ARM_IWMMXT_COP0R8_REGNUM: + case SIM_ARM_IWMMXT_COP0R9_REGNUM: + case SIM_ARM_IWMMXT_COP0R10_REGNUM: + case SIM_ARM_IWMMXT_COP0R11_REGNUM: + case SIM_ARM_IWMMXT_COP0R12_REGNUM: + case SIM_ARM_IWMMXT_COP0R13_REGNUM: + case SIM_ARM_IWMMXT_COP0R14_REGNUM: + case SIM_ARM_IWMMXT_COP0R15_REGNUM: + case SIM_ARM_IWMMXT_COP1R0_REGNUM: + case SIM_ARM_IWMMXT_COP1R1_REGNUM: + case SIM_ARM_IWMMXT_COP1R2_REGNUM: + case SIM_ARM_IWMMXT_COP1R3_REGNUM: + case SIM_ARM_IWMMXT_COP1R4_REGNUM: + case SIM_ARM_IWMMXT_COP1R5_REGNUM: + case SIM_ARM_IWMMXT_COP1R6_REGNUM: + case SIM_ARM_IWMMXT_COP1R7_REGNUM: + case SIM_ARM_IWMMXT_COP1R8_REGNUM: + case SIM_ARM_IWMMXT_COP1R9_REGNUM: + case SIM_ARM_IWMMXT_COP1R10_REGNUM: + case SIM_ARM_IWMMXT_COP1R11_REGNUM: + case SIM_ARM_IWMMXT_COP1R12_REGNUM: + case SIM_ARM_IWMMXT_COP1R13_REGNUM: + case SIM_ARM_IWMMXT_COP1R14_REGNUM: + case SIM_ARM_IWMMXT_COP1R15_REGNUM: + return Fetch_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory); + default: return 0; } @@ -739,6 +914,9 @@ sim_stop_reason (sd, reason, sigrc) *reason = sim_stopped; if (state->EndCondition == RDIError_BreakpointReached) *sigrc = SIGTRAP; + else if ( state->EndCondition == RDIError_DataAbort + || state->EndCondition == RDIError_AddressException) + *sigrc = SIGBUS; else *sigrc = 0; } diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index a7c8f4f..fb3e1b7 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2003-04-13 Michael Snyder <msnyder@redhat.com> + + * Make-common.in (sim-events.o, sim-config.o): Depend on sim-main.h. + 2003-03-01 Andrew Cagney <cagney@redhat.com> * sim-engine.c (sim_engine_halt): If jmpbuf is invalid, abort. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 9e2c7c4..53f898a 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -374,7 +374,7 @@ sim-bits.o: $(srccom)/sim-bits.c $(sim-bits_h) $(sim-n-bits_h) \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-bits.c $(ALL_CFLAGS) -sim-config.o: $(srccom)/sim-config.c $(sim-config_h) \ +sim-config.o: $(srccom)/sim-config.c $(sim-config_h) sim-main.h \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-config.c $(ALL_CFLAGS) @@ -391,7 +391,7 @@ sim-endian.o: $(srccom)/sim-endian.c $(sim-endian_h) $(sim-n-endian_h) sim-engine.o: $(srccom)/sim-engine.c $(sim_main_headers) $(sim-engine_h) $(CC) -c $(srccom)/sim-engine.c $(ALL_CFLAGS) -sim-events.o: $(srccom)/sim-events.c $(sim-events_h) \ +sim-events.o: $(srccom)/sim-events.c $(sim-events_h) sim-main.h \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-events.c $(ALL_CFLAGS) diff --git a/sim/configure b/sim/configure index a50ac9a..7819fc4 100755 --- a/sim/configure +++ b/sim/configure @@ -1426,7 +1426,10 @@ case "${target}" in # OBSOLETE extra_subdirs="${extra_subdirs} igen" # OBSOLETE ;; # OBSOLETE fr30-*-*) sim_target=fr30 ;; - h8300*-*-*) sim_target=h8300 ;; + h8300*-*-*) + sim_target=h8300 + extra_subdirs="${extra_subdirs} testsuite" + ;; h8500-*-*) sim_target=h8500 ;; i960-*-*) sim_target=i960 ;; m32r-*-*) sim_target=m32r ;; diff --git a/sim/configure.in b/sim/configure.in index ce074b3..4a1b0b5 100644 --- a/sim/configure.in +++ b/sim/configure.in @@ -65,7 +65,10 @@ case "${target}" in # OBSOLETE extra_subdirs="${extra_subdirs} igen" # OBSOLETE ;; # OBSOLETE fr30-*-*) sim_target=fr30 ;; - h8300*-*-*) sim_target=h8300 ;; + h8300*-*-*) + sim_target=h8300 + extra_subdirs="${extra_subdirs} testsuite" + ;; h8500-*-*) sim_target=h8500 ;; i960-*-*) sim_target=i960 ;; m32r-*-*) sim_target=m32r ;; diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 0e62569..600e9cc 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,29 @@ +2003-04-13 Michael Snyder <msnyder@redhat.com> + + * compile.c (sim_resume): Implement 'daa' and 'das' instructions. + +2003-03-20 D.Venkatasubramanian <dvenkat@noida.hcltech.com> + + * compile.c (cmdline_location): Added function to + return the location of 8-bit (256 locations) where the + Command Line arguments would be stored. + (decode): Added a TRAP to 0xcc for Commandline + processing using pseudo opcode O_SYS_CMDLINE. + (sim_resume): Added handling of O_SYS_CMDLINE Trap. + (sim_create_inferior): Setting a pointer to + Commandline Args array. + * inst.h: Added a new variable ptr_command_line for + storing pointer to Commandline array. + +2003-03-14 D.Venkatasubramanian <dvenkat@noida.hcltech.com> + + * compile.c (decode): Added code for some more magic traps. + * compile.c (sim_resume): Added support for File I/O system + calls through callback to host_system. + System calls provided support for : + open, read, write, lseek, close, stat, fstat + Only basic support for stat and fstat. + 2003-02-27 Andrew Cagney <cagney@redhat.com> * compile.c (sim_open, sim_create_inferior): Rename _bfd to bfd. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index cd60b86..0e4b6d2 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -35,6 +35,8 @@ #include "gdb/callback.h" #include "gdb/remote-sim.h" #include "gdb/sim-h8300.h" +#include "sys/stat.h" +#include "sys/types.h" #ifndef SIGTRAP # define SIGTRAP 5 @@ -174,6 +176,17 @@ lvalue (int x, int rn) } } +static int +cmdline_location() +{ + if (h8300smode) + return 0xffff00L; + else if (h8300hmode) + return 0x2ff00L; + else + return 0xff00L; +} + static unsigned int decode (int addr, unsigned char *data, decoded_inst *dst) { @@ -447,14 +460,39 @@ decode (int addr, unsigned char *data, decoded_inst *dst) dst->opcode = q->how; dst->cycles = q->time; - /* And a jsr to 0xc4 is turned into a magic trap. */ + /* And a jsr to these locations are turned into magic + traps. */ if (dst->opcode == O (O_JSR, SB)) { - if (dst->src.literal == 0xc4) + switch (dst->src.literal) { - dst->opcode = O (O_SYSCALL, SB); + case 0xc5: + dst->opcode = O (O_SYS_OPEN, SB); + break; + case 0xc6: + dst->opcode = O (O_SYS_READ, SB); + break; + case 0xc7: + dst->opcode = O (O_SYS_WRITE, SB); + break; + case 0xc8: + dst->opcode = O (O_SYS_LSEEK, SB); + break; + case 0xc9: + dst->opcode = O (O_SYS_CLOSE, SB); + break; + case 0xca: + dst->opcode = O (O_SYS_STAT, SB); + break; + case 0xcb: + dst->opcode = O (O_SYS_FSTAT, SB); + break; + case 0xcc: + dst->opcode = O (O_SYS_CMDLINE, SB); + break; } + /* End of Processing for system calls. */ } dst->next_pc = addr + len / 2; @@ -1386,13 +1424,447 @@ sim_resume (SIM_DESC sd, int step, int siggnal) goto condtrue; goto next; - case O (O_SYSCALL, SB): + /* Trap for Command Line setup. */ + case O (O_SYS_CMDLINE, SB): { - char c = cpu.regs[2]; - sim_callback->write_stdout (sim_callback, &c, 1); + int i = 0; /* Loop counter. */ + int j = 0; /* Loop counter. */ + int ind_arg_len = 0; /* Length of each argument. */ + int no_of_args = 0; /* The no. or cmdline args. */ + int current_location = 0; /* Location of string. */ + int old_sp = 0; /* The Initial Stack Pointer. */ + int no_of_slots = 0; /* No. of slots required on the stack + for storing cmdline args. */ + int sp_move = 0; /* No. of locations by which the stack needs + to grow. */ + int new_sp = 0; /* The final stack pointer location passed + back. */ + int *argv_ptrs; /* Pointers of argv strings to be stored. */ + int argv_ptrs_location = 0; /* Location of pointers to cmdline + args on the stack. */ + int char_ptr_size = 0; /* Size of a character pointer on + target machine. */ + int addr_cmdline = 0; /* Memory location where cmdline has + to be stored. */ + int size_cmdline = 0; /* Size of cmdline. */ + + /* Set the address of 256 free locations where command line is + stored. */ + addr_cmdline = cmdline_location(); + cpu.regs[0] = addr_cmdline; + + /* Counting the no. of commandline arguments. */ + for (i = 0; ptr_command_line[i] != NULL; i++) + continue; + + /* No. of arguments in the command line. */ + no_of_args = i; + + /* Current location is just a temporary variable,which we are + setting to the point to the start of our commandline string. */ + current_location = addr_cmdline; + + /* Allocating space for storing pointers of the command line + arguments. */ + argv_ptrs = (int *) malloc (sizeof (int) * no_of_args); + + /* Setting char_ptr_size to the sizeof (char *) on the different + architectures. */ + if (h8300hmode || h8300smode) + { + char_ptr_size = 4; + } + else + { + char_ptr_size = 2; + } + + for (i = 0; i < no_of_args; i++) + { + ind_arg_len = 0; + + /* The size of the commandline argument. */ + ind_arg_len = (strlen (ptr_command_line[i]) + 1); + + /* The total size of the command line string. */ + size_cmdline += ind_arg_len; + + /* As we have only 256 bytes, we need to provide a graceful + exit. Anyways, a program using command line arguments + where we cannot store all the command line arguments + given may behave unpredictably. */ + if (size_cmdline >= 256) + { + cpu.regs[0] = 0; + goto next; + } + else + { + /* current_location points to the memory where the next + commandline argument is stored. */ + argv_ptrs[i] = current_location; + for (j = 0; j < ind_arg_len; j++) + { + SET_MEMORY_B ((current_location + + (sizeof (char) * j)), + *(ptr_command_line[i] + + sizeof (char) * j)); + } + + /* Setting current_location to the starting of next + argument. */ + current_location += ind_arg_len; + } + } + + /* This is the original position of the stack pointer. */ + old_sp = cpu.regs[7]; + + /* We need space from the stack to store the pointers to argvs. */ + /* As we will infringe on the stack, we need to shift the stack + pointer so that the data is not overwritten. We calculate how + much space is required. */ + sp_move = (no_of_args) * (char_ptr_size); + + /* The final position of stack pointer, we have thus taken some + space from the stack. */ + new_sp = old_sp - sp_move; + + /* Temporary variable holding value where the argv pointers need + to be stored. */ + argv_ptrs_location = new_sp; + + /* The argv pointers are stored at sequential locations. As per + the H8300 ABI. */ + for (i = 0; i < no_of_args; i++) + { + /* Saving the argv pointer. */ + if (h8300hmode || h8300smode) + { + SET_MEMORY_L (argv_ptrs_location, argv_ptrs[i]); + } + else + { + SET_MEMORY_W (argv_ptrs_location, argv_ptrs[i]); + } + + /* The next location where the pointer to the next argv + string has to be stored. */ + argv_ptrs_location += char_ptr_size; + } + + /* Required by POSIX, Setting 0x0 at the end of the list of argv + pointers. */ + if (h8300hmode || h8300smode) + { + SET_MEMORY_L (old_sp, 0x0); + } + else + { + SET_MEMORY_W (old_sp, 0x0); + } + + /* Freeing allocated memory. */ + free (argv_ptrs); + for (i = 0; i <= no_of_args; i++) + { + free (ptr_command_line[i]); + } + free (ptr_command_line); + + /* The no. of argv arguments are returned in Reg 0. */ + cpu.regs[0] = no_of_args; + /* The Pointer to argv in Register 1. */ + cpu.regs[1] = new_sp; + /* Setting the stack pointer to the new value. */ + cpu.regs[7] = new_sp; + } + goto next; + + /* System call processing starts. */ + case O (O_SYS_OPEN, SB): + { + int len = 0; /* Length of filename. */ + char *filename; /* Filename would go here. */ + char temp_char; /* Temporary character */ + int mode = 0; /* Mode bits for the file. */ + int open_return; /* Return value of open, file descriptor. */ + int i; /* Loop counter */ + int filename_ptr; /* Pointer to filename in cpu memory. */ + + /* Setting filename_ptr to first argument of open. */ + filename_ptr = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + + /* Trying to get mode. */ + if (h8300hmode || h8300smode) + { + mode = GET_MEMORY_L (cpu.regs[7] + 4); + } + else + { + mode = GET_MEMORY_W (cpu.regs[7] + 2); + } + + /* Trying to find the length of the filename. */ + temp_char = GET_MEMORY_B (cpu.regs[0]); + + len = 1; + while (temp_char != '\0') + { + temp_char = GET_MEMORY_B (filename_ptr + len); + len++; + } + + /* Allocating space for the filename. */ + filename = (char *) malloc (sizeof (char) * len); + + /* String copying the filename from memory. */ + for (i = 0; i < len; i++) + { + temp_char = GET_MEMORY_B (filename_ptr + i); + filename[i] = temp_char; + } + + /* Callback to open and return the file descriptor. */ + open_return = sim_callback->open (sim_callback, filename, mode); + + /* Return value in register 0. */ + cpu.regs[0] = open_return; + + /* Freeing memory used for filename. */ + free (filename); } goto next; + case O (O_SYS_READ, SB): + { + char *char_ptr; /* Where characters read would be stored. */ + int fd; /* File descriptor */ + int buf_size; /* BUF_SIZE parameter in read. */ + int i = 0; /* Temporary Loop counter */ + int read_return = 0; /* Return value from callback to + read. */ + + fd = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + buf_size = h8300hmode ? GET_L_REG (2) : GET_W_REG (2); + + char_ptr = (char *) malloc (sizeof (char) * buf_size); + + /* Callback to read and return the no. of characters read. */ + read_return = + sim_callback->read (sim_callback, fd, char_ptr, buf_size); + + /* The characters read are stored in cpu memory. */ + for (i = 0; i < buf_size; i++) + { + SET_MEMORY_B ((cpu.regs[1] + (sizeof (char) * i)), + *(char_ptr + (sizeof (char) * i))); + } + + /* Return value in Register 0. */ + cpu.regs[0] = read_return; + + /* Freeing memory used as buffer. */ + free (char_ptr); + } + goto next; + + case O (O_SYS_WRITE, SB): + { + int fd; /* File descriptor */ + char temp_char; /* Temporary character */ + int len; /* Length of write, Parameter II to write. */ + int char_ptr; /* Character Pointer, Parameter I of write. */ + char *ptr; /* Where characters to be written are stored. + */ + int write_return; /* Return value from callback to write. */ + int i = 0; /* Loop counter */ + + fd = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + char_ptr = h8300hmode ? GET_L_REG (1) : GET_W_REG (1); + len = h8300hmode ? GET_L_REG (2) : GET_W_REG (2); + + /* Allocating space for the characters to be written. */ + ptr = (char *) malloc (sizeof (char) * len); + + /* Fetching the characters from cpu memory. */ + for (i = 0; i < len; i++) + { + temp_char = GET_MEMORY_B (char_ptr + i); + ptr[i] = temp_char; + } + + /* Callback write and return the no. of characters written. */ + write_return = sim_callback->write (sim_callback, fd, ptr, len); + + /* Return value in Register 0. */ + cpu.regs[0] = write_return; + + /* Freeing memory used as buffer. */ + free (ptr); + } + goto next; + + case O (O_SYS_LSEEK, SB): + { + int fd; /* File descriptor */ + int offset; /* Offset */ + int origin; /* Origin */ + int lseek_return; /* Return value from callback to lseek. */ + + fd = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + offset = h8300hmode ? GET_L_REG (1) : GET_W_REG (1); + origin = h8300hmode ? GET_L_REG (2) : GET_W_REG (2); + + /* Callback lseek and return offset. */ + lseek_return = + sim_callback->lseek (sim_callback, fd, offset, origin); + + /* Return value in register 0. */ + cpu.regs[0] = lseek_return; + } + goto next; + + case O (O_SYS_CLOSE, SB): + { + int fd; /* File descriptor */ + int close_return; /* Return value from callback to close. */ + + fd = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + + /* Callback close and return. */ + close_return = sim_callback->close (sim_callback, fd); + + /* Return value in register 0. */ + cpu.regs[0] = close_return; + } + goto next; + + case O (O_SYS_FSTAT, SB): + { + int fd; /* File descriptor */ + struct stat stat_rec; /* Stat record */ + int fstat_return; /* Return value from callback to stat. */ + int stat_ptr; /* Pointer to stat record. */ + char *temp_stat_ptr; /* Temporary stat_rec pointer. */ + + fd = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + + /* Setting stat_ptr to second argument of stat. */ + stat_ptr = h8300hmode ? GET_L_REG (1) : GET_W_REG (1); + + /* Callback stat and return. */ + fstat_return = sim_callback->fstat (sim_callback, fd, &stat_rec); + + /* Have stat_ptr point to starting of stat_rec. */ + temp_stat_ptr = (char *) (&stat_rec); + + /* Setting up the stat structure returned. */ + SET_MEMORY_W (stat_ptr, stat_rec.st_dev); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_ino); + stat_ptr += 2; + SET_MEMORY_L (stat_ptr, stat_rec.st_mode); + stat_ptr += 4; + SET_MEMORY_W (stat_ptr, stat_rec.st_nlink); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_uid); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_gid); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_rdev); + stat_ptr += 2; + SET_MEMORY_L (stat_ptr, stat_rec.st_size); + stat_ptr += 4; + SET_MEMORY_L (stat_ptr, stat_rec.st_atime); + stat_ptr += 8; + SET_MEMORY_L (stat_ptr, stat_rec.st_mtime); + stat_ptr += 8; + SET_MEMORY_L (stat_ptr, stat_rec.st_ctime); + + /* Return value in register 0. */ + cpu.regs[0] = fstat_return; + } + goto next; + + case O (O_SYS_STAT, SB): + { + int len = 0; /* Length of filename. */ + char *filename; /* Filename would go here. */ + char temp_char; /* Temporary character */ + int filename_ptr; /* Pointer to filename in cpu memory. */ + struct stat stat_rec; /* Stat record */ + int stat_return; /* Return value from callback to stat */ + int stat_ptr; /* Pointer to stat record. */ + char *temp_stat_ptr; /* Temporary stat_rec pointer. */ + int i = 0; /* Loop Counter */ + + /* Setting filename_ptr to first argument of open. */ + filename_ptr = h8300hmode ? GET_L_REG (0) : GET_W_REG (0); + + /* Trying to find the length of the filename. */ + temp_char = GET_MEMORY_B (cpu.regs[0]); + + len = 1; + while (temp_char != '\0') + { + temp_char = GET_MEMORY_B (filename_ptr + len); + len++; + } + + /* Allocating space for the filename. */ + filename = (char *) malloc (sizeof (char) * len); + + /* String copying the filename from memory. */ + for (i = 0; i < len; i++) + { + temp_char = GET_MEMORY_B (filename_ptr + i); + filename[i] = temp_char; + } + + /* Setting stat_ptr to second argument of stat. */ + /* stat_ptr = cpu.regs[1]; */ + stat_ptr = h8300hmode ? GET_L_REG (1) : GET_W_REG (1); + + /* Callback stat and return. */ + stat_return = + sim_callback->stat (sim_callback, filename, &stat_rec); + + /* Have stat_ptr point to starting of stat_rec. */ + temp_stat_ptr = (char *) (&stat_rec); + + /* Freeing memory used for filename. */ + free (filename); + + /* Setting up the stat structure returned. */ + SET_MEMORY_W (stat_ptr, stat_rec.st_dev); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_ino); + stat_ptr += 2; + SET_MEMORY_L (stat_ptr, stat_rec.st_mode); + stat_ptr += 4; + SET_MEMORY_W (stat_ptr, stat_rec.st_nlink); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_uid); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_gid); + stat_ptr += 2; + SET_MEMORY_W (stat_ptr, stat_rec.st_rdev); + stat_ptr += 2; + SET_MEMORY_L (stat_ptr, stat_rec.st_size); + stat_ptr += 4; + SET_MEMORY_L (stat_ptr, stat_rec.st_atime); + stat_ptr += 8; + SET_MEMORY_L (stat_ptr, stat_rec.st_mtime); + stat_ptr += 8; + SET_MEMORY_L (stat_ptr, stat_rec.st_ctime); + + /* Return value in register 0. */ + cpu.regs[0] = stat_return; + } + goto next; + /* End of system call processing. */ + ONOT (O_NOT, rd = ~rd; v = 0;); OSHIFTS (O_SHLL, c = rd & hm; v = 0; rd <<= 1, @@ -1666,6 +2138,57 @@ sim_resume (SIM_DESC sd, int step, int siggnal) } goto next; + case O (O_DAA, SB): + /* Decimal Adjust Addition. This is for BCD arithmetic. */ + res = GET_B_REG (code->src.reg); + if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) + && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) + res = res; /* Value added == 0. */ + else if (!c && (0 <= (res >> 4) && (res >> 4) <= 8) + && !h && (10 <= (res & 0xf) && (res & 0xf) <= 15)) + res = res + 0x6; /* Value added == 6. */ + else if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) + && h && (0 <= (res & 0xf) && (res & 0xf) <= 3)) + res = res + 0x6; /* Value added == 6. */ + else if (!c && (10 <= (res >> 4) && (res >> 4) <= 15) + && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) + res = res + 0x60; /* Value added == 60. */ + else if (!c && (9 <= (res >> 4) && (res >> 4) <= 15) + && !h && (10 <= (res & 0xf) && (res & 0xf) <= 15)) + res = res + 0x66; /* Value added == 66. */ + else if (!c && (10 <= (res >> 4) && (res >> 4) <= 15) + && h && (0 <= (res & 0xf) && (res & 0xf) <= 3)) + res = res + 0x66; /* Value added == 66. */ + else if (c && (1 <= (res >> 4) && (res >> 4) <= 2) + && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) + res = res + 0x160; /* Value added == 60, plus 'carry'. */ + else if (c && (1 <= (res >> 4) && (res >> 4) <= 2) + && !h && (10 <= (res & 0xf) && (res & 0xf) <= 15)) + res = res + 0x166; /* Value added == 66, plus 'carry'. */ + else if (c && (1 <= (res >> 4) && (res >> 4) <= 3) + && h && (0 <= (res & 0xf) && (res & 0xf) <= 3)) + res = res + 0x166; /* Value added == 66, plus 'carry'. */ + + goto alu8; + + case O (O_DAS, SB): + /* Decimal Adjust Subtraction. This is for BCD arithmetic. */ + res = GET_B_REG (code->src.reg); /* FIXME fetch, fetch2... */ + if (!c && (0 <= (res >> 4) && (res >> 4) <= 9) + && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) + res = res; /* Value added == 0. */ + else if (!c && (0 <= (res >> 4) && (res >> 4) <= 8) + && h && (6 <= (res & 0xf) && (res & 0xf) <= 15)) + res = res + 0xfa; /* Value added == 0xfa. */ + else if (c && (7 <= (res >> 4) && (res >> 4) <= 15) + && !h && (0 <= (res & 0xf) && (res & 0xf) <= 9)) + res = res + 0xa0; /* Value added == 0xa0. */ + else if (c && (6 <= (res >> 4) && (res >> 4) <= 15) + && h && (6 <= (res & 0xf) && (res & 0xf) <= 15)) + res = res + 0x9a; /* Value added == 0x9a. */ + + goto alu8; + default: illegal: cpu.state = SIM_STATE_STOPPED; @@ -2230,10 +2753,37 @@ sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env) { + int i = 0; + int len_arg = 0; + int no_of_args = 0; + if (abfd != NULL) cpu.pc = bfd_get_start_address (abfd); else cpu.pc = 0; + + /* Command Line support. */ + if (argv != NULL) + { + /* Counting the no. of commandline arguments. */ + for (no_of_args = 0; argv[no_of_args] != NULL; no_of_args++) + continue; + + /* Allocating memory for the argv pointers. */ + ptr_command_line = (char **) malloc ((sizeof (char *)) + * (no_of_args + 1)); + + for (i = 0; i < no_of_args; i++) + { + /* Calculating the length of argument for allocating memory. */ + len_arg = strlen (argv[i] + 1); + ptr_command_line[i] = (char *) malloc (sizeof (char) * len_arg); + /* Copying the argument string. */ + ptr_command_line[i] = (char *) strdup (argv[i]); + } + ptr_command_line[i] = NULL; + } + return SIM_RC_OK; } diff --git a/sim/h8300/inst.h b/sim/h8300/inst.h index 7f6e400..edbee6a 100644 --- a/sim/h8300/inst.h +++ b/sim/h8300/inst.h @@ -66,6 +66,9 @@ enum h8300_sim_state { SIM_STATE_RUNNING, SIM_STATE_EXITED, SIM_STATE_SIGNALLED, SIM_STATE_STOPPED }; +/* For Command Line. */ +char **ptr_command_line; /* Pointer to Command Line Arguments. */ + typedef struct { enum h8300_sim_state state; diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 76c676c..2d344b5 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,7 +1,12 @@ +2003-04-15 Richard Sandiford <rsandifo@redhat.com> + + * vr.igen (do_vr_mul_op): Zero-extend the low 32 bits of + unsigned operands. + 2003-02-27 Andrew Cagney <cagney@redhat.com> - * interp.c (sim_open): - (sim_create_inferior): + * interp.c (sim_open): Rename _bfd to bfd. + (sim_create_inferior): Ditto. 2003-01-14 Chris Demetriou <cgd@broadcom.com> diff --git a/sim/mips/vr.igen b/sim/mips/vr.igen index 0eb5f4d..742a85d 100644 --- a/sim/mips/vr.igen +++ b/sim/mips/vr.igen @@ -73,7 +73,9 @@ (long) CIA); TRACE_ALU_INPUT2 (x, y); - product = (unsigned_p ? x * y : EXTEND32 (x) * EXTEND32 (y)); + product = (unsigned_p + ? V8_4 (x, 1) * V8_4 (y, 1) + : EXTEND32 (x) * EXTEND32 (y)); result = (subtract_p ? lhs - product : lhs + product); if (saturate_p) { diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index 9699c98..4023d28 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,95 @@ +2003-04-01 Nick Clifton <nickc@redhat.com> + + * sim/arm: New directory: Tests for ARM simulator. + * sim/arm/allinsn.exp: New file: Test script. + * sim/arm/testutils.inc: New file: Test macros. + * sim/arm/adc.cgs, sim/arm/add.cgs, sim/arm/and.cgs, + sim/arm/b.cgs, sim/arm/bic.cgs, sim/arm/bl.cgs, sim/arm/bx.cgs, + sim/arm/cmn.cgs, sim/arm/cmp.cgs, sim/arm/eor.cgs, + sim/arm/hello.ms, sim/arm/ldm.cgs, sim/arm/ldr.cgs, + sim/arm/ldrb.cgs, sim/arm/ldrh.cgs, sim/arm/ldrsb.cgs, + sim/arm/ldrsh.cgs, sim/arm/misaligned1.ms, sim/arm/misaligned2.ms, + sim/arm/misaligned3.ms, sim/arm/misc.exp, sim/arm/mla.cgs, + sim/arm/mov.cgs, sim/arm/mrs.cgs, sim/arm/msr.cgs, + sim/arm/mul.cgs, sim/arm/mvn.cgs, sim/arm/orr.cgs, + sim/arm/rsb.cgs, sim/arm/rsc.cgs, sim/arm/sbc.cgs, + sim/arm/smlal.cgs, sim/arm/smull.cgs, sim/arm/stm.cgs, + sim/arm/str.cgs, sim/arm/strb.cgs, sim/arm/strh.cgs, + sim/arm/sub.cgs, sim/arm/swi.cgs, sim/arm/swp.cgs, + sim/arm/swpb.cgs, sim/arm/teq.cgs, sim/arm/tst.cgs, + sim/arm/umlal.cgs, sim/arm/umull.cgs: New files: ARM tests. + * sim/arm/iwmmxt: New Directory: Tests for iWMMXt. + * sim/arm/iwmmxt/iwmmxt.exp: New file: Test script. + * sim/arm/iwmmxt/testutils.inc: New file: Test macros. + * sim/arm/iwmmxt/tbcst.cgs, sim/arm/iwmmxt/textrm.cgs, + sim/arm/iwmmxt/tinsr.cgs, sim/arm/iwmmxt/tmia.cgs, + sim/arm/iwmmxt/tmiaph.cgs, sim/arm/iwmmxt/tmiaxy.cgs, + sim/arm/iwmmxt/tmovmsk.cgss, sim/arm/iwmmxt/wacc.cgs, + sim/arm/iwmmxt/wadd.cgs, sim/arm/iwmmxt/waligni.cgs, + sim/arm/iwmmxt/walignr.cgs, sim/arm/iwmmxt/wand.cgs, + sim/arm/iwmmxt/wandn.cgs, sim/arm/iwmmxt/wavg2.cgs, + sim/arm/iwmmxt/wcmpeq.cgs, sim/arm/iwmmxt/wcmpgt.cgs, + sim/arm/iwmmxt/wmac.cgs, sim/arm/iwmmxt/wmadd.cgs, + sim/arm/iwmmxt/wmax.cgs, sim/arm/iwmmxt/wmin.cgs, + sim/arm/iwmmxt/wmov.cgs, sim/arm/iwmmxt/wmul.cgs, + sim/arm/iwmmxt/wor.cgs, sim/arm/iwmmxt/wpack.cgs, + sim/arm/iwmmxt/wror.cgs, sim/arm/iwmmxt/wsad.cgs, + sim/arm/iwmmxt/wshufh.cgs, sim/arm/iwmmxt/wsll.cgs, + sim/arm/iwmmxt/wsra.cgs, sim/arm/iwmmxt/wsrl.cgs, + sim/arm/iwmmxt/wsub.cgs, sim/arm/iwmmxt/wunpckeh.cgs, + sim/arm/iwmmxt/wunpckel.cgs, sim/arm/iwmmxt/wunpckih.cgs, + sim/arm/iwmmxt/wunpckil.cgs, sim/arm/iwmmxt/wxor.cgs, + sim/arm/iwmmxt/wzero.cgs: New files: iWMMXt tests. + * sim/arm/thumb: New Directory: Thumb tests. + * sim/arm/thumb/allthumb.exp: New file: Test script. + * sim/arm/thumb/testutils.inc: New file: Test macros. + * sim/arm/thumb/adc.cgs, sim/arm/thumb/add-hd-hs.cgs, + sim/arm/thumb/add-hd-rs.cgs, sim/arm/thumb/add-rd-hs.cgs, + sim/arm/thumb/add-sp.cgs, sim/arm/thumb/add.cgs, + sim/arm/thumb/addi.cgs, sim/arm/thumb/addi8.cgs, + sim/arm/thumb/and.cgs, sim/arm/thumb/asr.cgs, sim/arm/thumb/b.cgs, + sim/arm/thumb/bcc.cgs, sim/arm/thumb/bcs.cgs, + sim/arm/thumb/beq.cgs, sim/arm/thumb/bge.cgs, + sim/arm/thumb/bgt.cgs, sim/arm/thumb/bhi.cgs, + sim/arm/thumb/bic.cgs, sim/arm/thumb/bl-hi.cgs, + sim/arm/thumb/bl-lo.cgs, sim/arm/thumb/ble.cgs, + sim/arm/thumb/bls.cgs, sim/arm/thumb/blt.cgs, + sim/arm/thumb/bmi.cgs, sim/arm/thumb/bne.cgs, + sim/arm/thumb/bpl.cgs, sim/arm/thumb/bvc.cgs, + sim/arm/thumb/bvs.cgs, sim/arm/thumb/bx-hs.cgs, + sim/arm/thumb/bx-rs.cgs, sim/arm/thumb/cmn.cgs, + sim/arm/thumb/cmp-hd-hs.cgs, sim/arm/thumb/cmp-hd-rs.cgs, + sim/arm/thumb/cmp-rd-hs.cgs, sim/arm/thumb/cmp.cgs, + sim/arm/thumb/eor.cgs, sim/arm/thumb/lda-pc.cgs, + sim/arm/thumb/lda-sp.cgs, sim/arm/thumb/ldmia.cgs, + sim/arm/thumb/ldr-imm.cgs, sim/arm/thumb/ldr-pc.cgs, + sim/arm/thumb/ldr-sprel.cgs, sim/arm/thumb/ldr.cgs, + sim/arm/thumb/ldrb-imm.cgs, sim/arm/thumb/ldrb.cgs, + sim/arm/thumb/ldrh-imm.cgs, sim/arm/thumb/ldrh.cgs, + sim/arm/thumb/ldsb.cgs, sim/arm/thumb/ldsh.cgs, + sim/arm/thumb/lsl.cgs, sim/arm/thumb/lsr.cgs, + sim/arm/thumb/mov-hd-hs.cgs, sim/arm/thumb/mov-hd-rs.cgs, + sim/arm/thumb/mov-rd-hs.cgs, sim/arm/thumb/mov.cgs, + sim/arm/thumb/mul.cgs, sim/arm/thumb/mvn.cgs, + sim/arm/thumb/neg.cgs, sim/arm/thumb/orr.cgs, + sim/arm/thumb/pop-pc.cgs, sim/arm/thumb/pop.cgs, + sim/arm/thumb/push-lr.cgs, sim/arm/thumb/push.cgs, + sim/arm/thumb/ror.cgs, sim/arm/thumb/sbc.cgs, + sim/arm/thumb/stmia.cgs, sim/arm/thumb/str-imm.cgs, + sim/arm/thumb/str-sprel.cgs, sim/arm/thumb/str.cgs, + sim/arm/thumb/strb-imm.cgs, sim/arm/thumb/strb.cgs, + sim/arm/thumb/strh-imm.cgs, sim/arm/thumb/strh.cgs, + sim/arm/thumb/sub-sp.cgs, sim/arm/thumb/sub.cgs, + sim/arm/thumb/subi.cgs, sim/arm/thumb/subi8.cgs, + sim/arm/thumb/swi.cgs, sim/arm/thumb/tst.cgs: New files: Thumb + tests. + * sim/arm/xscale: New directory. + * sim/arm/xscale/xscale.exp: New file: Test script. + * sim/arm/xscale/testutils.inc: New file: Test macros. + * sim/arm/xscale/blx.cgs, sim/arm/xscale/mia.cgs, + sim/arm/xscale/miaph.cgs, sim/arm/xscale/miaxy.cgs, + sim/arm/xscale/mra.cgs: New files: XScale tests. + 2002-06-16 Andrew Cagney <ac131313@redhat.com> * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog index 9dcfd05..7d1075c 100644 --- a/sim/v850/ChangeLog +++ b/sim/v850/ChangeLog @@ -1,3 +1,9 @@ +2003-04-06 Nick Clifton <nickc@redhat.com> + + * simops.c (OP_40): Delete. Move code to... + * v850-igen.c (): ...Here. Sign extend the first operand. + * simops.h (OP_40): Remove prototype. + 2003-02-27 Andrew Cagney <cagney@redhat.com> * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd. diff --git a/sim/v850/simops.c b/sim/v850/simops.c index fd0172e..87868f5 100644 --- a/sim/v850/simops.c +++ b/sim/v850/simops.c @@ -771,50 +771,6 @@ OP_6E0 () return 4; } -/* divh reg1, reg2 */ -int -OP_40 () -{ - unsigned int op0, op1, result, ov, s, z; - int temp; - - trace_input ("divh", OP_REG_REG, 0); - - /* Compute the result. */ - temp = EXTEND16 (State.regs[ OP[0] ]); - op0 = temp; - op1 = State.regs[OP[1]]; - - if (op0 == 0xffffffff && op1 == 0x80000000) - { - result = 0x80000000; - ov = 1; - } - else if (op0 != 0) - { - result = op1 / op0; - ov = 0; - } - else - { - result = 0x0; - ov = 1; - } - - /* Compute the condition codes. */ - z = (result == 0); - s = (result & 0x80000000); - - /* Store the result and condition codes. */ - State.regs[OP[1]] = result; - PSW &= ~(PSW_Z | PSW_S | PSW_OV); - PSW |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0) - | (ov ? PSW_OV : 0)); - trace_output (OP_REG_REG); - - return 2; -} - /* cmp reg, reg */ int OP_1E0 () diff --git a/sim/v850/simops.h b/sim/v850/simops.h index d4c0792..750fb70 100644 --- a/sim/v850/simops.h +++ b/sim/v850/simops.h @@ -17,7 +17,6 @@ int OP_180 (void); int OP_E0 (void); int OP_2E0 (void); int OP_6E0 (void); -int OP_40 (void); int OP_1E0 (void); int OP_260 (void); int OP_7E0 (void); diff --git a/sim/v850/v850.igen b/sim/v850/v850.igen index 0a4c08a..3f14957 100644 --- a/sim/v850/v850.igen +++ b/sim/v850/v850.igen @@ -332,7 +332,48 @@ rrrrr,111111,RRRRR + wwwww,01011000000:XI:::div rrrrr!0,000010,RRRRR!0:I:::divh "divh r<reg1>, r<reg2>" { - COMPAT_1 (OP_40 ()); + unsigned32 ov, s, z; + signed long int op0, op1, result; + + trace_input ("divh", OP_REG_REG, 0); + + PC = cia; + OP[0] = instruction_0 & 0x1f; + OP[1] = (instruction_0 >> 11) & 0x1f; + + /* Compute the result. */ + op0 = EXTEND16 (State.regs[OP[0]]); + op1 = State.regs[OP[1]]; + + if (op0 == 0xffffffff && op1 == 0x80000000) + { + result = 0x80000000; + ov = 1; + } + else if (op0 != 0) + { + result = op1 / op0; + ov = 0; + } + else + { + result = 0x0; + ov = 1; + } + + /* Compute the condition codes. */ + z = (result == 0); + s = (result & 0x80000000); + + /* Store the result and condition codes. */ + State.regs[OP[1]] = result; + PSW &= ~(PSW_Z | PSW_S | PSW_OV); + PSW |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0) | (ov ? PSW_OV : 0)); + + trace_output (OP_REG_REG); + + PC += 2; + nia = PC; } rrrrr,111111,RRRRR + wwwww,01010000000:XI:::divh diff --git a/texinfo/texinfo.tex b/texinfo/texinfo.tex index b0a1cfc..555a077 100644 --- a/texinfo/texinfo.tex +++ b/texinfo/texinfo.tex @@ -3,10 +3,10 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2002-06-04.06} +\def\texinfoversion{2003-02-03.16} % -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, -% 2000, 01, 02 Free Software Foundation, Inc. +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -29,19 +29,17 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo.tex +% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://texinfo.org/texinfo/texinfo.tex % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org), % and /home/gd/gnu/doc/texinfo.tex on the GNU machines. % +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% % The texinfo.tex in any given Texinfo distribution could well be out % of date, so if that's what you're using, please check. % -% Texinfo has a small home page at http://texinfo.org/ and also -% http://www.gnu.org/software/texinfo. -% % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. @@ -57,9 +55,10 @@ % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from the full Texinfo distribution. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. \message{Loading texinfo [version \texinfoversion]:} @@ -69,6 +68,13 @@ \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} +\message{Basics,} +\chardef\other=12 + +% We never want plain's outer \+ definition in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + % Save some parts of plain tex whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet @@ -79,19 +85,16 @@ \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! +\let\ptexgtr=> +\let\ptexhat=^ \let\ptexi=\i \let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexplus=+ \let\ptexrbrace=\} \let\ptexstar=\* \let\ptext=\t -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -\message{Basics,} -\chardef\other=12 - % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J @@ -138,40 +141,64 @@ \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\equalChar = `\= +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\spaceChar = `\ % +\chardef\underChar = `\_ + % Ignore a token. % \def\gobble#1{} +% True if #1 is the empty string, i.e., called like `\ifempty{}'. +% +\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}% +\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}% + +% Hyphenation fixes. \hyphenation{ap-pen-dix} \hyphenation{mini-buf-fer mini-buf-fers} \hyphenation{eshell} \hyphenation{white-space} % Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset +\newdimen\bindingoffset +\newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines\maxdimen }% -\fi % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. @@ -276,7 +303,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \turnoffactive + }% end of group with \normalturnoffactive \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -436,17 +463,6 @@ } -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading\singlespaceskip -} - %% Simple single-character @ commands % @@ prints an @ @@ -466,16 +482,19 @@ \let\{=\mylbrace \let\}=\myrbrace \begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c \let\dotaccent = \. \def\ringaccent#1{{\accent23 #1}} @@ -484,7 +503,7 @@ \let\udotaccent = \d % Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} @@ -539,6 +558,16 @@ % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% \def\group{\begingroup \ifnum\catcode13=\active \else \errhelp = \groupinvalidhelp @@ -552,10 +581,22 @@ % above. But it's pretty close. \def\Egroup{% \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \copy\groupbox \endgroup % End the \group. }% % - \vtop\bgroup + \setbox\groupbox = \vtop\bgroup % We have to put a strut on the last line in case the @group is in % the midst of an example, rather than completely enclosing it. % Otherwise, the interline space between the last line of the group @@ -753,30 +794,36 @@ where each line of input produces a line of output.} % @include file insert text of that file as input. % Allow normal characters that we make active in the argument (a file name). \def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other \parsearg\includezzz} % Restore active chars for included file. \def\includezzz#1{\endgroup\begingroup % Read the included file in a group so nested @include's work. \def\thisfile{#1}% + \let\value=\expandablevalue \input\thisfile \endgroup} \def\thisfile{} -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} +% @center line +% outputs that line, centered. +% +\def\center{\parsearg\docenter} +\def\docenter#1{{% + \ifhmode \hfil\break \fi + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{\hfil \ignorespaces#1\unskip \hfil}% + \ifhmode \break \fi +}} % @sp n outputs n lines of vertical space @@ -841,11 +888,6 @@ where each line of input produces a line of output.} % to set catcodes according to plain TeX first, to allow for subscripts, % superscripts, special math chars, etc. % -% @math does not do math typesetting in section titles, index -% entries, and other such contexts where the catcodes are set before -% @math gets a chance to work. This could perhaps be fixed, but for now -% at least we can have real math in the main text, where it's needed most. -% \let\implicitmath = $%$ font-lock fix % % One complication: _ usually means subscripts, but it could also mean @@ -853,9 +895,9 @@ where each line of input produces a line of output.} % _ within @math be active (mathcode "8000), and distinguish by seeing % if the current family is \slfam, which is what @var uses. % -{\catcode95 = \active % 95 = _ +{\catcode\underChar = \active \gdef\mathunderscore{% - \catcode95=\active + \catcode\underChar=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% }} % @@ -871,9 +913,27 @@ where each line of input produces a line of output.} \tex \mathcode`\_="8000 \mathunderscore \let\\ = \mathbackslash + \mathactive \implicitmath\finishmath} \def\finishmath#1{#1\implicitmath\Etex} +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an +% argument to a command which set the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + % @bullet and @minus need the same treatment as @math, just above. \def\bullet{\implicitmath\ptexbullet\implicitmath} \def\minus{\implicitmath-\implicitmath} @@ -965,7 +1025,7 @@ where each line of input produces a line of output.} \ifx\empty\imagewidth\else width \imagewidth \fi \ifx\empty\imageheight\else height \imageheight \fi \ifnum\pdftexversion<13 - #1.pdf% + #1.pdf% \else {#1.pdf}% \fi @@ -987,40 +1047,39 @@ where each line of input produces a line of output.} \openin 1 \jobname.toc \ifeof 1\else\begingroup \closein 1 - \indexnofonts - \def\tt{} - \let\_ = \normalunderscore % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % \def\chapentry ##1##2##3{} - \let\appendixentry = \chapentry - \def\unnumbchapentry ##1##2{} \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2##3{\advancenumber{chap##2}} \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2##3##4{\advancenumber{sec##2.##3}} \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2##3##4##5{\advancenumber{subsec##2.##3.##4}} + \let\appendixentry = \chapentry + \let\unnumbchapentry = \chapentry + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry \input \jobname.toc \def\chapentry ##1##2##3{% \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \let\appendixentry = \chapentry - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} \def\secentry ##1##2##3##4{% \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}{##1}} \def\subsecentry ##1##2##3##4##5{% \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}{##1}} \def\subsubsecentry ##1##2##3##4##5##6{% \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}{##1}} + \let\appendixentry = \chapentry + \let\unnumbchapentry = \chapentry + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry + % + % Make special characters normal for writing to the pdf file. + % + \indexnofonts + \let\tt=\relax + \turnoffactive \input \jobname.toc \endgroup\fi }} @@ -1170,7 +1229,7 @@ where each line of input produces a line of output.} \newcount\mainmagstep \ifx\bigger\relax % not really supported. - \let\mainmagstep=\magstep1 + \mainmagstep=\magstep1 \setfont\textrm\rmshape{12}{1000} \setfont\texttt\ttshape{12}{1000} \else @@ -1178,9 +1237,10 @@ where each line of input produces a line of output.} \setfont\textrm\rmshape{10}{\mainmagstep} \setfont\texttt\ttshape{10}{\mainmagstep} \fi -% Instead of cmb10, you many want to use cmbx10. +% Instead of cmb10, you may want to use cmbx10. % cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. +% looks better when embedded in a line with cmr10 +% (in Bob's opinion). \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1231,6 +1291,7 @@ where each line of input produces a line of output.} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} +\def\authortt{\sectt} % Chapter (and unnumbered) fonts (17.28pt). \setfont\chaprm\rmbshape{12}{\magstep2} @@ -1328,7 +1389,25 @@ where each line of input produces a line of output.} \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \resetmathfonts \setleading{9.5pt}} -\let\smallexamplefonts = \smallerfonts + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \smallerfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish we used A4 paper on this side of the Atlantic. +% +% --karl, 24jan03. + % Set up the default fonts, so we can use them for creating boxes. % @@ -1345,6 +1424,7 @@ where each line of input produces a line of output.} \setfont\shortcontrm\rmshape{12}{1000} \setfont\shortcontbf\bxshape{12}{1000} \setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} %% Add scribe-like font environments, plus @l for inline lisp (usually sans %% serif) and @ii for TeX italic @@ -1352,8 +1432,8 @@ where each line of input produces a line of output.} % \smartitalic{ARG} outputs arg in italics, followed by an italic correction % unless the following character is such as not to need one. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} \let\i=\smartitalic \let\var=\smartslanted @@ -1371,6 +1451,17 @@ where each line of input produces a line of output.} \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + \def\t#1{% {\tt \rawbackslash \frenchspacing #1}% \null @@ -1470,15 +1561,17 @@ where each line of input produces a line of output.} \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\arg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle `\arg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} +% Default is `distinct.' +\kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% @@ -1592,7 +1685,8 @@ where each line of input produces a line of output.} \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% + \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt}% % % Leave some space at the very top of the page. \vglue\titlepagetopglue @@ -1873,10 +1967,18 @@ where each line of input produces a line of output.} % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % - % Stop a page break at the \parskip glue coming up. Unfortunately + % Stop a page break at the \parskip glue coming up. (Unfortunately % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak + % \baselineskip glue.) However, if what follows is an environment + % such as @example, there will be no \parskip glue; then + % the negative vskip we just would cause the example and the item to + % crash together. So we use this bizarre value of 10001 as a signal + % to \aboveenvbreak to insert \parskip glue after all. + % (Possibly there are other commands that could be followed by + % @example which need the same treatment, but not section titles; or + % maybe section titles are the only special case and they should be + % penalty 10001...) + \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else @@ -1982,11 +2084,6 @@ where each line of input produces a line of output.} \def\itemcontents{#1}% \let\item=\itemizeitem} -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % @@ -2208,8 +2305,8 @@ where each line of input produces a line of output.} \let\go\pickupwholefraction \else \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi @@ -2224,18 +2321,18 @@ where each line of input produces a line of output.} \go } -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - % @multitable ... @end multitable definitions: % \def\multitable{\parsearg\dotable} \def\dotable#1{\bgroup \vskip\parskip - \let\item\crcr + \let\item=\crcrwithfootnotes + % A \tab used to include \hskip1sp. But then the space in a template + % line is not enough. That is bad. So let's go back to just & until + % we encounter the problem it was intended to solve again. --karl, + % nathan@acm.org, 20apr99. + \let\tab=&% + \let\startfootins=\startsavedfootnote \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2243,7 +2340,11 @@ where each line of input produces a line of output.} \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% + \def\Emultitable{% + \global\setpercentfalse + \crcrwithfootnotes\crcr + \egroup\egroup + }% % % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable @@ -2332,6 +2433,25 @@ width0pt\relax} \fi %% than skip between lines in the table. \fi} +% In case a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is +% finished. Otherwise, the insertion is lost, it never migrates to the +% main vertical list. --kasal, 22jan03. +% +\newbox\savedfootnotes +% +% \dotable \let's \startfootins to this, so that \dofootnote will call +% it instead of starting the insertion right away. +\def\startsavedfootnote{% + \global\setbox\savedfootnotes = \vbox\bgroup + \unvbox\savedfootnotes +} +\def\crcrwithfootnotes{% + \crcr + \ifvoid\savedfootnotes \else + \noalign{\insert\footins{\box\savedfootnotes}}% + \fi +} \message{conditionals,} % Prevent errors for section commands. @@ -2367,65 +2487,117 @@ width0pt\relax} \fi % and so want to turn off most commands, in case they are used % incorrectly. % +% We use \empty instead of \relax for the @def... commands, so that \end +% doesn't throw an error. For instance: +% @ignore +% @deffn ... +% @end deffn +% @end ignore +% +% The @end deffn is going to get expanded, because we're trying to allow +% nested conditionals. But we don't want to expand the actual @deffn, +% since it might be syntactically correct and intended to be ignored. +% Since \end checks for \relax, using \empty does not cause an error. +% \def\ignoremorecommands{% \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax + \let\defcv = \empty + \let\defcvx = \empty + \let\Edefcv = \empty + \let\deffn = \empty + \let\deffnx = \empty + \let\Edeffn = \empty \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax + \let\defivar = \empty + \let\defivarx = \empty + \let\Edefivar = \empty + \let\defmac = \empty + \let\defmacx = \empty + \let\Edefmac = \empty + \let\defmethod = \empty + \let\defmethodx = \empty + \let\Edefmethod = \empty + \let\defop = \empty + \let\defopx = \empty + \let\Edefop = \empty + \let\defopt = \empty + \let\defoptx = \empty + \let\Edefopt = \empty + \let\defspec = \empty + \let\defspecx = \empty + \let\Edefspec = \empty + \let\deftp = \empty + \let\deftpx = \empty + \let\Edeftp = \empty + \let\deftypefn = \empty + \let\deftypefnx = \empty + \let\Edeftypefn = \empty + \let\deftypefun = \empty + \let\deftypefunx = \empty + \let\Edeftypefun = \empty + \let\deftypeivar = \empty + \let\deftypeivarx = \empty + \let\Edeftypeivar = \empty + \let\deftypemethod = \empty + \let\deftypemethodx = \empty + \let\Edeftypemethod = \empty + \let\deftypeop = \empty + \let\deftypeopx = \empty + \let\Edeftypeop = \empty + \let\deftypevar = \empty + \let\deftypevarx = \empty + \let\Edeftypevar = \empty + \let\deftypevr = \empty + \let\deftypevrx = \empty + \let\Edeftypevr = \empty + \let\defun = \empty + \let\defunx = \empty + \let\Edefun = \empty + \let\defvar = \empty + \let\defvarx = \empty + \let\Edefvar = \empty + \let\defvr = \empty + \let\defvrx = \empty + \let\Edefvr = \empty + \let\clear = \relax + \let\down = \relax + \let\evenfooting = \relax \let\evenheading = \relax - \let\oddheading = \relax \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax + \let\everyheading = \relax \let\headings = \relax \let\include = \relax + \let\item = \relax \let\lowersections = \relax - \let\down = \relax + \let\oddfooting = \relax + \let\oddheading = \relax + \let\printindex = \relax + \let\pxref = \relax \let\raisesections = \relax - \let\up = \relax + \let\ref = \relax \let\set = \relax - \let\clear = \relax - \let\item = \relax + \let\setchapternewpage = \relax + \let\setchapterstyle = \relax + \let\settitle = \relax + \let\up = \relax + \let\verbatiminclude = \relax + \let\xref = \relax } -% Ignore @ignore, @ifhtml, @ifinfo, @ifplaintext, @ifnottex, @html, @menu, -% @direntry, and @documentdescription. +% Ignore @ignore, @ifhtml, @ifinfo, and the like. % -\def\ignore{\doignore{ignore}} +\def\direntry{\doignore{direntry}} +\def\documentdescriptionword{documentdescription} +\def\documentdescription{\doignore{documentdescription}} +\def\html{\doignore{html}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} -\def\ifplaintext{\doignore{ifplaintext}} \def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} -\def\documentdescription{\doignore{documentdescription}} -\def\documentdescriptionword{documentdescription} +\def\xml{\doignore{xml}} % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. @@ -2443,7 +2615,7 @@ width0pt\relax} \fi \long\def\doignoretext##1@end #1{\enddoignore}% % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 + \catcode\spaceChar = 10 % % Ignore braces, too, so mismatched braces don't cause trouble. \catcode`\{ = 9 @@ -2485,7 +2657,7 @@ width0pt\relax} \fi \immediate\write16{If you are running another version of TeX, relax.} \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} + \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)} \immediate\write16{If you are stuck with version 3.0, run the} \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} \immediate\write16{ to use a workaround.} @@ -2507,8 +2679,8 @@ width0pt\relax} \fi % We must actually expand the ignored text to look for the @end % command, so that nested ignore constructs work. Thus, we put the % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. + % the chance of memory overflow, we follow the approach outlined on + % page 401 of the TeXbook. % \setbox0 = \vbox\bgroup % Don't complain about control sequences we have declared \outer. @@ -2529,8 +2701,8 @@ width0pt\relax} \fi % % Set the current font to be \nullfont, a TeX primitive, and define % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still + % dummy.tfm, as suggested in the TeXbook, because some sites + % might not have that installed. Therefore, math mode will still % produce output, but that should be an extremely small amount of % stuff compared to the main input. % @@ -2559,7 +2731,7 @@ width0pt\relax} \fi % Do minimal line-breaking. \pretolerance = 10000 % - % Do not execute instructions in @tex + % Do not execute instructions in @tex. \def\tex{\doignore{tex}}% % Do not execute macro definitions. % `c' is a comment character, so the word `macro' will get cut off. @@ -2604,7 +2776,7 @@ width0pt\relax} \fi % we're called from @code, as @code{@value{foo-bar_}}. So \let any % such active characters to their normal equivalents. \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 + \catcode`\-=\other \catcode`\_=\other \indexbreaks \let_\normalunderscore \valuexxx} } @@ -2613,15 +2785,17 @@ width0pt\relax} \fi % We have this subroutine so that we can handle at least some @value's % properly in indexes (we \let\value to this in \indexdummies). Ones % whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). +% about that. The command has to be fully expandable (if the variable +% is set), since the result winds up in the index file. This means that +% if the variable's value contains other Texinfo commands, it's almost +% certain it will fail (although perhaps we could fix that with +% sufficient work to do a one-level expansion on the result, instead of +% complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi @@ -2630,13 +2804,14 @@ width0pt\relax} \fi % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% +\def\ifset{\parsearg\doifset} +\def\doifset#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail + \let\next=\ifsetfail \else - \expandafter\ifsetsucceed + \let\next=\ifsetsucceed \fi + \next } \def\ifsetsucceed{\conditionalsucceed{ifset}} \def\ifsetfail{\nestedignore{ifset}} @@ -2645,13 +2820,14 @@ width0pt\relax} \fi % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% +\def\ifclear{\parsearg\doifclear} +\def\doifclear#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed + \let\next=\ifclearsucceed \else - \expandafter\ifclearfail + \let\next=\ifclearfail \fi + \next } \def\ifclearsucceed{\conditionalsucceed{ifclear}} \def\ifclearfail{\nestedignore{ifclear}} @@ -2670,28 +2846,13 @@ width0pt\relax} \fi \defineunmatchedend{ifnotinfo} \defineunmatchedend{ifnotplaintext} -% We can't just want to start a group at @iftex (etc.) and end it at -% @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. +% True conditional. Since \set globally defines its variables, we can +% just start and end a group (to keep the @end definition undefined at +% the outer level). % -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} +\def\conditionalsucceed#1{\begingroup + \expandafter\def\csname E#1\endcsname{\endgroup}% +} % @defininfoenclose. \let\definfoenclose=\comment @@ -2784,104 +2945,166 @@ width0pt\relax} \fi \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% -\def\ { }% -\def\@{@}% change to @@ when we switch to @ as escape char in aux files. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\normalturnoffactive -% -% Take care of the plain tex accent commands. -\def\,##1{\realbackslash ,{##1}}% -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -\def\dotless##1{\realbackslash dotless {##1}}% -% Take care of the plain tex special European modified letters. -\def\AA{\realbackslash AA}% -\def\AE{\realbackslash AE}% -\def\L{\realbackslash L}% -\def\OE{\realbackslash OE}% -\def\O{\realbackslash O}% -\def\aa{\realbackslash aa}% -\def\ae{\realbackslash ae}% -\def\l{\realbackslash l}% -\def\oe{\realbackslash oe}% -\def\o{\realbackslash o}% -\def\ss{\realbackslash ss}% -% -% Although these internals commands shouldn't show up, sometimes they do. -\def\bf{\realbackslash bf }% -\def\gtr{\realbackslash gtr}% -\def\hat{\realbackslash hat}% -\def\less{\realbackslash less}% -%\def\rm{\realbackslash rm }% -\def\sf{\realbackslash sf}% -\def\sl{\realbackslash sl }% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\tt{\realbackslash tt}% -% -\def\b##1{\realbackslash b {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -% -\def\TeX{\realbackslash TeX}% -\def\acronym##1{\realbackslash acronym {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\dots{\realbackslash dots }% -\def\emph##1{\realbackslash emph {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\math##1{\realbackslash math {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\strong##1{\realbackslash strong {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\w{\realbackslash w }% -% -% These math commands don't seem likely to be used in index entries. -\def\copyright{\realbackslash copyright}% -\def\equiv{\realbackslash equiv}% -\def\error{\realbackslash error}% -\def\expansion{\realbackslash expansion}% -\def\point{\realbackslash point}% -\def\print{\realbackslash print}% -\def\result{\realbackslash result}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + % Control letters and accents. + \definedummyletter{_}% + \definedummyletter{,}% + \definedummyletter{"}% + \definedummyletter{`}% + \definedummyletter{'}% + \definedummyletter{^}% + \definedummyletter{~}% + \definedummyletter{=}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Other non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + \definedummyword{TeX}% + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{dots}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{w}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{copyright}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where the variable name does not + % contain - or _, and the value does not contain any + % (non-fully-expandable) commands. + \let\value = \expandablevalue + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros } % If an index command is used in an @example environment, any spaces @@ -2890,83 +3113,86 @@ width0pt\relax} \fi {\obeyspaces \gdef\unsepspaces{\obeyspaces\let =\space}} -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% \def\indexdummytex{TeX} \def\indexdummydots{...} - +% \def\indexnofonts{% -\def\@{@}% -% how to handle braces? -\def\_{\normalunderscore}% -% -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\AA{AA}% -\def\AE{AE}% -\def\L{L}% -\def\OE{OE}% -\def\O{O}% -\def\aa{aa}% -\def\ae{ae}% -\def\l{l}% -\def\oe{oe}% -\def\o{o}% -\def\ss{ss}% -% -% Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |, etc. -% Likewise with the other plain tex font commands. -%\let\tt=\indexdummyfont -% -\let\b=\indexdummyfont -\let\i=\indexdummyfont -\let\r=\indexdummyfont -\let\sc=\indexdummyfont -\let\t=\indexdummyfont -% -\let\TeX=\indexdummytex -\let\acronym=\indexdummyfont -\let\cite=\indexdummyfont -\let\code=\indexdummyfont -\let\command=\indexdummyfont -\let\dfn=\indexdummyfont -\let\dots=\indexdummydots -\let\emph=\indexdummyfont -\let\env=\indexdummyfont -\let\file=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\math=\indexdummyfont -\let\option=\indexdummyfont -\let\samp=\indexdummyfont -\let\strong=\indexdummyfont -\let\uref=\indexdummyfont -\let\url=\indexdummyfont -\let\var=\indexdummyfont -\let\w=\indexdummyfont -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + \let\,=\asis + \let\"=\asis + \let\`=\asis + \let\'=\asis + \let\^=\asis + \let\~=\asis + \let\==\asis + \let\u=\asis + \let\v=\asis + \let\H=\asis + \let\dotaccent=\asis + \let\ringaccent=\asis + \let\tieaccent=\asis + \let\ubaraccent=\asis + \let\udotaccent=\asis + \let\dotless=\asis + % + % Other non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + % Texinfo font commands. + \let\b=\asis + \let\i=\asis + \let\r=\asis + \let\sc=\asis + \let\t=\asis + % + \let\TeX=\indexdummytex + \let\acronym=\asis + \let\cite=\asis + \let\code=\asis + \let\command=\asis + \let\dfn=\asis + \let\dots=\indexdummydots + \let\emph=\asis + \let\env=\asis + \let\file=\asis + \let\kbd=\asis + \let\key=\asis + \let\math=\asis + \let\option=\asis + \let\samp=\asis + \let\strong=\asis + \let\uref=\asis + \let\url=\asis + \let\var=\asis + \let\w=\asis +} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -2998,28 +3224,24 @@ width0pt\relax} \fi \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. + % The main index entry text. \toks0 = {#2}% % - % If the third (subentry) arg is present, add it to the index - % line to write. + % If third arg is present, precede it with space in sort key. + \def\thirdarg{#3}% \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0{#3}}% + % If the third (subentry) arg is present, add it to the index + % line to write. + \toks0 = \expandafter{\the\toks0 \space #3}% \fi % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the @@ -3050,12 +3272,11 @@ width0pt\relax} \fi \iflinks \ifvmode \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi + \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi \fi % \temp % do the write % - % \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi \fi }% @@ -3531,42 +3752,41 @@ width0pt\relax} \fi \outer\def\chapter{\parsearg\chapteryyy} \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% + \chapmacro {#1}{\the\chapno}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. + \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% + \writetocentry{chap}{#1}{{\the\chapno}} + \donoderef + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +% we use \chapno to avoid indenting back +\def\appendixbox#1{% + \setbox0 = \hbox{\putwordAppendix{} \the\chapno}% + \hbox to \wd0{#1\hss}} \outer\def\appendix{\parsearg\appendixyyy} \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz \def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash appendixentry{\the\toks0}% - {\appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \appendixno by 1 + \message{\putwordAppendix\space \appendixletter}% + \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% + \writetocentry{appendix}{#1}{{\appendixletter}} + \appendixnoderef + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. @@ -3579,150 +3799,121 @@ width0pt\relax} \fi \outer\def\unnumbered{\parsearg\unnumberedyyy} \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz \def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of <toks register>. (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the<toks register> to achieve this: TeX expands \the<toks> only once, + % simply yielding the contents of <toks register>. (We also do this for + % the toc entries.) + \toks0 = {#1}\message{(\the\toks0)}% + % + \unnumbchapmacro {#1}% + \gdef\thischapter{#1}\gdef\thissection{#1}% + \writetocentry{unnumbchap}{#1}{{\the\chapno}} + \unnumbnoderef + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec } % Sections. \outer\def\numberedsec{\parsearg\secyyy} \def\secyyy #1{\numhead1{#1}} % normally calls seczzz \def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% + \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} + \donoderef + \nobreak } \outer\def\appendixsection{\parsearg\appendixsecyyy} \outer\def\appendixsec{\parsearg\appendixsecyyy} \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz \def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% + \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz \def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry% - {\the\toks0}{\the\chapno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} + \unnumbnoderef + \nobreak } % Subsections. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz \def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz \def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz \def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}{\the\chapno}{\the\secno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \unnumbnoderef + \nobreak } % Subsubsections. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz \def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz \def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz \def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \unnumbnoderef + \nobreak } % These are variants which are not "outer", so they can appear in @ifinfo. @@ -3763,16 +3954,16 @@ width0pt\relax} \fi \def\majorheading{\parsearg\majorheadingzzz} \def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\advance\chapheadingskip by 10pt \chapbreak }% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} \def\chapheading{\parsearg\chapheadingzzz} \def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} % @heading, @subheading, @subsubheading. \def\heading{\parsearg\plainsecheading} @@ -3918,7 +4109,16 @@ width0pt\relax} \fi \hangindent = \wd0 % zero if no section number \unhbox0 #3}% }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak + % Add extra space after the heading -- either a line space or a + % paragraph space, whichever is more. (Some people like to set + % \parskip to large values for some reason.) Don't allow stretch, though. + \nobreak + \ifdim\parskip>\normalbaselineskip + \kern\parskip + \else + \kern\normalbaselineskip + \fi + \nobreak } @@ -3930,16 +4130,22 @@ width0pt\relax} \fi % Called from @chapter, etc. We supply {\folio} at the end of the % argument, which will end up as the last argument to the \...entry macro. % -% We open the .toc file here instead of at @setfilename or any other -% fixed time so that @contents can be put in the document anywhere. +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. % \newif\iftocfileopened -\def\writetocentry#1{% +\def\writetocentry#1#2#3{% \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi - \iflinks \write\tocfile{#1{\folio}}\fi + % + \iflinks + \toks0 = {#2}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% + \temp + \fi % % Tell \shipout to create a page destination if we're doing pdf, which % will be the target of the links in the table of contents. We can't @@ -3978,7 +4184,7 @@ width0pt\relax} \fi \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } @@ -3995,7 +4201,7 @@ width0pt\relax} \fi \pdfmakeoutlines \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } % And just the chapters. @@ -4007,16 +4213,17 @@ width0pt\relax} \fi \let\unnumbchapentry = \shortunnumberedentry % We want a true roman here for the page numbers. \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2##3{} \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2##3##4{} \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2##3##4##5{} + \let\unnumbsecentry = \secentry + \let\unnumbsubsecentry = \subsecentry + \let\unnumbsubsubsecentry = \subsubsecentry \openin 1 \jobname.toc \ifeof 1 \else \closein 1 @@ -4026,7 +4233,7 @@ width0pt\relax} \fi \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents @@ -4049,7 +4256,8 @@ width0pt\relax} \fi } % Appendices, in the main contents. -\def\appendixentry#1#2#3{\dochapentry{\putwordAppendix{} #2\labelspace#1}{#3}} +\def\appendixentry#1#2#3{% + \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}} % % Appendices, in the short toc. \let\shortappendixentry = \shortchapentry @@ -4073,21 +4281,21 @@ width0pt\relax} \fi } % Unnumbered chapters. -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} +\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}} +\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}} % Sections. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2#3{\dosecentry{#1}{#3}} +\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} +\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}} % And subsubsections. \def\subsubsecentry#1#2#3#4#5#6{% \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2#3#4#5{\dosubsubsecentry{#1}{#5}} +\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}} % This parameter controls the indentation of the various levels. \newdimen\tocindent \tocindent = 3pc @@ -4189,14 +4397,14 @@ width0pt\relax} \fi \def\tex{\begingroup \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\==\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other \escapechar=`\\ % \let\b=\ptexb @@ -4250,15 +4458,18 @@ width0pt\relax} \fi % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip +% start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% - \ifnum\lastpenalty < 10000 + % =10000 instead of <10000 because of a special case in \itemzzz, q.v. + \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip - \penalty-50 + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty>10000 \else \penalty-50 \fi \vskip\envskipamount \fi \fi @@ -4290,7 +4501,8 @@ width0pt\relax} \fi % \newskip\lskip\newskip\rskip -\long\def\cartouche{% +\def\cartouche{% +\par % can't be in the midst of a paragraph. \begingroup \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt %we want these *outside*. @@ -4337,7 +4549,6 @@ width0pt\relax} \fi \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt @@ -4376,27 +4587,16 @@ width0pt\relax} \fi % @example: Same as @lisp. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. +% @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup +\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}% \def\Esmallexample{\nonfillfinish\endgroup}% \smallexamplefonts \lisp } +\let\smallexample = \smalllisp + % @display: same as @lisp except keep current font. % @@ -4406,9 +4606,9 @@ width0pt\relax} \fi \gobble } % -% @smalldisplay (when @smallbook): @display plus smaller fonts. +% @smalldisplay: @display plus smaller fonts. % -\def\smalldisplayx{\begingroup +\def\smalldisplay{\begingroup \def\Esmalldisplay{\nonfillfinish\endgroup}% \smallexamplefonts \rm \display @@ -4423,9 +4623,9 @@ width0pt\relax} \fi \gobble } % -% @smallformat (when @smallbook): @format plus smaller fonts. +% @smallformat: @format plus smaller fonts. % -\def\smallformatx{\begingroup +\def\smallformat{\begingroup \def\Esmallformat{\nonfillfinish\endgroup}% \smallexamplefonts \rm \format @@ -4452,7 +4652,6 @@ width0pt\relax} \fi \def\quotation{% \begingroup\inENV %This group ends at the end of the @quotation body {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace \parindent=0pt % We have retained a nonzero parskip for the environment, since we're % doing normal filling. So to avoid extra space below the environment... @@ -4475,10 +4674,14 @@ width0pt\relax} \fi % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % -% [Knuth] p. 344; only we need to do '@' too +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. \def\dospecials{% - \do\ \do\\\do\@\do\{\do\}\do\$\do\&% - \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~} + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} % % [Knuth] p. 380 \def\uncatcodespecials{% @@ -4565,7 +4768,7 @@ width0pt\relax} \fi % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': -% we need not redefine '\', '{' and '}' +% we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] %% Include LaTeX hack for completeness -- never know @@ -4575,9 +4778,14 @@ width0pt\relax} \fi %% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ %% #1|endgroup|def|Everbatim[]|end[verbatim]] %% |endgroup +% \begingroup \catcode`\ =\active - \gdef\doverbatim#1@end verbatim{#1\end{verbatim}} + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}% \endgroup % \def\verbatim{% @@ -4593,14 +4801,14 @@ width0pt\relax} \fi % Allow normal characters that we make active in the argument (a file name). \def\verbatiminclude{% \begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other \parsearg\doverbatiminclude } \def\setupverbatiminclude{% @@ -4614,44 +4822,102 @@ width0pt\relax} \fi % Restore active chars for included file. \endgroup \begingroup - \def\thisfile{#1}% - \expandafter\expandafter\setupverbatiminclude\input\thisfile - \endgroup\nonfillfinish\endgroup + \let\value=\expandablevalue + \def\thisfile{#1}% + \expandafter\expandafter\setupverbatiminclude\input\thisfile + \endgroup + \nonfillfinish + \endgroup } % @copying ... @end copying. -% Save the text away for @insertcopying later. +% Save the text away for @insertcopying later. Many commands won't be +% allowed in this context, but that's ok. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. % -\newbox\copyingbox -% \def\copying{\begingroup - \parindent = 0pt % looks wrong on title page - \def\Ecopying{\egroup\endgroup}% - \global\setbox\copyingbox = \vbox\bgroup + % Define a command to swallow text until we reach `@end copying'. + % \ is the escape char in this texinfo.tex file, so it is the + % delimiter for the command; @ will be the escape char when we read + % it, but that doesn't matter. + \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}% + % + % We must preserve ^^M's in the input file; see \insertcopying below. + \catcode`\^^M = \active + \docopying } -% @insertcopying. -% -\def\insertcopying{\unvcopy\copyingbox} +% What we do to finish off the copying text. +% +\def\enddocopying{\endgroup\ignorespaces} +% @insertcopying. Here we must play games with ^^M's. On the one hand, +% we need them to delimit commands such as `@end quotation', so they +% must be active. On the other hand, we certainly don't want every +% end-of-line to be a \par, as would happen with the normal active +% definition of ^^M. On the third hand, two ^^M's in a row should still +% generate a \par. +% +% Our approach is to make ^^M insert a space and a penalty1 normally; +% then it can also check if \lastpenalty=1. If it does, then manually +% do \par. +% +% This messes up the normal definitions of @c[omment], so we redefine +% it. Similarly for @ignore. (These commands are used in the gcc +% manual for man page generation.) +% +% Seems pretty fragile, most line-oriented commands will presumably +% fail, but for the limited use of getting the copying text (which +% should be quite simple) inserted, we can hope it's ok. +% +{\catcode`\^^M=\active % +\gdef\insertcopying{\begingroup % + \parindent = 0pt % looks wrong on title page + \def^^M{% + \ifnum \lastpenalty=1 % + \par % + \else % + \space \penalty 1 % + \fi % + }% + % + % Fix @c[omment] for catcode 13 ^^M's. + \def\c##1^^M{\ignorespaces}% + \let\comment = \c % + % + % Don't bother jumping through all the hoops that \doignore does, it + % would be very hard since the catcodes are already set. + \long\def\ignore##1\end ignore{\ignorespaces}% + % + \copyingtext % +\endgroup}% +} \message{defuns,} % @defun etc. % Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} +\def\setdeffont#1 {\csname DEF#1\endcsname} \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. + +% We want ()&[] to print specially on the defun line. +% \def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} + \catcode`\(=\active \catcode`\)=\active + \catcode`\&=\active + \catcode`\[=\active \catcode`\]=\active +} % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) @@ -4698,36 +4964,51 @@ width0pt\relax} \fi % Active &'s sneak into the index arguments, so make sure it's defined. { - \catcode`& = 13 + \catcode`& = \active \global\let& = \ampnr } -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name +% \defname, which formats the name of the @def (not the args). +% #1 is the function name. +% #2 is the type of definition, such as "Function". +% +\def\defname#1#2{% + % How we'll output the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \ifempty{#2}% + \def\defnametype{}% + \else + \def\defnametype{[\rm #2]}% + \fi + % + % Get the values of \leftskip and \rightskip as they were outside the @def... + \dimen2=\leftskip + \advance\dimen2 by -\defbodyindent + % + % Figure out values for the paragraph shape. + \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}% + \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line + \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations + \parshape 2 0in \dimen0 \defargsindent \dimen1 + % + % Output arg 2 ("Function" or some such) but stuck inside a box of + % width 0 so it does not interfere with linebreaking. + \noindent + % + {% Adjust \hsize to exclude the ambient margins, + % so that \rightline will obey them. + \advance \hsize by -\dimen2 + \dimen3 = 0pt % was -1.25pc + \rlap{\rightline{\defnametype\kern\dimen3}}% + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \advance\leftskip by -\defbodyindent + \exdentamount=\defbodyindent + {\df #1}\enskip % output function name + % \defunargs will be called next to output the arguments, if any. } % Common pieces to start any @def... @@ -4740,8 +5021,11 @@ width0pt\relax} \fi % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we want to allow a - % break after all. - \ifnum\lastpenalty = 10000 \penalty0 \fi + % break after all. Check for penalty 10002 (inserted by + % \defargscommonending) instead of 10000, since the sectioning + % commands insert a \penalty10000, and we don't want to allow a break + % between a section heading and a defun. + \ifnum\lastpenalty=10002 \penalty0 \fi \medbreak % % Define the \E... end token that this defining construct specifies @@ -4753,24 +5037,38 @@ width0pt\relax} \fi \exdentamount=\defbodyindent } +% Common part of the \...x definitions. +% +\def\defxbodycommon{% + % As with \parsebodycommon above, allow line break if we have multiple + % x headers in a row. It's not a great place, though. + \ifnum\lastpenalty=10000 \penalty1000 \fi + % + \begingroup\obeylines +} + % Process body of @defun, @deffn, @defmac, etc. % \def\defparsebody#1#2#3{% \parsebodycommon{#1}{#2}{#3}% - \def#2{\begingroup\obeylines\activeparens\spacesplit#3}% - \catcode61=\active % 61 is `=' + \def#2{\defxbodycommon \activeparens \spacesplit#3}% + \catcode\equalChar=\active \begingroup\obeylines\activeparens \spacesplit#3% } -% #1, #2, #3 are the common arguments (see \defparsebody). +% #1, #2, #3 are the common arguments (see \parsebodycommon above). % #4, delimited by the space, is the class name. % \def\defmethparsebody#1#2#3#4 {% \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% + \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}% \begingroup\obeylines\activeparens - \spacesplit{#3{#4}}% + % The \empty here prevents misinterpretation of a construct such as + % @deffn {whatever} {Enharmonic comma} + % See comments at \deftpparsebody, although in our case we don't have + % to remove the \empty afterwards, since it is empty. + \spacesplit{#3{#4}}\empty } % Used for @deftypemethod and @deftypeivar. @@ -4780,7 +5078,7 @@ width0pt\relax} \fi % \def\deftypemethparsebody#1#2#3#4 #5 {% \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% + \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}% \begingroup\obeylines\activeparens \spacesplit{#3{#4}{#5}}% } @@ -4794,9 +5092,8 @@ width0pt\relax} \fi % \def\deftypeopparsebody#1#2#3#4#5 #6 {% \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 ##3 {% - \def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% + \def#2##1 ##2 ##3 {\def#4{##1}% + \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}% \begingroup\obeylines\activeparens \spacesplit{#3{#5}{#6}}% } @@ -4805,7 +5102,7 @@ width0pt\relax} \fi \def\defopparsebody #1#2#3#4#5 {% \parsebodycommon{#1}{#2}{#3}% \def#2##1 ##2 {\def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% + \defxbodycommon \activeparens \spacesplit{#3{##2}}}% \begingroup\obeylines\activeparens \spacesplit{#3{#5}}% } @@ -4816,8 +5113,8 @@ width0pt\relax} \fi % \def\defvarparsebody #1#2#3{% \parsebodycommon{#1}{#2}{#3}% - \def#2{\begingroup\obeylines\spacesplit#3}% - \catcode61=\active % + \def#2{\defxbodycommon \spacesplit#3}% + \catcode\equalChar=\active \begingroup\obeylines \spacesplit#3% } @@ -4826,14 +5123,14 @@ width0pt\relax} \fi \def\defopvarparsebody #1#2#3#4#5 {% \parsebodycommon{#1}{#2}{#3}% \def#2##1 ##2 {\def#4{##1}% - \begingroup\obeylines\spacesplit{#3{##2}}}% + \defxbodycommon \spacesplit{#3{##2}}}% \begingroup\obeylines \spacesplit{#3{#5}}% } \def\defvrparsebody#1#2#3#4 {% \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% \begingroup\obeylines \spacesplit{#3{#4}}% } @@ -4849,7 +5146,7 @@ width0pt\relax} \fi % \def\deftpparsebody #1#2#3#4 {% \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% + \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% \begingroup\obeylines \spacesplit{\parsetpheaderline{#3{#4}}}\empty } @@ -4867,24 +5164,37 @@ width0pt\relax} \fi #1{\removeemptybraces#2\relax}{#3}% }% -% Split up #2 at the first space token. +% Split up #2 (the rest of the input line) at the first space token. % call #1 with two arguments: % the first is all of #2 before the space token, % the second is all of #2 after that space token. % If #2 contains no space token, all of it is passed as the first arg % and the second is passed as empty. % -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} +{\obeylines % + \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}% + \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{% + \ifx\relax #3% + #1{#2}{}% + \else % + #1{#2}{#3#4}% + \fi}% +} % Define @defun. -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up +% This is called to end the arguments processing for all the @def... commands. +% +\def\defargscommonending{% + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \parsebodycommon. +} +% This expands the args and terminates the paragraph they comprise. +% \def\defunargs#1{\functionparens \sl % Expand, preventing hyphenation at `-' chars. % Note that groups don't affect changes in \hyphenchar. @@ -4893,9 +5203,7 @@ width0pt\relax} \fi #1% {\tensl\hyphenchar\font=45}% \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } \def\deftypefunargs #1{% @@ -4904,9 +5212,7 @@ width0pt\relax} \fi % Use \boldbraxnoamp, not \functionparens, so that & is not special. \boldbraxnoamp \tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } % Do complete processing of one @defun or @defunx line already parsed. @@ -4917,7 +5223,7 @@ width0pt\relax} \fi \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defun == @deffn Function @@ -4927,7 +5233,7 @@ width0pt\relax} \fi \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDeffunc}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefun int foobar (int @var{foo}, float @var{bar}) @@ -4941,7 +5247,7 @@ width0pt\relax} \fi \doind {fn}{\code{#2}}% Make entry in function index \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% \deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) @@ -4962,7 +5268,7 @@ width0pt\relax} \fi % at least some C++ text from working \defname {\defheaderxcond#2\relax$.$#3}{#1}% \deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defmac == @deffn Macro @@ -4972,7 +5278,7 @@ width0pt\relax} \fi \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefmac}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defspec == @deffn Special Form @@ -4982,7 +5288,7 @@ width0pt\relax} \fi \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefspec}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defop CATEGORY CLASS OPERATION ARG... @@ -4991,9 +5297,11 @@ width0pt\relax} \fi \defopparsebody\Edefop\defopx\defopheader\defoptype} % \def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry + \begingroup + \defname{#2}{\defoptype\ \putwordon\ #1}% + \defunargs{#3}% + \endgroup } % @deftypeop CATEGORY CLASS TYPE OPERATION ARG... @@ -5060,9 +5368,11 @@ width0pt\relax} \fi \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} \def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry + \begingroup + \defname{#2}{\defcvtype\ \putwordof\ #1}% + \defvarargs{#3}% + \endgroup } % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME @@ -5070,7 +5380,7 @@ width0pt\relax} \fi \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} % \def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index \begingroup \defname{#2}{\putwordInstanceVariableof\ #1}% \defvarargs{#3}% @@ -5082,8 +5392,8 @@ width0pt\relax} \fi % This is actually simple: just print them in roman. % This must expand the args and terminate the paragraph they make up \def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} + \defargscommonending +} % @defvr Counter foo-count @@ -5119,8 +5429,7 @@ width0pt\relax} \fi \def\deftypevarheader #1#2{% \dovarind#2 \relax% Make entry in variables index \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending \endgroup} \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} @@ -5130,8 +5439,7 @@ width0pt\relax} \fi \def\deftypevrheader #1#2#3{\dovarind#3 \relax% \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending \endgroup} % Now define @deftp @@ -5180,7 +5488,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ % Append \endinput to make sure that TeX does not see the ending newline. \toks0={#1\endinput}% \immediate\openout\macscribble=\jobname.tmp @@ -5194,7 +5502,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@ \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} \fi @@ -5224,7 +5532,7 @@ width0pt\relax} \fi } % Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% +{\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% @@ -5239,29 +5547,29 @@ width0pt\relax} \fi % body, and then making it the \newlinechar in \scanmacro. \def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\{=\other + \catcode`\}=\other + \catcode`\@=\other + \catcode`\^^M=\other \usembodybackslash} \def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\@=\other + \catcode`\\=\other} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -5302,32 +5610,33 @@ width0pt\relax} \fi \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% +\def\unmacro{\parsearg\dounmacro} +\def\dounmacro#1{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist + % Remove the macro name from \macrolist: \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% + \fi +} + % This makes use of the obscure feature that if the last token of a % <parameter list> is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. @@ -5510,15 +5819,23 @@ width0pt\relax} \fi \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), namely NAME-title (the corresponding @chapter/etc. name), +% NAME-pg (the page number), and NAME-snt (section number and type). +% Called from \foonoderef. +% +% We have to set \indexdummies so commands such as @code in a section +% title aren't expanded. It would be nicer not to expand the titles in +% the first place, but there's so many layers that that is hard to do. % +% Likewise, use \turnoffactive so that punctuation chars such as underscore +% and backslash work in node names. +% \def\setref#1#2{{% - \indexdummies + \atdummies \pdfmkdest{#1}% + % + \turnoffactive \dosetq{#1-title}{Ytitle}% \dosetq{#1-pg}{Ypagenumber}% \dosetq{#1-snt}{#2}% @@ -5570,7 +5887,7 @@ width0pt\relax} \fi \ifpdf \leavevmode \getfilename{#4}% - {\normalturnoffactive + {\turnoffactive \otherbackslash \ifnum\filenamelength>0 \startlink attr{/Border [0 0 0]}% goto file{\the\filename.pdf} name{#1}% @@ -5590,7 +5907,7 @@ width0pt\relax} \fi % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. - {\normalturnoffactive + {\turnoffactive \otherbackslash % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% @@ -5599,73 +5916,74 @@ width0pt\relax} \fi % [mynode], [\printednodename],\space % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% \fi \endlink \endgroup} -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) +% \dosetq is called from \setref to do the actual \write (\iflinks). +% \def\dosetq#1#2{% {\let\folio=0% - \normalturnoffactive \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi + \iflinks \next \fi }% } -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq +% \internalsetq{foo}{page} expands into +% CHARACTERS @xrdef{foo}{...expansion of \page...} +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} +% Things to be expanded by \internalsetq. +% \def\Ypagenumber{\folio} - \def\Ytitle{\thissection} - \def\Ynothing{} - \def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} \def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. + \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{\the\inputlineno:\space} \fi % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. - +% \def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname X#1\endcsname + }% + \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks @@ -5680,19 +5998,14 @@ width0pt\relax} \fi \fi \else % It's defined, so just use it. - \csname X#1\endcsname + \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. % -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} % Read the last existing aux file, if any. No error if none exists. \def\readauxfile{\begingroup @@ -5723,9 +6036,7 @@ width0pt\relax} \fi \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ @@ -5738,6 +6049,9 @@ width0pt\relax} \fi % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -5749,7 +6063,9 @@ width0pt\relax} \fi \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other + \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % % Make the characters 128-255 be printing characters {% \count 1=128 @@ -5759,17 +6075,18 @@ width0pt\relax} \fi \ifnum \count 1<256 \loop \fi }% }% - % The aux file uses ' as the escape (for now). + % % Turn off \ as an escape so we do not lose on % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ + % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ % Reference to such entries still does not work the way one would wish, % but at least they do not bomb out when the aux file is read in. + \catcode`\\=\other + % + % @ is our escape character in .aux files. \catcode`\{=1 \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other + \catcode`\@=0 % \openin 1 \jobname.aux \ifeof 1 \else @@ -5814,7 +6131,7 @@ width0pt\relax} \fi % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf - \footnotezzz + \dofootnote }% % Don't bother with the trickery in plain.tex to not require the @@ -5824,10 +6141,17 @@ width0pt\relax} \fi % \parseargline fail inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -\long\gdef\footnotezzz{\insert\footins\bgroup +% The start of the footnote looks usually like this: +\gdef\startfootins{\insert\footins\bgroup} +% +% ... but this macro is redefined inside @multitable. +% +\gdef\dofootnote{% + \startfootins % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. + \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -5857,12 +6181,6 @@ width0pt\relax} \fi \footstrut \futurelet\next\fo@t } -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - }%end \catcode `\@=11 % @| inserts a changebar to the left of the current line. It should @@ -5909,8 +6227,8 @@ width0pt\relax} \fi \openin 1 = epsf.tex \ifeof 1 \else \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi @@ -6035,11 +6353,13 @@ should work if nowhere else does.} } % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. We also call -% \setleading{\textleading}, so the caller should define \textleading. -% The caller should also set \parskip. +% 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) +% physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. % -\def\internalpagesizes#1#2#3#4#5#6{% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip @@ -6058,28 +6378,27 @@ should work if nowhere else does.} \normaloffset = #4\relax \bindingoffset = #5\relax % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } -% Use `small' versions. -% -\def\smallenvironments{% - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx -} - % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.5 (or so) format. @@ -6087,26 +6406,42 @@ should work if nowhere else does.} \parskip = 2pt plus 1pt \textleading = 12pt % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt - \deftypemargin = 0pt \defbodyindent = .5cm - \smallenvironments }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt - \textleading = 12pt + \textleading = 13.2pt % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. @@ -6116,37 +6451,40 @@ should work if nowhere else does.} \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % - \internalpagesizes{166mm}{120mm}{\voffset}{-8mm}{\bindingoffset}{8pt}% + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt - \contentsrightmargin = 0mm - \deftypemargin = 0pt + \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm - % - \smallenvironments }} -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. +% A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 - \textleading = 13.6pt - % \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% % - % Must explicitly reset to 0 because we call \afourpaper, apparently, - % although this does not entirely make sense. + % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 \afourpaper - \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% -} + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, @@ -6161,7 +6499,16 @@ should work if nowhere else does.} \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% }} % Set default to letter. @@ -6225,7 +6572,7 @@ should work if nowhere else does.} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} % Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} @@ -6239,8 +6586,6 @@ should work if nowhere else does.} \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix -%\catcode 27=\active -%\def^^[{$\diamondsuit$} % Set up an active definition for =, but don't enable it most of the time. {\catcode`\==\active @@ -6257,44 +6602,46 @@ should work if nowhere else does.} \catcode`\@=0 -% \rawbackslashxx output one backslash character in current font +% \rawbackslashxx outputs one backslash character in current font, +% as in \char`\\. \global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} -% \rawbackslash redefines \ as input to do \rawbackslashxx. +% \rawbackslash defines an active \ to do \rawbackslashxx. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. {\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} + @gdef@rawbackslash{@let\=@rawbackslashxx} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} % \normalbackslash outputs one backslash in fixed width font. \def\normalbackslash{{\tt\rawbackslashxx}} -% \catcode 17=0 % Define control-q \catcode`\\=\active % Used sometimes to turn off (effectively) the active characters % even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar}%$ font-lock fix - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar}%$ font-lock fix +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. |